当前位置: 首页>>代码示例>>Python>>正文


Python Mapper.compile_all方法代码示例

本文整理汇总了Python中ming.orm.Mapper.compile_all方法的典型用法代码示例。如果您正苦于以下问题:Python Mapper.compile_all方法的具体用法?Python Mapper.compile_all怎么用?Python Mapper.compile_all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ming.orm.Mapper的用法示例。


在下文中一共展示了Mapper.compile_all方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setUp

# 需要导入模块: from ming.orm import Mapper [as 别名]
# 或者: from ming.orm.Mapper import compile_all [as 别名]
 def setUp(self):
     self.datastore = DS.DataStore(
         'mim:///', database='test_db')
     self.session = ORMSession(bind=self.datastore)
     class BasicMapperExtension(MapperExtension):
         def after_insert(self, instance, state):
             assert 'clean'==state.status
         def before_insert(self, instance, state):
             assert 'new'==state.status
         def before_update(self, instance, state):
             assert 'dirty'==state.status
         def after_update(self, instance, state):
             assert 'clean'==state.status
     class Basic(MappedClass):
         class __mongometa__:
             name='basic'
             session = self.session
             extensions = [BasicMapperExtension]
         _id = FieldProperty(S.ObjectId)
         a = FieldProperty(int)
         b = FieldProperty([int])
         c = FieldProperty(dict(
                 d=int, e=int))
     Mapper.compile_all()
     self.Basic = Basic
     self.session.remove(self.Basic)
开发者ID:terrasea,项目名称:ming,代码行数:28,代码来源:test_declarative.py

示例2: setUp

# 需要导入模块: from ming.orm import Mapper [as 别名]
# 或者: from ming.orm.Mapper import compile_all [as 别名]
 def setUp(self):
     self.datastore = DS.DataStore(
         'mim:///', database='test_db')
     self.session = ThreadLocalORMSession(Session(bind=self.datastore))
     class Parent(MappedClass):
         class __mongometa__:
             name='parent'
             session = self.session
         _id = FieldProperty(S.ObjectId)
     Mapper.compile_all()
     self.Parent = Parent
     self.create_app =  TestApp(MingMiddleware(self._wsgi_create_object))
     self.remove_app =  TestApp(MingMiddleware(self._wsgi_remove_object))
     self.remove_exc =  TestApp(MingMiddleware(self._wsgi_remove_object_exc))
开发者ID:terrasea,项目名称:ming,代码行数:16,代码来源:test_middleware.py

示例3: html_text

# 需要导入模块: from ming.orm import Mapper [as 别名]
# 或者: from ming.orm.Mapper import compile_all [as 别名]
    @property
    def html_text(self):
        """A markdown processed version of the page text"""
        return g.markdown_wiki.cached_convert(self, 'text')

    def authors(self):
        """All the users that have edited this page"""
        def uniq(users):
            t = {}
            for user in users:
                t[user.username] = user.id
            return t.values()
        user_ids = uniq([r.author for r in self.history().all()])
        return User.query.find({'_id': {'$in': user_ids}}).all()

    def delete(self):
        Shortlink.query.remove(dict(ref_id=self.index_id()))
        self.deleted = True
        suffix = " {:%Y-%m-%d %H:%M:%S.%f}".format(datetime.utcnow())
        self.title += suffix


class WikiAttachment(BaseAttachment):
    ArtifactType = Page

    class __mongometa__:
        polymorphic_identity = 'WikiAttachment'
    attachment_type = FieldProperty(str, if_missing='WikiAttachment')

Mapper.compile_all()
开发者ID:AsylumCorp,项目名称:incubator-allura,代码行数:32,代码来源:wiki.py


注:本文中的ming.orm.Mapper.compile_all方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。