本文整理汇总了Python中core.Core.db方法的典型用法代码示例。如果您正苦于以下问题:Python Core.db方法的具体用法?Python Core.db怎么用?Python Core.db使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core.Core
的用法示例。
在下文中一共展示了Core.db方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Document
# 需要导入模块: from core import Core [as 别名]
# 或者: from core.Core import db [as 别名]
class Document(Base):
def start(self):
self.core = Core()
self.db = self.core.db()
self.auth = self.context.auth = self.core.auth
self.session = self.core.session
self.get()
def get(self):
self.context.document = self.db.get_document(*self.request.args[:2])
def create(self):
self.before_create()
self.context.form = DocumentPage(self.context.document)
self.after_create()
def edit(self):
self.context.form = DocumentPage(self.context.document)
def delete(self):
self.db.send_to_trash(self.request.args[0], self.request.args[1])
def show(self):
self.context.form = DocumentPage(self.context.document, readonly=True)
def render(self, view=None):
viewfile = "%s.%s" % (view, self.request.extension)
return self.response.render(viewfile, self.context)
示例2: Document
# 需要导入模块: from core import Core [as 别名]
# 或者: from core.Core import db [as 别名]
class Document(Base):
def start(self):
self.core = Core()
self.db = self.core.db()
self.auth = self.context.auth = self.core.auth
self.session = self.core.session
#self.db._check_update('document', 'designer')
self.get()
def get(self):
self.context.document = self.db.get_document(*self.request.args[:2])
def create(self):
self.context.form = DocumentPage(self.context.document)
def edit(self):
self.context.form = DocumentPage(self.context.document)
def delete(self):
self.db.send_to_trash(self.request.args[0], self.request.args[1])
def show(self):
self.context.form = DocumentPage(self.context.document, readonly=True)
示例3: Editor
# 需要导入模块: from core import Core [as 别名]
# 或者: from core.Core import db [as 别名]
class Editor(object):
def __init__(self):
self.core = Core()
self.db = self.core.db()
self.document = self.db.get_document('document')
def options_composer(self, options):
widgets = []
for option in options:
widgets.append(LABEL(option.label, _class='control-label', _for=option.name, requires=option.requires))
widgets.append(INPUT(_type='text', _name=option.name, _class=option.type, _class='input-large'))
return FORM(
DIV(
*widgets,
_class='controls'
),
_class='form'
).xml()
def template_composer(self, widget):
from gluon.dal import Row
def widget_composer(self, widget):
options = self.options_composer(types[widget].options)
template = self.template_composer(widget)
return DIV(
template,
_class='control-group component',
_rel = 'popover',
_title = types[widget].label,
_trigger = 'manual',
**{
'_data-type': widget,
'_data-content': options
}
)
示例4: Designer
# 需要导入模块: from core import Core [as 别名]
# 或者: from core.Core import db [as 别名]
class Designer(Core):
def start(self):
self.core = Core()
self.db = self.core.db()
self.auth = self.core.auth