本文整理汇总了Python中MVC.MVC.loadModel方法的典型用法代码示例。如果您正苦于以下问题:Python MVC.loadModel方法的具体用法?Python MVC.loadModel怎么用?Python MVC.loadModel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MVC.MVC
的用法示例。
在下文中一共展示了MVC.loadModel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: index
# 需要导入模块: from MVC import MVC [as 别名]
# 或者: from MVC.MVC import loadModel [as 别名]
def index( self ):
ModelArticles = MVC.loadModel('Articles')
ModelArticlesSources = MVC.loadModel('ArticlesSources')
data = {
'articles' : ModelArticles.getAll(),
'sources' : ModelArticlesSources.getAll()
}
return self.Renderer.build( 'admin/articles/index.html', data )
示例2: getLoadLevel
# 需要导入模块: from MVC import MVC [as 别名]
# 或者: from MVC.MVC import loadModel [as 别名]
def getLoadLevel( self, article, hide = True, load_level = 'light' ):
if load_level == 'full':
ModelArticlesSources = MVC.loadModel('ArticlesSources')
article['source'] = ModelArticlesSources.getByID( article['source_id'] )
article['meta'] = self.getMeta( article['id'] )
if article['meta']:
if 'assoc_company' in article['meta']:
ModelCompany = MVC.loadModel('Company')
article['meta']['companies'] = []
for c_id in article['meta']['assoc_company']['value']:
article['meta']['companies'].append( ModelCompany.getByID( c_id, hide ) )
return article
示例3: info
# 需要导入模块: from MVC import MVC [as 别名]
# 或者: from MVC.MVC import loadModel [as 别名]
def info( self, company_id = None ):
if company_id:
ModelCompany = MVC.loadModel('Company')
# ModelCompanyNews = MVC.loadModel('CompanyNews')
company = ModelCompany.getByID( company_id, 'full', hide = False )
if not company:
raise cherrypy.HTTPRedirect( '/admin/error/?e="cantfindcompany"' )
ModelArticles = MVC.loadModel('Articles')
data = {
'company' : company,
'articles' : ModelArticles.getByCompany( company_id )
}
return self.Renderer.build( 'admin/companies/info.html', data )
else:
raise cherrypy.HTTPRedirect( '/admin/error/?e="cantfindcompany"' )
示例4: index
# 需要导入模块: from MVC import MVC [as 别名]
# 或者: from MVC.MVC import loadModel [as 别名]
def index( self ):
"""
Main home page.
"""
Company = MVC.loadModel( 'Company' )
SimpleStats = MVC.loadModel( 'SimpleStats' )
data = {
'random_company' : Company.getRandom(),
'stats' : {
'company_count' : SimpleStats.countOfCompanies(),
'people_count' : SimpleStats.countOfPeople(),
'article_count' : SimpleStats.countOfArticles(),
'sources_count' : SimpleStats.countOfArticlesSources()
}
}
return self.Renderer.build( 'frontend/index.html', data )
示例5: people
# 需要导入模块: from MVC import MVC [as 别名]
# 或者: from MVC.MVC import loadModel [as 别名]
def people( self ):
"""
Roster page of people
"""
PeopleModel = MVC.loadModel('People')
data = { 'people' : PeopleModel.getAll() }
return self.Renderer.build( 'frontend/people.html' )
示例6: dashboard
# 需要导入模块: from MVC import MVC [as 别名]
# 或者: from MVC.MVC import loadModel [as 别名]
def dashboard( self ):
Weather = MVC.loadModel('Weather')
tpl_args = {
'weather_indoor' : Weather.get_current()
}
view = env.get_template('index.html')
return view.render( d = tpl_args )
示例7: chart_humidity
# 需要导入模块: from MVC import MVC [as 别名]
# 或者: from MVC.MVC import loadModel [as 别名]
def chart_humidity( self ):
Weather = MVC.loadModel('Weather')
tpl_args = {
'weather_stats' : Weather.get_stats( )
}
view = env.get_template('weather/chart-humidity.html')
return view.render( d = tpl_args )
示例8: chart_water_temp
# 需要导入模块: from MVC import MVC [as 别名]
# 或者: from MVC.MVC import loadModel [as 别名]
def chart_water_temp( self ):
WaterModel = MVC.loadModel('Water')
tpl_args = {
'water_stats' : WaterModel.get_stats( )
}
view = env.get_template('water/chart-temp.html')
return view.render( d = tpl_args )
示例9: meta_create
# 需要导入模块: from MVC import MVC [as 别名]
# 或者: from MVC.MVC import loadModel [as 别名]
def meta_create( self, **kwargs ):
if kwargs:
User = MVC.loadModel('User')
help_text = ''
parent = ''
User.addMeta( kwargs['user_id'], kwargs['meta_key'], kwargs['meta_value'], kwargs['pretty_name'], help_text, parent )
raise cherrypy.HTTPRedirect( '/admin/user/info/%s' % kwargs['user_id'] )
示例10: lighting
# 需要导入模块: from MVC import MVC [as 别名]
# 或者: from MVC.MVC import loadModel [as 别名]
def lighting( status ):
global verbose
Devices = MVC.loadModel('Devices')
Devices.lighting( status )
if verbose:
print 'Lights have been turned %s' % status
sys.exit()
示例11: getLoadLevel
# 需要导入模块: from MVC import MVC [as 别名]
# 或者: from MVC.MVC import loadModel [as 别名]
def getLoadLevel( self, person, load_level = 'light' ):
if load_level == 'full':
person['meta'] = self.getMeta( person['id'] )
if person['meta']:
if 'people' in person['meta']:
ModelPeople = MVC.loadModel('People')
people = []
return person
示例12: prowl_alerts
# 需要导入模块: from MVC import MVC [as 别名]
# 或者: from MVC.MVC import loadModel [as 别名]
def prowl_alerts( self, message ):
UserModel = MVC.loadModel( 'User' )
users = UserModel.getUsersWithMeta( 'prowl-apikey' )
Prowl = MVC.loadDriver('Prowl')
for user in users:
Prowl.send( user['meta']['prowl-apikey'], message[0], message[1], 1 )
# End File: models/ModelAlert.py
示例13: weather
# 需要导入模块: from MVC import MVC [as 别名]
# 或者: from MVC.MVC import loadModel [as 别名]
def weather( self ):
Weather = MVC.loadModel('Weather')
tpl_args = {
'weather_current' : Weather.get_current(),
'weather_min_max' : Weather.get_min_max(),
}
view = env.get_template('weather/index.html')
return view.render( d = tpl_args )
示例14: meta_delete
# 需要导入模块: from MVC import MVC [as 别名]
# 或者: from MVC.MVC import loadModel [as 别名]
def meta_delete( self, user_id, metaID_or_key = False ):
if metaID_or_key:
UserModel = MVC.loadModel( 'User' )
if metaID_or_key.isdigit():
meta_id = metaID_or_key
else:
meta_key = metaID_or_key
# @todo: build a way to delete by meta_key
raise cherrypy.HTTPRedirect( '/admin/user/info/%s' % kwargs['user_id'] )
示例15: companies
# 需要导入模块: from MVC import MVC [as 别名]
# 或者: from MVC.MVC import loadModel [as 别名]
def companies( self ):
"""
List of all companies.
"""
Compaines = MVC.loadModel( 'Companies' )
data = {
'companies' : Compaines.getAll( False )
}
return self.Renderer.build( 'frontend/companies.html', data )