Example #1
0
File: root.py Project: mcdonc/ptah
    def __call__(self, request=None):
        root = self._sql_get_root.first(name=self.name, type=self.tinfo.__uri__)
        if root is None:
            root = self.tinfo.create(title=self.title)
            root.__name_id__ = self.name
            root.__path__ = '/%s/'%root.__uri__
            Session.add(root)
            Session.flush()

        root.__root_path__ = self.path
        root.__parent__ = policy = self.policy(request)
        root.__default_root__ = self.default_root

        set_policy(policy)

        if request is not None:
            request.root = root
        return root
Example #2
0
File: blob.py Project: mcdonc/ptah
    def create(self, parent=None):
        blob = Blob(__parent__=parent)
        Session.add(blob)
        Session.flush()

        return blob