def post(self): memcache.flush_all() db.delete(Showing.all()) db.delete(Event.all()) handler = UpdateHandler() handler.initialize(self.request, self.response) handler.post()
def shows(): # displays list of shows at /shows # TODO: replace with real venues data. # num_shows should be aggregated based on number of upcoming shows per venue. data = Showing.read_show() return render_template('pages/shows.html', shows=data)
def get(self, showingkey): showing = Showing.get(showingkey) if showing: calendar = tasks.generate_ics([showing,], showing.master_location) if calendar is not None: self.response.headers['Content-Type'] = "text/calendar" self.response.out.write(calendar.as_string()) else: self.error(404)
def get(self, showingkey): showing = Showing.get(showingkey) if showing: self.redirect( "http://www.google.com/calendar/event?action=TEMPLATE&text=%s&dates=%s/%s&location=%s&details=%s&sprop=website:http://bfical.burry.name/&sprop=name:BFiCal" % (showing.parent().name, showing.start.replace(tzinfo=GB_TZ).astimezone(pytz.utc).strftime("%Y%m%dT%H%M%SZ"), showing.end.replace(tzinfo=GB_TZ).astimezone(pytz.utc).strftime("%Y%m%dT%H%M%SZ"), '%s, BFI %s, London' % (showing.location, showing.master_location.capitalize()), showing.parent().precis, )) else: self.error(404)
def create_show_submission(): # called to create new shows in the db, upon submitting new show listing form # TODO: insert form data as a new Show record in the db, instead condition = Showing.create_show(request.form.get) if condition: flash('Show was successfully listed!') else: flash(u'You entered an invalid ID', 'error') # TODO: on unsuccessful db insert, flash an error instead. # e.g., flash('An error occurred. Show could not be listed.') # see: http://flask.pocoo.org/docs/1.0/patterns/flashing/ return render_template('pages/home.html')