本文整理匯總了Python中wtforms.utils.unset_value方法的典型用法代碼示例。如果您正苦於以下問題:Python utils.unset_value方法的具體用法?Python utils.unset_value怎麽用?Python utils.unset_value使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類wtforms.utils
的用法示例。
在下文中一共展示了utils.unset_value方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from wtforms import utils [as 別名]
# 或者: from wtforms.utils import unset_value [as 別名]
def __init__(self, label=None, validators=None, places=unset_value, rounding=None, **kwargs):
super(DecimalField, self).__init__(label, validators, **kwargs)
if self.use_locale and (places is not unset_value or rounding is not None):
raise TypeError("When using locale-aware numbers, 'places' and 'rounding' are ignored.")
if places is unset_value:
places = 2
self.places = places
self.rounding = rounding
示例2: process
# 需要導入模塊: from wtforms import utils [as 別名]
# 或者: from wtforms.utils import unset_value [as 別名]
def process(self, formdata, data=unset_value):
if data is unset_value:
try:
data = self.default()
except TypeError:
data = self.default
self._obj = data
self.object_data = data
prefix = self.name + self.separator
if isinstance(data, dict):
self.form = self.form_class(formdata=formdata, prefix=prefix, **data)
else:
self.form = self.form_class(formdata=formdata, obj=data, prefix=prefix)
示例3: _add_entry
# 需要導入模塊: from wtforms import utils [as 別名]
# 或者: from wtforms.utils import unset_value [as 別名]
def _add_entry(self, formdata=None, data=unset_value, index=None):
assert not self.max_entries or len(self.entries) < self.max_entries, \
'You cannot have more than max_entries entries in this FieldList'
if index is None:
index = self.last_index + 1
self.last_index = index
name = '%s-%d' % (self.short_name, index)
id = '%s-%d' % (self.id, index)
field = self.unbound_field.bind(form=None, name=name, prefix=self._prefix, id=id, _meta=self.meta,
translations=self._translations)
field.process(formdata, data)
self.entries.append(field)
return field
示例4: _add_entry
# 需要導入模塊: from wtforms import utils [as 別名]
# 或者: from wtforms.utils import unset_value [as 別名]
def _add_entry(self, formdata=None, data=unset_value, index=None):
assert not self.max_entries or len(self.entries) < self.max_entries, \
'You cannot have more than max_entries entries in this FieldList'
if index is None:
index = self.last_index + 1
self.last_index = index
name = '%s-%d' % (self.short_name, index)
id = '%s-%d' % (self.id, index)
field = self.unbound_field.bind(form=None, name=name, prefix=self._prefix, id=id, _meta=self.meta)
field.process(formdata, data)
self.entries.append(field)
return field
示例5: process
# 需要導入模塊: from wtforms import utils [as 別名]
# 或者: from wtforms.utils import unset_value [as 別名]
def process(self, formdata, data=unset_value):
super(DestinationField, self).process(formdata, data)
if self.destination_label is not None:
self.form.type.label.text = self.destination_label