durusmail: qp: Re: qpy development ideas
qpy development ideas
2007-10-08
2007-10-09
Re: qpy development ideas
2007-10-10
2007-10-10
2007-10-14
2007-10-15
David K. Hess (2 parts)
2007-10-09
2007-10-09
2007-10-10
2007-10-10
2007-10-10
2007-10-10
2007-10-10
Re: qpy development ideas
Michael Watkins
2007-10-18
* 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
reply