예제 #1
0
def getXmlTypeSaveValue(v, attrs):
    # Strip.
    if isinstance(v, str):
        while len(v) > 0 and v[0] <= ' ':
            v = v[1:]
        while len(v) > 0 and v[-1] <= ' ':
            v = v[:-1]
    # Type.
    t = attrs.get('type', '?')
    if t == 'float':
        v = float(v)
    elif t == 'int':
        if v == 'False':
            v = 0
        elif v == 'True':
            v = 1
        else:
            v = int(v)
    elif t == 'datetime':
        new = standard.parseLangFmtDate(v)
        if new is not None:
            v = new
    # Return value.
    return v
예제 #2
0
 def parseLangFmtDate(self, s, lang=None, fmt_str=None, recflag=None):
     warn(self, 'parseLangFmtDate',
          'Products.zms.standard.parseLangFmtDate')
     return standard.parseLangFmtDate(s)