/[papo]/papo/forms/cuit.py
ViewVC logotype

Diff of /papo/forms/cuit.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by styxman, Fri Feb 7 21:04:13 2003 UTC revision 1.3 by styxman, Mon Mar 10 21:18:47 2003 UTC
# Line 1  Line 1 
1  """  """
2    algoritmo de validacion del CUIL/CUIT    algoritmo de validacion del CUIL/CUIT
3  """  """
4  import re  from re import sub
5    
6    def normalize (cuit):
7      # this should be replaced w/ a input mask
8      cuit= sub ('-', '', cuit)
9      return (cuit)
10    
11  def validate (cuit):  def validate (cuit):
12      """
13        validates the cuit. the cuit should be normalized.
14      """
15    # puede venir con o sin 'dashes'    # puede venir con o sin 'dashes'
16    if not cuit or cuit=='':    if not cuit or cuit=='':
17      return 1      return 1
   matcher= re.compile ('(\d\d)\-(\d\d\d\d\d\d\d\d)\-(\d)')  
   matches= matcher.match (cuit)  
   if matches:  
     cuit= "%s%s%s" % (matches.group (1), matches.group (2), matches.group (3))  
18    
   # once unified, validate  
19    magic= '5432765432'    magic= '5432765432'
20    # first 10 digits    # first 10 digits
21    data= cuit[:10]    data= cuit[:10]

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26