mirror of
https://github.com/dkmstr/openuds.git
synced 2025-01-11 05:17:55 +03:00
Merge remote-tracking branch 'origin/v3.6'
This commit is contained in:
commit
39cba62009
@ -109,8 +109,11 @@ class ContentProcessor:
|
||||
if isinstance(obj, (list, tuple, types.GeneratorType)):
|
||||
return [ContentProcessor.procesForRender(v) for v in obj]
|
||||
|
||||
if isinstance(obj, (datetime.datetime, datetime.date)):
|
||||
if isinstance(obj, (datetime.datetime,)):
|
||||
return int(time.mktime(obj.timetuple()))
|
||||
|
||||
if isinstance(obj, (datetime.date,)):
|
||||
return '{}-{:02d}-{:02d}'.format(obj.year, obj.month, obj.day)
|
||||
|
||||
if isinstance(obj, bytes):
|
||||
return obj.decode('utf-8')
|
||||
|
@ -416,6 +416,12 @@ class gui:
|
||||
"""
|
||||
self._data['value'] = value
|
||||
|
||||
def fix(self) -> None:
|
||||
"""
|
||||
Fixes the value of this field, giving the oportunity on UserInterface instantiation to modify it
|
||||
"""
|
||||
pass
|
||||
|
||||
def guiDescription(self) -> typing.Dict[str, typing.Any]:
|
||||
"""
|
||||
Returns the dictionary with the description of this item.
|
||||
@ -648,6 +654,11 @@ class gui:
|
||||
datetime.datetime.strptime(self.value, '%Y-%m-%d').timetuple()
|
||||
)
|
||||
)
|
||||
|
||||
def fix(self) -> None:
|
||||
for v in 'defvalue', 'value':
|
||||
self._data[v] = self.processValue(v, self._data[v])
|
||||
|
||||
|
||||
|
||||
class PasswordField(InputField):
|
||||
@ -1010,6 +1021,7 @@ class UserInterfaceType(type):
|
||||
for attrName, attr in namespace.items():
|
||||
if isinstance(attr, gui.InputField):
|
||||
_gui[attrName] = attr
|
||||
_gui[attrName]._data = copy.deepcopy(attr._data)
|
||||
newClassDict[attrName] = attr
|
||||
newClassDict['_base_gui'] = _gui
|
||||
return typing.cast(
|
||||
|
@ -47,7 +47,7 @@ def start_date_field(order: int) -> gui.DateField:
|
||||
order=order,
|
||||
label=_('Starting date'),
|
||||
tooltip=_('Starting date for report'),
|
||||
defvalue=datetime.date.min,
|
||||
defvalue='year_start',
|
||||
required=True,
|
||||
)
|
||||
|
||||
@ -57,7 +57,7 @@ def single_date_field(order: int) -> gui.DateField:
|
||||
order=order,
|
||||
label=_('Date'),
|
||||
tooltip=_('Date for report'),
|
||||
defvalue=datetime.date.today(),
|
||||
defvalue='today',
|
||||
required=True,
|
||||
)
|
||||
|
||||
@ -67,7 +67,7 @@ def end_date_field(order: int) -> gui.DateField:
|
||||
order=order,
|
||||
label=_('Ending date'),
|
||||
tooltip=_('ending date for report'),
|
||||
defvalue=datetime.date.max,
|
||||
defvalue='today',
|
||||
required=True,
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user