コード例 #1
0
ファイル: taskcloud.py プロジェクト: jourdain/ec2_cloud
    def load(self, id, level=AccessType.ADMIN, user=None, objectId=True,
             force=False, fields=None, exc=False):
        """
        We override load in order to ensure the task has certain fields
        within it, and if not, we add them lazily at read time.

        :param id: The id of the resource.
        :type id: string or ObjectId
        :param user: The user to check access against.
        :type user: dict or None
        :param level: The required access type for the object.
        :type level: AccessType
        :param force: If you explicity want to circumvent access
                      checking on this resource, set this to True.
        :type force: bool
        """
        print "try to load ", id
        doc = AccessControlledModel.load(
            self, id=id, objectId=objectId, level=level, fields=fields,
            exc=exc, force=force, user=user)

        print 'got'
        print doc

        if doc is not None and 'baseParentType' not in doc:
            pathFromRoot = self.parentsToRoot(doc, user=user, force=force)
            baseParent = pathFromRoot[0]
            doc['baseParentId'] = baseParent['object']['_id']
            doc['baseParentType'] = baseParent['type']
            self.save(doc)
        if doc is not None and 'lowerName' not in doc:
            self.save(doc)

        return doc
コード例 #2
0
ファイル: job.py プロジェクト: salamb/girder
    def load(self, *args, **kwargs):
        """
        We extend load to deserialize the kwargs back into a dict since we
        serialized them on the way into the database.
        """
        job = AccessControlledModel.load(self, *args, **kwargs)

        if job and isinstance(job['kwargs'], six.string_types):
            job['kwargs'] = json_util.loads(job['kwargs'])

        return job
コード例 #3
0
ファイル: job.py プロジェクト: 0x414A/girder
    def load(self, *args, **kwargs):
        """
        We extend load to deserialize the kwargs back into a dict since we
        serialized them on the way into the database.
        """
        job = AccessControlledModel.load(self, *args, **kwargs)

        if job and isinstance(job['kwargs'], six.string_types):
            job['kwargs'] = json_util.loads(job['kwargs'])

        return job