Ignore:
Timestamp:
22 Feb 2010, 11:18:29 (15 years ago)
Author:
Henrik Bettermann
Message:

enable reimport of empty date fields

File:
1 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/patches/PatchExtendedWidgetsCPSDateTimeWidget.py

    r5027 r5030  
    1313    if self.view_format == 'import':
    1414        #import pdb;pdb.set_trace()
    15         if datastructure[widget_id] == 'None':
    16             datastructure[widget_id] == ''
    17         try:
    18             dt = datastructure[widget_id].strip()
    19             date,time,dummy = dt.split()
    20             y,m,d = date.split('/')
    21             hour,minute,second = time.split(':')
    22         except:
    23             datastructure.setError(widget_id, 'cpsschemas_err_date')
    24             return 0
     15        if datastructure[widget_id] == 'None' or datastructure[widget_id] == '':
     16            date = None
     17        else:
     18            try:
     19                dt = datastructure[widget_id].strip()
     20                date,time,dummy = dt.split()
     21                y,m,d = date.split('/')
     22                hour,minute,second = time.split(':')
     23            except:
     24                datastructure.setError(widget_id, 'cpsschemas_err_date')
     25                return 0
    2526        if not (date):
    2627            if self.is_required:
Note: See TracChangeset for help on using the changeset viewer.