Pass msg_level and remove duplicated checks

This makes the Study Description page render again.
Ahh -- I don't know how overriding would work (since you'd have to call the
superclass's `render` function, which would finish the request), but I
think adding a decorator is possible.

On Fri, Nov 14, 2014 at 12:07 PM, Yoshiki Vázquez Baeza <
notifications@github.com> wrote:

> In qiita_pet/handlers/study_handlers.py:
>
> >              raise HTTPError(404, "Study %s does not exist" % study_id)
> >          else:
> >              check_access(User(self.current_user), study)
> >
> > -        self.display_template(int(study_id), "")
> > +        self.display_template(study, "", 'info')
>
> Argh, didn't mean to subclass, I meant to override the method.
> … <#149afb3c3b3782e0_>
> On (Nov-14-14|11:05), adamrp wrote: > > raise HTTPError(404, "Study %s
> does not exist" % study_id) > > else: > >
> check_access(User(self.current_user), study) > > > > -
> self.display_template(int(study_id), "") > > + self.display_template(study,
> "", 'info') > > Can't subclass render, since it's not a class :) Do you
> mean create a > decorator for it? > > On Fri, Nov 14, 2014 at 12:04 PM,
> Yoshiki Vázquez Baeza < > notifications@github.com> wrote: > In
> qiita_pet/handlers/study_handlers.py: > > > raise HTTPError(404, "Study %s
> does not exist" % study_id) > > else: > >
> check_access(User(self.current_user), study) > > > > -
> self.display_template(int(study_id), "") > > + self.display_template(study,
> "", 'info') > > I was thinking about this and we could subclass render and
> add those > arguments with those defaults, and then change sitebase.html to
> no longer > check the global variables to see if those variables are
> available. Not > sure if this would work. > … <#149afb17a4a56712_> > On
> (Nov-14-14|10:58), adamrp wrote: > raise HTTPError(404, "Study %s does >
> not exist" % study_id) > else: > check_access(User(self.current_user), >
> study) > > - self.display_template(int(study_id), "") > + >
> self.display_template(study, "", 'info') Hmm -- there is no reason that >
> `level` or `message` need to be passed to the call to `render` ([see these
> > lines in sitebase]( >
> https://github.com/biocore/qiita/blob/master/qiita_pet/templates/sitebase.html#L23-L36)).
> > A better fix here would be to redefine `display_template` to have default
> > arguments for those parameters: ```python def display_template(self,
> study, > msg="", msg_level="", tab_to_display=""): ``` --- Reply to this
> email > directly or view it on GitHub: >
> https://github.com/biocore/qiita/pull/606/files#r20378125 > > — > Reply
> to this email directly or view it on GitHub > <
> https://github.com/biocore/qiita/pull/606/files#r20378538>. > --- Reply
> to this email directly or view it on GitHub:
> https://github.com/biocore/qiita/pull/606/files#r20378600
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/biocore/qiita/pull/606/files#r20378701>.
>