Skip to content

Instantly share code, notes, and snippets.

@reedobrien
Created July 23, 2010 05:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reedobrien/487075 to your computer and use it in GitHub Desktop.
Save reedobrien/487075 to your computer and use it in GitHub Desktop.
BFG traversal outline
class Node(object):
def __init__(self, db, name, parent, data):
self.db = db
self.data = data or {}
self.__name__ = self.data.get('__name__', None)
self.__parent__ = self.data.get('__parent__', None)
def __getitem__(self, name):
data = self.db.find_data_where_parent_is_my_objectid_and_name_is_name()
return Node(self.db, name, self, data)
def root_factory(request):
return Node(db, None, None, None)
@reedobrien
Copy link
Author

From a paste by chrismcdonough at http://paste.ofcode.org/d9WWyxvUxSHGFDN6nPzgHp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment