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


Python Location.find方法代码示例

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


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

示例1: main

# 需要导入模块: from indico.modules.rb.models.locations import Location [as 别名]
# 或者: from indico.modules.rb.models.locations.Location import find [as 别名]
def main(main_uri, rb_uri, sqla_uri, photo_path, drop, merged_avatars):
    update_session_options(db)  # get rid of the zope transaction extension
    main_root, rb_root, app = setup(main_uri, rb_uri, sqla_uri)
    global tz
    try:
        tz = pytz.timezone(main_root['MaKaCInfo']['main'].getTimezone())
    except KeyError:
        tz = pytz.utc

    start = time.clock()
    with app.app_context():
        if drop:
            print cformat('%{yellow!}*** DANGER')
            print cformat('%{yellow!}***%{reset} '
                          '%{red!}ALL DATA%{reset} in your database %{yellow!}{!r}%{reset} will be '
                          '%{red!}PERMANENTLY ERASED%{reset}!').format(db.engine.url)
            if raw_input(cformat('%{yellow!}***%{reset} To confirm this, enter %{yellow!}YES%{reset}: ')) != 'YES':
                print 'Aborting'
                sys.exit(1)
            delete_all_tables(db)
        stamp()
        db.create_all()
        if Location.find().count():
            # Usually there's no good reason to migrate with data in the DB. However, during development one might
            # comment out some migration tasks and run the migration anyway.
            print cformat('%{yellow!}*** WARNING')
            print cformat('%{yellow!}***%{reset} Your database is not empty, migration will most likely fail!')
            if raw_input(cformat('%{yellow!}***%{reset} To confirm this, enter %{yellow!}YES%{reset}: ')) != 'YES':
                print 'Aborting'
                sys.exit(1)
        migrate(main_root, rb_root, photo_path, merged_avatars)
    print 'migration took {} seconds'.format((time.clock() - start))
开发者ID:pferreir,项目名称:indico-backup,代码行数:34,代码来源:migrate_to_sqlalchemy.py

示例2: _process

# 需要导入模块: from indico.modules.rb.models.locations import Location [as 别名]
# 或者: from indico.modules.rb.models.locations.Location import find [as 别名]
 def _process(self):
     is_default = Location.find().count() == 0
     db.session.add(Location(name=self._locationName, is_default=is_default))
     flash(_(u'Location added'), 'success')
     self._redirect(urlHandlers.UHRoomBookingAdmin.getURL())
开发者ID:NIIF,项目名称:indico,代码行数:7,代码来源:locations.py

示例3: has_data

# 需要导入模块: from indico.modules.rb.models.locations import Location [as 别名]
# 或者: from indico.modules.rb.models.locations.Location import find [as 别名]
 def has_data(self):
     return bool(Location.find().count())
开发者ID:jacquesd,项目名称:indico,代码行数:4,代码来源:roombooking.py

示例4: _process

# 需要导入模块: from indico.modules.rb.models.locations import Location [as 别名]
# 或者: from indico.modules.rb.models.locations.Location import find [as 别名]
 def _process(self):
     is_default = Location.find().count() == 0
     db.session.add(Location(name=self._locationName, is_default=is_default))
     flash(_(u'Location added'), 'success')
     return redirect(url_for('rooms_admin.roomBooking-admin'))
开发者ID:bkolobara,项目名称:indico,代码行数:7,代码来源:locations.py


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