daily pastebin goal
61%
SHARE
TWEET

Untitled

a guest Aug 10th, 2018 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import grok
  2.  
  3. class Traver(grok.Application, grok.Container):
  4.     pass
  5.  
  6. class Index(grok.View):
  7.     foo = "baz"
  8.  
  9.     @grok.traversable
  10.     def getfoo(self):
  11.         return self.foo
  12.  
  13. #from zope.traversing.adapters import Traverser
  14. from grok.components import Traverser
  15. from grokcore.view import interfaces
  16. from zope.publisher.interfaces.http import IHTTPRequest
  17. from zope.traversing.interfaces import ITraversable
  18. from zope.publisher.interfaces.browser import IBrowserRequest
  19.  
  20.  
  21. class VIEWTraverser(grok.MultiAdapter):
  22.     grok.adapts(grok.View, IBrowserRequest)
  23.     grok.provides(ITraversable)
  24.  
  25.     def init(self, view, request):
  26.         self.view = view
  27.         self.request = request
  28.  
  29.     def traverse(self, name, extra):
  30.         import pdb; pdb.set_trace()
  31. ~
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top