iro/validate.py
branchdevel
changeset 109 935b5fcaf152
parent 106 d2992f011930
child 110 601fc908d9f1
equal deleted inserted replaced
108:cadc01b2bdc0 109:935b5fcaf152
    12     '''validate decorator
    12     '''validate decorator
    13     use it like this:
    13     use it like this:
    14         @validate(userhash=vuserhash)
    14         @validate(userhash=vuserhash)
    15         f(userhash)
    15         f(userhash)
    16     that will validate usrhah with the function vuserhash.
    16     that will validate usrhah with the function vuserhash.
    17     Every validate function should raise an Exception, if the the value is not valide'''
    17     Every validate function should raise an Exception, if the the value is not valid'''
    18     def v(f):
    18     def v(f):
    19         def new_f(*a,**k):
    19         def new_f(*a,**k):
    20             kp=getcallargs(f,*a,**k)
    20             kp=getcallargs(f,*a,**k)
    21             for i in kargs:
    21             for i in kargs:
    22                 kargs[i](kp[i])
    22                 kargs[i](kp[i])