本文整理汇总了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))
示例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())
示例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())
示例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'))