Example #1
0
 def setFds(self, fds):
     nfds = AIFds()
     for key in fds:
         func = getattr(nfds, 'set' + AIStrUtils.toUpperF(key))
         if AIUtils.isFunc(func):
             apply(func, [fds[key]])
             
     self.__fds = nfds
Example #2
0
 def setFields(self, fields):
     nflds = [] 
     if not AIUtils.isEmpty(fields) and AIUtils.isList(fields):
         for fld in fields:
             nfld = AIFld()
             for key in fld:
                 func = getattr(nfld, 'set' + AIStrUtils.toUpperF(key))
                 if AIUtils.isFunc(func):
                     apply(func, [fld[key]])
             nflds.append(nfld)
         
     self.__fields = nflds
Example #3
0
 def fromStr(self, attrs):
     obj = None
     if AIUtils.isStr(attrs):
         attrs = AIUtils.str2dict(attrs)
         obj = self
         if AIUtils.isDict(attrs):
             for key in attrs:
                 func = getattr(obj, 'set' + AIStrUtils.toUpperF(key))
                 if AIUtils.isFunc(func):
                     apply(func, [attrs[key]])
     else:
         raise Exception('input parameter type not correct!')
     
     return obj