From 13b61f0559247f578cb22834d79806267e87f7fa Mon Sep 17 00:00:00 2001 From: Bezleputh Date: Thu, 27 Mar 2014 17:29:13 +0100 Subject: [PATCH] [biplan] code optimisation --- modules/biplan/pages.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/modules/biplan/pages.py b/modules/biplan/pages.py index 18d417d4..0cd0c931 100644 --- a/modules/biplan/pages.py +++ b/modules/biplan/pages.py @@ -88,9 +88,7 @@ class ProgramPage(HTMLPage): klass = BiplanCalendarEventConcert if Env('is_concert') else BiplanCalendarEventTheatre def condition(self): - if(self.el.xpath('./div')): - return True - return False + return (self.el.xpath('./div')) def validate(self, obj): return (self.is_valid_event(obj, self.env['city'], self.env['categories']) and @@ -136,7 +134,7 @@ class EventPage(HTMLPage): event.description = CleanHTML("%s/div/div[@class='presentation-popup']" % _div)(self) raise SkipItem() - self.env['is_concert'] = not div.attrib['class'] == 'theatre-popup' + self.env['is_concert'] = (div.attrib['class'] != 'theatre-popup') self.env['url'] = self.page.url obj_id = Env('_id')