[Twisted-web] Newov Login Forward

Tommi Virtanen tv at twistedmatrix.com
Wed Feb 23 06:03:09 MST 2005

Andy Gayton wrote:
> Otherwise your likely looking at dropping guard and always having the 
> same site tree with if statements at the nodes controlling behaviour 
> whether the user is logged in or not / type of user  ...

I wouldn't recommend _dropping_ guard, even in that case.
Twisted sandbox/tv/newlyguarded.nevow-issue59 with the following patch
is an example of using guard, but only making certain resources secret.

Index: login.py
--- login.py    (revision 12804)
+++ login.py    (working copy)
@@ -56,7 +56,7 @@
      def render_form(self, context, data):
          request = context.locate(inevow.IRequest)
          current = url.URL.fromRequest(request)
-        root = request.getComponent(inevow.ISessionRoot)
+        root = url.URL.fromString(request.getRootURL())
          action = getActionURL(current, root)
          context.fillSlots('action-url', str(action))
          return context.tag

More information about the Twisted-web mailing list