Changeset 3873

Show
Ignore:
Timestamp:
01/14/2008 12:25:54 PM (7 months ago)
Author:
paul
Message:

I'm experimenting (with success) in getting Dabo to correctly display and accept
entry in whatever date format is set in the locale.

Uwe, specifically: does this help? My testing indicates that this will work.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/paul/dabo/settings.py

    r3632 r3873  
    11# -*- coding: utf-8 -*- 
     2import locale 
     3 
    24# Dabo Global Settings 
    35 
     
    111113checkForWebUpdates = True 
    112114 
     115dateFormat = locale.nl_langinfo(locale.D_FMT) 
     116datetimeFormat = locale.nl_langinfo(locale.D_T_FMT) 
     117 
    113118### Settings - end 
    114119 
  • branches/paul/dabo/ui/uiwx/dGrid.py

    r3867 r3873  
    334334        if bizobj: 
    335335            if field and (row < bizobj.RowCount): 
    336                 ret = bizobj.getFieldVal(field, row
     336                ret = self.getStringValue(bizobj.getFieldVal(field, row)
    337337            else: 
    338338                ret = "" 
     
    346346        return ret 
    347347 
     348    def getStringValue(self, val): 
     349        """Get the string value to display in the grid.""" 
     350        if isinstance(val, datetime.date): 
     351            return val.strftime(dabo.settings.dateFormat) 
     352        return val 
    348353 
    349354    def SetValue(self, row, col, value): 
  • branches/paul/dabo/ui/uiwx/dTextBoxMixin.py

    r3855 r3873  
    1616    numericTypes = (int, long, float) 
    1717    valueErrors = (ValueError, ) 
     18 
    1819# Make this locale-independent 
    1920decimalPoint = locale.localeconv()["decimal_point"] 
     
    514515            # Use the ISO 8601 date string format so we can convert 
    515516            # back from a known quantity later... 
    516             strVal = value.isoformat() 
     517            #strVal = value.isoformat() 
     518            strVal = value.strftime(dabo.settings.dateFormat) 
    517519        elif isinstance(value, datetime.time): 
    518520            # Use the ISO 8601 time string format