Guest User

Untitled

a guest
Jan 12th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. def tabs(self):
  2. url = IURL(self.context, self.request)
  3. list=[(u"delete",u"Delete",IDeletable),
  4. (u"display",u"Display",IDisplayable),
  5. #(u"rename",u"Rename",IRenameable),
  6. (u"edit",u"Edit",IEditable),
  7. (u"addContainer",u"Add Container",IAddContainer)
  8. ]
  9. for id, name, anInterface in :
  10. if not anInterface.providedBy(self.context):
  11. continue
  12. import pdb; pdb.set_trace()
  13. yield {
  14. 'active': (getattr
  15. (self.view,'cromlech.context').providedBy(self.context)
  16. is anInterface),
  17. 'title': title.get(view) or id,
  18. 'url': '%s/%s' % (url, id),
  19. }
  20.  
  21.  
  22. for id, view in self._tabs:
  23.  
  24. #Basically if the views are for Ileaves
  25. #And the context is ILeaf,
  26. #or vice versa display them.
  27. #Really this should be
  28. #if not (( getattr(view,'cromlech.context')==ITreeLeaf) ==
  29. # (ILeaf.providedBy(self.context))):
  30.  
  31. if not getattr(view,'cromlech.context').providedBy(self.context):
  32. continue
  33.  
  34. yield {
  35. 'active': self.view.__class__ is view,
  36. 'title': title.get(view) or id,
  37. 'url': '%s/%s' % (url, id),
  38. }
Advertisement
Add Comment
Please, Sign In to add comment