Changeset 3976

Show
Ignore:
Timestamp:
07/06/08 16:30:19 (5 months ago)
Author:
doki_pen
Message:

went back to old dateformat method to fix validation

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • datefieldplugin/0.11/datefield/filter.py

    r3974 r3976  
    88import traceback 
    99 
    10 datedict= {'y':'1996', 'm':'01', 'd': '01',} 
    11  
    1210class DateFieldModule(Component): 
    1311    """A module providing a JS date picker for custom fields.""" 
    1412     
    15     date_format = Option('datefield', 'format', default='dd/mm/yy', 
    16              doc='The format to use for dates. d - day of month (no ' + 
    17              'leading zero), dd - day of month (two digits), m - month ' + 
    18              '(no leading zero), mm - month (two digits), y - year (two ' + 
    19              'digits), yy - year (four digits), D - name of day (short), DD ' + 
    20              '- name of day (long), M - name of month (short), MM - name of ' + 
    21              'month (long) "..." - literal text \'\' - single quote, ' + 
    22              'anything else - literal text.') 
     13    date_format = Option('datefield', 'format', default='dmy', 
     14             doc='The format to use for dates. Valid values are dmy, mdy, and ymd.') 
     15    first_day = Option('datefield', 'first_day', default='0',  
     16            doc='First day of the week. 0 == Sunday.') 
    2317    date_sep = Option('datefield', 'separator', default='/', 
    24                       doc='The separator character to use for dates.') 
     18            doc='The separator character to use for dates.') 
    2519     
    2620    implements(IRequestFilter, IRequestHandler, ITemplateProvider, ITicketManipulator) 
     
    3125 
    3226    def process_request(self, req): 
    33         self.log.debug("in datefield process_request") 
    34         global datedict 
     27        format = { 'dmy': 'dd%smm%syy', 
     28                   'mdy': 'mm%sdd%syy', 
     29                   'ymd': 'yy%smm%sdd'  
     30                 }[self.date_format]%(self.date_sep, self.date_sep) 
     31 
     32        print format 
    3533        datefield = {} 
    3634        datefield['calendar'] = req.href.chrome('datefield', 'calendar.png') 
    3735        datefield['ids'] = list(self._date_fields()) 
    38         datefield['format'] = self.date_format 
     36        datefield['format'] = format 
     37        datefield['first_day'] = self.first_day 
    3938        return 'datefield.html', {'datefield': datefield},'text/javascript'  
    4039