Does anyone know whether it's possible to access a decorator's attributes 
inside the decorated method?

My problem:

I have blogs and the blogs can have comments. The blogs are the collection 
used in the pagination decorator., i.e.

@paginate("blogs", items_per_page=3)
def blogs(self):
  return dict(blogs=fetchblogsfromdatabase())

What I want to do is grab the blog comments only for the blogs currently 
displayed on the paginated page. Aka:

@paginate("blogs", items_per_page=3)
def blogs(self):
  blogs=fetchblogsfromdatabase()
  comments=dict()
  for x in blogs[on_current_page]:
      comments[x.id]=grab_comments_for_x.id_blog()
  return dict(blogs=blogs, comments=comments)

Obviously the decorator grabs the "blogs" collection after the controller 
returns to hand the resulting subset to the templating engine.

Is there a hook I could use to inject the comments between decorating and 
rendering?

Well, the other method would probably be an ajax call after rendering without 
the comments to grab the comments and inject them into the page.

Any bright ideas on how to accomplish this? Ideally I'd like to access the 
"paginate.items" attribute inside the controller method - but at that time the 
decorator doesn't even know anything about the items to be rendered yet...

Thanks for any helpful hints anyone here might have.

Uwe

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/turbogears.
For more options, visit https://groups.google.com/d/optout.

Reply via email to