Exemple #1
0
    def __getattr__(self, attr):
        if not attr.startswith('check_vat_'):
            super(res_partner, self).__getattr__(attr)
        
        def default_vat_check(self, cn, vn):
            # by default, a VAT number is valid if:
            #  it starts with 2 letters
            #  has more than 3 characters
            return len(vn) > 0 and len(cn) == 2 and cn[0] in string.ascii_lowercase and cn[1] in string.ascii_lowercase

        return partial(default_vat_check, self, attr[10:])
Exemple #2
0
 def __init__(self, pool, dbname):
     self.dbname = dbname
     self._pool = pool
     self._debug = partial(netsvc.Logger().notifyChannel, 'Connection',
                           netsvc.LOG_DEBUG)
Exemple #3
0
 def __init__(self, maxconn=64):
     self._connections = []
     self._maxconn = max(maxconn, 1)
     self._lock = threading.Lock()
     self._log = partial(netsvc.Logger().notifyChannel, 'ConnectionPool')