本文整理汇总了Python中odict.OrderedDict.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python OrderedDict.__init__方法的具体用法?Python OrderedDict.__init__怎么用?Python OrderedDict.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类odict.OrderedDict
的用法示例。
在下文中一共展示了OrderedDict.__init__方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from odict import OrderedDict [as 别名]
# 或者: from odict.OrderedDict import __init__ [as 别名]
def __init__(self, method='POST', action='', submitLabel='Submit', attrs=None):
'''Initialize a new, empty form instance.
@param method: the form method attribute (i.e. "GET" or "POST")
@type method: str
@param action: the form action attribute. This will often be the empty
@type action: str
string ("self-submission"), for simplified validation and error message display.
@param submitLabel: the text of the final submit button.
@type submitLabel: str
@param attrs: a dictionary of attribute names and values for the form
element (i.e. the "class" or "id" attributes). The I{method} and
I{action} attributes can be set here, or through their parameters (which
are provided simply as a convenience; if set on both, the values here
take precedence.
@type attrs: dict
'''
OrderedDict.__init__(self)
self.schema = schema.Schema()
self.schema.fields = self
self.attrs = {'method':method, 'action':action}
if attrs:
self.attrs.update(attrs)
self.submitLabel = submitLabel