Al Pacifico wrote:

is authorized and what he/she is authorized to do is determined by a lookup
in an external resource (for this application, an LDAP directory). The level
ok.

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
yes,

subclassing a base class for each role. I imagine q_lookup() would call a
method within a class determined by the client's role.
or just having several instances of the same class, but with different parameters?

hm, do you mean something like:

#this is totally untested and not too much thought of either..

class Content:
   """ Basic content class - also defines the interface."""
   def __init__(self, text):
        self.text = text

class PolymorphicContent:
""" Content that has many versions for e.g. different people based on roles / clearance. """
   def __init__(self, role2text):
       self.role2text = role2text

   def get_text(self):
       requester = Requester(quixote.get_request().get_user())
       return self.role2text[requester.role]
   text = property(get_text)

frontpage = PolymorphicContent({ \
   'anonymous': 'Welcome, do %s an accout' % href(register()),
   'user': 'Welcome back, %s' % user,
   'admin': 'Currently logged in are: %s' % users
}

def _q_index():
   return frontpage.text

?

each class will have a set of stylesheets that are class attributes derived
from class methods (pardon me if my OO-terminology is a bit off, but what I
mean is every instance of a given class will share the same set of
stylesheets, each a singleton). The libxml2 and libxslt modules seem to work
really well for this.
the terminology sounds sane .. if you wanna have some attribute, e.g. the stylesheet used, the same for all instances of a class, it makes sense to have it as a class attribute. and they can be derived from 'class methods' .. i guess that's static methods in python (or just functions?)

Is this problem really as trivial as it seems?
i don't get that part on xml processing really, but didn't see anything that would make this non-trivial :)

Before experimenting with my own ideas, I'd like to solicit ideas about how
others would incorporate this into a q_lookup() method?
Thanks in advance.
i didn't really think of that (the code example above is just .. trying to illustrate your question)

dunno if it might be relevant or interesting for you or anyone here, but i have a related publication draft about some old research we did on this a while ago .. really simple basic stuff, http://an.org/owla/jodi.html 'Visual specification of adaptive hypermedia' but connected to OO design too.

-al

~Toni
_______________________________________________
Quixote-users mailing list
[email protected]
http://mail.mems-exchange.org/mailman/listinfo/quixote-users

Reply via email to