cool. I never thought about this. You can make it much simpler:

def users():
    def index():
        return dict(message="List users")
    def new():
        return dict(message="Add new user")
    def edit():
        return dict(message="Edit an existing user")
    return locals().get(request.args(0),'not defined')

On Feb 18, 12:47 pm, Ross Peoples <ross.peop...@gmail.com> wrote:
> I am trying to make an 'admin' controller that will allow
> administrators of the app to administer different parts of the app.
> One of the things to administer will be listing, adding, and removing
> of users. So, ideally, I would like my URL structure to be like this:
> "/[app]/admin/users/index". I have found a way to make it work, but I
> was wondering if there is a better way. This is my admin.py controller
> so far:
>
> def index():
>     return dict(message="This will eventually return a window allowing
> you to select different administrative options.")
>
> def users():
>     def index():
>         return dict(message="List users")
>
>     def new():
>         return dict(message="Add new user")
>
>     def edit():
>         return dict(message="Edit an existing user")
>
>     if request.args(0):
>         action = request.args(0)
>         if action == 'new':
>             return new()
>         elif action == 'edit':
>             return edit()
>         else:
>             return index()
>     else:
>         return index()
>
> So am I going about this the right way, or am I totally off base?
> Thanks.

Reply via email to