def init(self, url, *args): title = url[1] page = PageData.get_by(pagename=title) if page is None: raise presentation.HTTPNotFound() self.goto(title)
def init(self, url, comp, http_method, request): comp.init(url[:1], http_method, request) step = url[1] try: step = int(step) except ValueError: raise presentation.HTTPNotFound() if (step <= 0) or (step > len(self.examples[self.selected_examples][1])): raise presentation.HTTPNotFound() self.change_step(step - 1) if len(url) > 2: self.example.init(url[2:], http_method, request)
def init(self, url, comp, http_method, request): example_name = url[0] try: example = [x[0] for x in self.examples].index(example_name) except ValueError: raise presentation.HTTPNotFound() self.change_example(example)
def init(self, url, comp, *args): # The URL received is the name of the photo photo_data = PhotoData.get_by(title=url[0]) if not photo_data: # A photo with this name doesn't exist raise presentation.HTTPNotFound() # Get the photo data and make a ``Photo`` component photo = component.Component(Photo(photo_data.id)) # Temporary change the Gallery (the ``comp``) with the photo continuation.Continuation(comp.call, photo)
def init(self, url, *args): # Retrieve the page title. The condition of this generic # method already checks that the URL is of the form: # '.../page/<page title>' title = url[1] # Check if a page with the wanted title exists page = PageData.get_by(pagename=title) if page is None: raise presentation.HTTPNotFound() # Go to the page self.goto(title)