예제 #1
0
    def get(self, name, default=None):
        schema = storage.getSchema(IContentTypeSchema)

        item = schema.query(schema.Type.oid == name).first()
        if item is None:
            return default

        return IContentType(storage.getItem(item.oid))
예제 #2
0
    def getUserByLogin(self, login):
        sch = storage.getSchema(IUserInfo)

        ds = sch.query(sch.Type.login == login).first()
        if ds is not None:
            user = storage.getItem(ds.oid)
            user.id = 'memphis-%s'%user.oid
            return user
예제 #3
0
    def get(cls, principal):
        if cls.__schema__ is None:
            cls.__schema__ = storage.getSchema(IPreferences)

        rec = cls.__schema__.query(
            cls.__schema__.Type.principal == principal).first()
        if rec is None:
            item = storage.insertItem(IPreferences)
            IPreferences(item).principal = principal
        else:
            item = storage.getItem(rec.oid)

        item.id = principal
        return Preferences(item)
예제 #4
0
 def schema(self):
     return storage.getSchema(IContentTypeSchema)
예제 #5
0
    def getPrincipal(self, passcode):
        sch = storage.getSchema(IPasswordReset)

        rec = sch.query(sch.Type.passcode == passcode).first()
        if rec is not None:
            return storage.getItem(rec.oid)
예제 #6
0
 def schema(self):
     return storage.getSchema(ISchema)
예제 #7
0
 def listVersions(self):
     sch = storage.getSchema(IVersionsSchema)
     return sch.query(sch.Type.proxy == self.oid).order_by(
         sch.Type.version).all()
예제 #8
0
def storageInitializedEvent(ev):
    sch = storage.getSchema(ISchema)
    
    for item in sch.query():
        ttwschema = ISchema(storage.getItem(item.oid))
        ttwschema.installSchema()