durusmail: quixote-users: PyWebOff problem ==> solution.
PyWebOff problem ==> solution.
2005-01-30
2005-01-30
2005-01-30
PyWebOff problem ==> solution.
Titus Brown
2005-01-30
Hi all,

I didn't see much (any?) mention of it on this list, but the
PyWebOff completed a Quixote application & Michelle Levesque
had a few problems.

One of the things she wanted to do was control access by login,
and post a login page for people who weren't logged in.  By default,
however, exceptions raised by _q_access are printed out in escaped
HTML, preventing redirects and forms.

I suggested a namespace reorganization & a try/except clause in
an app-specific Publisher class, but was curious to see if people on
this list had any better suggestions.

Here's my suggested code:
--

class MyPublisher(SessionPublisher):
    ...

    def try_publish(self, request, path):
       try:
          return SessionPublisher.try_publish(self, request, path)
       except NotLoggedIn, e:
          return "you should log in"  # or redirect, or form, or...

--

and you can read the entire thing on my advogato diary at

        http://www.advogato.org/person/titus/diary.html?start=42

cheers,
--titus

reply