Hello,
I'm using object names (they refer to SQLObjecs) in my urls.
"/objects/my_randome_object/edit/" could be a valid url.

While defining the default method in controller.py works, it bypasses
the neat cherrypy url mapping. This becomes especially cumbersome if you
deal with longer urls (that you have to map manually now) (e. g.
"/objects/my_random_object/edit/wysiwyg/).

Is somebody aware of some means to hook in again, or some other more
convenient way to achieve the above?

(the attached code resembles my current approach)

Cheers,
-- 
Soni Bergraj

class Objects:
    @turbogears.expose() 
    def default(self, *args):
        try:
            args        = list(args)
            name        = args.pop(0)
            subject     = model.Subject.byName(name) 

            method      = args.pop(0)

            if method == 'edit':
                # some custome code goes here

            elif method == '...':
                # ...

            else:
                raise cherrypy.NotFound()


        except SQLObjectNotFound:
            raise cherrypy.NotFound()

        except IndexError:
            raise cherrypy.NotFound()
    


class Root(controllers.RootController):
    objects = Objects()

    # some other methods go here ..

Reply via email to