Am 19.03.2010 um 15:51 schrieb John Lorance:
Thanks Diez. After a re-read of this thread, I am understanding
this more clearlt... just a weird situation to understand.
Additionally, if I look at the sample code:
class BlogController(BaseController):
@expose()
def _lookup(self, year, month, day, id, *remainder):
dt = date(int(year), int(month), int(day))
blog_entry = BlogEntryController(dt, int(id))
return blog_entry, remainder
class BlogEntryController(object):
def __init__(self, dt, id):
self.entry = model.BlogEntry.get_by(date=dt, id=id)
@expose(...)
def index(self):
...
@expose(...)
def edit(self):
...
@expose()
def update(self):
There is an implication that BlogEntryController gets its own
instantiation on a per-request basis; but BlogController is only
instantiated once; unless I'm totally reading this wrong in the
doc. Sorry I seem a little dense here; just trying not to make a
fatal mistake.
That's a different thing, yes. Maybe I was the dense here - but the OP
asked (IMHO) for the "normal" controller hierarchy & it's objects,
which (with the exception of the root) aren't instantiated after
initial load. Simply because they are *class*-attirbutes.
The above is a specialized thing: through _lookup, you do in fact
instantiate subobjects per request, but these aren't part of the
controller hierarchy, they just exist to dispatch further until there
is no path-components. But that's for something like REST.
Diez
--
You received this message because you are subscribed to the Google Groups
"TurboGears" 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/turbogears?hl=en.