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.
On Fri, Mar 19, 2010 at 2:06 AM, Diez B. Roggisch <[email protected]> wrote:
>
> Am 18.03.2010 um 18:53 schrieb John Lorance:
>
>
> Diez,
>> Just so that I am reading you (and this thread) clearly here about
>> controller instantiation... all controller classes are instantiated as
>> objects on a per request basis.. yes?
>>
>
> No.
>
>
>
> Therefore, if I have a sub
>> controller with an __init__ that does some work needed, common to all
>> my controller class methods, it can assign local (self) attributes in
>> a thread/request safe way, yes?
>>
>
> No.
>
> The only controller that currently gets instantiated on a per-request-base
> is the root-controller. And I don't read anything else from the
> _lookup/_default docs either.
>
> HTH,
>
>
> 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]<turbogears%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/turbogears?hl=en.
>
>
--
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.