* dhess@fishsoftware.com wrote on [2007-10-17 21:27:44 -0500]:
> def page(title="Default Title"):
> def decorator(content_generator):
> def full_page [html] (*args, **kwargs):
> ensure_signed_in()
> content = content_generator(*args, **kwargs)
> header(title=get_hit().get_info().get("title", title))
> content
> footer()
> return full_page
> return decorator
Got it.
Although note that the line count advantage is down to only one,
since each content generator needs to make a call to shove title
(and perhaps other info) into the Hit() info dictionary.
Another approach to locking off big chunks of your app is to do
something like:
class SomeDirectory(Directory):
def get_exports():
ensure_signed_in()
yield ('', '_q_index', None, None)
yield ('secret', 'grant_raise', 'Give a Raise', None)
yield ('fire-them', 'fire_all_staff', None, None)
Cheers
Mike