I think you want:

def is_in_conference(f):
     if not session.current_conference:
         redirect(URL('default', 'index'))
     return f

@is_in_conference()
def index():
     """
     INFO: This page takes all the various things of the conference
on
to one page.
     """
     return dict()

On Apr 3, 1:20 pm, Jason Brower <[email protected]> wrote:
> I am making my first decorator and I want to make sure I do it right...
> def is_in_conference():
>      if not session.current_conference:
>          redirect(URL('default', 'index'))
>
> @is_in_conference()
> def index():
>      """
>      INFO: This page takes all the various things of the conference on
> to one page.
>      """
>      return dict()
>
> Is this correct?
> Also can I use two docorators?

yes but mind that the order does matter.

> For example:
>
> @is_in_conference()
> @auth.is_logged_in()
> def index():
>      """
>      INFO: This page takes all the various things of the conference on
> to one page.
>      """
>      return dict()
> Best Regards,
> Jason

Reply via email to