def generate_hash(self, id): if not h.auth.authorized( h.auth.Or(h.auth.is_same_zookeepr_attendee(id), h.auth.has_organiser_role, h.auth.has_unique_key())): # Raise a no_auth error h.auth.no_role() url = h.url_for(action='view', id=id) c.hash = URLHash.find_by_url(url=url) if c.hash is None: c.hash = URLHash() c.hash.url = url meta.Session.add(c.hash) meta.Session.commit() # create an entry for the payment page (not needed) # TODO: depending on how the gateway works, you may need to make sure you have permissions for the page you get redirected to #c.hash = URLHash() #c.hash.url = h.url_for(action='pay') #meta.Session.add(c.hash) #meta.Session.commit() return render('/invoice/generate_url.mako')