On Sat, Aug 15, 2009 at 4:08 PM, mickgardner<[email protected]> wrote:
>
> Hi all,
>
> I was about to start a new project, and a feature i want to implement
> has me scratching my head on how to do it.
>
> I'd like to implement the ability of website users to write content,
> and then define, using form fields (not config/routes.py) the url
> location of that content.
>
> In Drupal (php cms) there is a feature like this that i'd like to
> somewhat replicate, if not in a simple way.
>
> Does anyone have any pointers as to whether this is a routes /
> middleware solution or perhaps a combination of the two?
You can capture all URLs, or all URLs under a prefix, and direct them
to a single controller action.
map.connect("/{path_info:.*}", ...) I think is the syntax. The action
can look up the remainder of the URL in a database and deliver the
content. You'd put this last in your routing rules so that your more
specific routes for the modify form would have priority.
Or you could could actually create the user files in the public
directory, and then you wouldn't have to do anything special to serve
them. But there may be security/design issues with modifying the
public directory, since it's part of the application. You could add a
second static application in middleware.py to keep the
application-static files separate from the user-static files. Of
course you'd forbid the user from overriding system URLs like the
modify form and login pages. Or change the order of the cascade
applications so that dynamic actions have priority over static files.
If you can give each user a prefix, then every user would have full
control over their URLs without interfering with other users or system
URLs.
map.connect("/users/{user}/{path_info:.*}", ...)
--
Mike Orr <[email protected]>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---