Pep8 on ecrans module

This commit is contained in:
Florent 2012-03-13 17:31:24 +01:00
commit b0e8c10499
4 changed files with 18 additions and 14 deletions

View file

@ -20,25 +20,29 @@
import re
def id2url(_id):
"return an url from an id"
regexp2 = re.compile("(\w+).([0-9]+).(.*$)")
match = regexp2.match(_id)
if match:
return 'http://www.20minutes.fr/%s/%s/%s' % ( match.group(1),
match.group(2),
match.group(3))
return 'http://www.20minutes.fr/%s/%s/%s' % (match.group(1),
match.group(2),
match.group(3))
else:
raise ValueError("id doesn't match")
def url2id(url):
"return an id from an url"
regexp = re.compile("(^.*),([0-9]+)\.html$")
regexp = re.compile("(^.*),([0-9]+)\.html$")
match = regexp.match(url)
if match:
if match:
return match.group(2)
else:
raise ValueError("Can't find an id for the url")
def rssid(entry):
return url2id(entry.id)