Some manual style fixes

This commit is contained in:
Laurent Bachelier 2013-03-15 22:31:33 +01:00
commit fbe0fb8d52
10 changed files with 18 additions and 14 deletions

View file

@ -27,7 +27,8 @@ except ImportError:
raise ImportError('Please install python-imaging') raise ImportError('Please install python-imaging')
class CaptchaError(Exception): pass class CaptchaError(Exception):
pass
class Tile(object): class Tile(object):

View file

@ -74,8 +74,10 @@ class AccountHistory(BasePage):
text = tds[1].text or u'' text = tds[1].text or u''
text = text.replace(u'\xa0', u'') text = text.replace(u'\xa0', u'')
for child in tds[1].getchildren(): for child in tds[1].getchildren():
if child.text: text += child.text if child.text:
if child.tail: text += child.tail text += child.text
if child.tail:
text += child.tail
i += 1 i += 1
operation = Transaction(i) operation = Transaction(i)

View file

@ -48,7 +48,7 @@ class AccountList(BasePage):
return return
lines = tables[0].xpath(".//tbody/tr") lines = tables[0].xpath(".//tbody/tr")
for line in lines: for line in lines:
account = Account() account = Account()
tmp = line.xpath("./td//a")[0] tmp = line.xpath("./td//a")[0]
account.label = to_unicode(tmp.text) account.label = to_unicode(tmp.text)

View file

@ -35,7 +35,7 @@ class IndexPage(DLFPPage):
form = self.parser.select(self.document.getroot(), 'form#new_account_sidebar', 1) form = self.parser.select(self.document.getroot(), 'form#new_account_sidebar', 1)
for i in form.find('div').getiterator('input'): for i in form.find('div').getiterator('input'):
if i.attrib['name'] == 'authenticity_token': if i.attrib['name'] == 'authenticity_token':
return i.attrib['value'] return i.attrib['value']
class LoginPage(DLFPPage): class LoginPage(DLFPPage):

View file

@ -43,7 +43,7 @@ def parse_dt(s):
now = datetime.datetime.now() now = datetime.datetime.now()
if s is None: if s is None:
return local2utc(now) return local2utc(now)
if 'minutes ago' in s: if 'minutes ago' in s:
m = int(s.split()[0]) m = int(s.split()[0])
d = now - datetime.timedelta(minutes=m) d = now - datetime.timedelta(minutes=m)
elif u'' in s: elif u'' in s:

View file

@ -58,7 +58,7 @@ class AloesBrowser(BaseBrowser):
self.location('%s://%s/index.aspx' self.location('%s://%s/index.aspx'
% (self.PROTOCOL, self.BASEURL), % (self.PROTOCOL, self.BASEURL),
no_login=True) no_login=True)
if not self.page.login(self.username, self.password) or \ if not self.page.login(self.username, self.password) or \
not self.is_logged() or \ not self.is_logged() or \
(self.is_on_page(LoginPage) and self.page.is_error()): (self.is_on_page(LoginPage) and self.page.is_error()):
raise BrowserIncorrectPassword() raise BrowserIncorrectPassword()

View file

@ -60,7 +60,7 @@ class MasstransitHildon():
status = event.get_status() status = event.get_status()
if status == conic.STATUS_CONNECTED: if status == conic.STATUS_CONNECTED:
self.connected = True self.connected = True
if self.touch_selector_entry_filled == False: if not self.touch_selector_entry_filled:
debug("connected, now fill") debug("connected, now fill")
self.fill_touch_selector_entry() self.fill_touch_selector_entry()
if self.refresh_in_progress: if self.refresh_in_progress:

View file

@ -17,7 +17,8 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with weboob. If not, see <http://www.gnu.org/licenses/>. # along with weboob. If not, see <http://www.gnu.org/licenses/>.
import os,codecs import os
import codecs
from PyQt4.QtCore import SIGNAL, Qt, QStringList from PyQt4.QtCore import SIGNAL, Qt, QStringList
from PyQt4.QtGui import QApplication, QCompleter from PyQt4.QtGui import QApplication, QCompleter

View file

@ -325,7 +325,7 @@ class Weboob(object):
if len(_backends) > 0: if len(_backends) > 0:
try: try:
backends = [self.backend_instances[_backends]] backends = [self.backend_instances[_backends]]
except (ValueError,KeyError): except (ValueError, KeyError):
backends = [] backends = []
elif isinstance(_backends, (list, tuple, set)): elif isinstance(_backends, (list, tuple, set)):
backends = [] backends = []
@ -333,7 +333,7 @@ class Weboob(object):
if isinstance(backend, basestring): if isinstance(backend, basestring):
try: try:
backends.append(self.backend_instances[backend]) backends.append(self.backend_instances[backend])
except (ValueError,KeyError): except (ValueError, KeyError):
pass pass
else: else:
backends.append(backend) backends.append(backend)

View file

@ -112,7 +112,7 @@ class MediaPlayer(object):
media_url = media.url media_url = media.url
try: try:
player_url = media.swf_player player_url = media.swf_player
if media.swf_player: if media.swf_player:
rtmp = 'rtmpdump -r %s --swfVfy %s' % (media_url, player_url) rtmp = 'rtmpdump -r %s --swfVfy %s' % (media_url, player_url)
else: else:
rtmp = 'rtmpdump -r %s' % media_url rtmp = 'rtmpdump -r %s' % media_url
@ -123,7 +123,7 @@ class MediaPlayer(object):
rtmp += ' --quiet' rtmp += ' --quiet'
if args is None : if args is None:
for (binary, stdin_args) in PLAYERS: for (binary, stdin_args) in PLAYERS:
if binary == player_name: if binary == player_name:
args = stdin_args args = stdin_args
@ -139,7 +139,7 @@ class MediaPlayer(object):
p1 = Popen(rtmp.split(), stdout=PIPE) p1 = Popen(rtmp.split(), stdout=PIPE)
Popen(player_name + args, stdin=p1.stdout, stderr=PIPE) Popen(player_name + args, stdin=p1.stdout, stderr=PIPE)
def _find_in_path(self,path, filename): def _find_in_path(self, path, filename):
for i in path.split(':'): for i in path.split(':'):
if os.path.exists('/'.join([i, filename])): if os.path.exists('/'.join([i, filename])):
return True return True