Re: "Per-user" polymorphism -- newbie question
Mike Orr <[email protected]>
| Newsgroups | gmane.comp.web.quixote.user |
|---|---|
| Message-ID | <[email protected]> |
[email protected] wrote: >Al Pacifico wrote: > >What I'm thinking of: >I'd like to make my content served by Quixote essentially polymorphic, >determined by the role the user takes. This points me in the direction of >subclassing a base class for each role. I imagine q_lookup() would call a >method within a class determined by the client's role. > > If you need _q_lookup anyway. If you're just using it for permission checking, ._q_traverse would be more appropriate. But if the component names have to be calculated from the permissions, or there are so many names that having a separate method for each would be difficult/impossible, ._q_lookup would be appropriate. /foo/bar -- Regular method. /articles/1234 -- ._q_lookup (one catchall component, possibly returning a sub-Directory) /showdate/2005/08/11 -- ._q_traverse (several catchall components taken as a unit)