> Although I have read (well, skimmed, in spots) your whole treatise, Hmm... I'll take that as a compliment. ;^) > Markets are fire, but writing is learning. This is nice, if a bit obscure, out of context. May I quote you on this? >> First try. Let's go straight to an object, and then to a method. > First problem is right here: you're giving Quixote the class object, > not an instance of the class. That's right. What the *heck* was I thinking? :^( > Then you want something like this: > > def __init__(self, request): > view = lambda r: self._view(r) > I'm not sure I completely understand, or like, this hack. It's not plain enough for a plain guy like me. :^) > Unless to Quixote there *is* a difference between a class object and > an instance object... Wasn't that the point of your earlier comments? > Anyway, yes, using _q_getname is a bit of a hack here, but the > alternative would be to have, say 'class Folder_implementation' and a > function like this: > > def Folder(request): > return Folder_implementation(request) > > THen you should be able to go back to using _q_exports rather than > _q_getname to create the proper instance object. This does not look all that different to me. I have nothing against _q_getname, per se. :^) > Again, it has been told to create a new Folder instance, so it does. Yes, I understood this, after the fact. > If you're certain you only want to allow single-component path > names that are positive integers, then you could initialize self.idx to > zero and use a check that and the current component for legality. It would be nice to have a way of specifying more than one parameter, but I'll take care of that when I need it. >> Well, well. Python tried to call the self object. > Uhm, you *told* it to. 'self(request, name)' Of course. :^) > Since Folder._q_getname is only called for the URL component *past* > 'Folder', I would think that the ValueError case would be an error > state. Yes, it would. > Perhaps initialize idx to an illegal value (would -1 work > here?), and make Folder._q_getname something like this: > > try: val = int(name) > except: > return an error [page]: invalid folder selector > if self.idx >= 0: > return an error: multiple selectors > self.idx = val This is definitely more complete than my version. Thanks. > And presumably you need to check for the missing selector case in view > and show. And maybe define a default behaviour, yes. > Well, this has been interesting. I'm not sure if this is yet another > way to structure a Quixote tree or if it's just a very different view > of things. Hope I've been of some help to you! *Many* thanks for your comments! They are exactly what I was looking for. :^))) And another thing... > "Anyone who says you can have a lot of widely dispersed people hack > away on a complicated piece of code and avoid total anarchy has never > managed a software project." -- Andy Tanenbaum The poor sod, I feel for him. ;^) -- "We should forget about small efficiencies, about 97% of the time. Premature optimization is the root of all evil." Donald Knuth Nicola Larosa - nico@tekNico.net