def get(self, what, userid=None): if what == 'all': cfps = Cfp.all() cfps.filter('submission_deadline >=', datetime.date.today()) cfps.order('submission_deadline').fetch(limit=200) elif what == 'submitters': authenticationRequired(users.get_current_user(), self) cfps = Cfp.all() cfps.filter('submission_deadline >=', datetime.date.today()) cfps.order('submission_deadline').fetch(limit=200) # we can't make a query with two inequality conditions # so we filter in python in the pending of model redesign cfps = filter(lambda cfp: cfp.submitters != [], cfps) elif what == 'submitter': authenticationRequired(users.get_current_user(), self) cfps = Cfp.all() cfps.filter('submission_deadline >=', datetime.date.today()) cfps.filter('submitters IN', [users.User(userid.replace('%40', '@'))]) cfps.order('submission_deadline').fetch(limit=200) else: self.response.set_status(404, 'Not Found') return template_file = os.path.join(os.path.dirname(__file__), 'templates/cfp_atom.xml') self.response.headers[ 'Content-Type'] = 'application/atom+xml; charset=utf-8' self.response.out.write( template.render(template_file, { 'APPLICATION_ID': os.environ['APPLICATION_ID'], 'cfps': cfps }))
def get(self, what, userid=None): if what == 'all': cfps = Cfp.all() cfps.filter('submission_deadline >=', datetime.date.today()) cfps.order('submission_deadline').fetch(limit=200) elif what == 'submitters': authenticationRequired(users.get_current_user(), self) cfps = Cfp.all() cfps.filter('submission_deadline >=', datetime.date.today()) cfps.order('submission_deadline').fetch(limit=200) # we can't make a query with two inequality conditions # so we filter in python in the pending of model redesign cfps = filter(lambda cfp: cfp.submitters != [], cfps) elif what == 'submitter': authenticationRequired(users.get_current_user(), self) cfps = Cfp.all() cfps.filter('submission_deadline >=', datetime.date.today()) cfps.filter('submitters IN', [users.User(userid.replace('%40','@'))]) cfps.order('submission_deadline').fetch(limit=200) else: self.response.set_status(404, 'Not Found') return template_file = os.path.join(os.path.dirname(__file__), 'templates/cfp_atom.xml') self.response.headers['Content-Type'] = 'application/atom+xml; charset=utf-8' self.response.out.write(template.render(template_file, {'APPLICATION_ID':os.environ['APPLICATION_ID'], 'cfps':cfps}))
def get(self, view=None): authenticationRequired(users.get_current_user(), self) cfps = Cfp.all() color = 'nothing' editable = True if view == 'notification': cfps.filter('notification_date >=', datetime.date.today() - datetime.timedelta(days=7)) cfps.order('notification_date').fetch(limit=200) # we can't make a query with two inequality conditions # so we filter in python in the pending of model redesign cfps = filter(lambda cfp: cfp.submitters != [], cfps) color = 'notification' elif view == 'old': cfps.filter('submission_deadline <', datetime.date.today()) cfps.order('submission_deadline') cfps = cfps.fetch(limit=800) editable = False else: cfps.filter('submission_deadline >=', datetime.date.today()) cfps.order('submission_deadline') cfps = cfps.fetch(limit=200) color = 'deadline' html = os.path.join(os.path.dirname(__file__), 'templates/minimal.html') self.response.out.write(template.render(html, {'logout_url': users.create_logout_url("/"), 'nombre':len(cfps),'cfps':cfps, 'color':color, 'editable': editable}))
def get(self, view=None): authenticationRequired(users.get_current_user(), self) cfps = Cfp.all() color = 'nothing' editable = True if view == 'notification': cfps.filter('notification_date >=', datetime.date.today() - datetime.timedelta(days=7)) cfps.order('notification_date').fetch(limit=200) # we can't make a query with two inequality conditions # so we filter in python in the pending of model redesign cfps = filter(lambda cfp: cfp.submitters != [], cfps) color = 'notification' elif view == 'old': cfps.filter('submission_deadline <', datetime.date.today()) cfps.order('submission_deadline') cfps = cfps.fetch(limit=800) editable = False else: cfps.filter('submission_deadline >=', datetime.date.today()) cfps.order('submission_deadline') cfps = cfps.fetch(limit=200) color = 'deadline' html = os.path.join(os.path.dirname(__file__), 'templates/minimal.html') self.response.out.write( template.render( html, { 'logout_url': users.create_logout_url("/"), 'nombre': len(cfps), 'cfps': cfps, 'color': color, 'editable': editable }))