Esempio n. 1
0
def getFormAttrList(form_obj):
    '''returns the data of a form. the keyword is rgen_
    it returns a dictionary with the attribute name striped of rgen_
    as the key and value of the actual data'''
    out = {}
    for a in dir(form_obj):
        if a.startswith(rstruct.rgen_keyword):
            out[a[len(rstruct.rgen_keyword):]] = form_obj.__getattribute__(
                a).data
        elif a.startswith(rstruct.rgen_selkey):
            out[a[len(rstruct.rgen_selkey):]] = form_obj.__getattribute__(
                a).data
        elif a.startswith(rstruct.rgen_timkey):
            out[a[len(rstruct.rgen_timkey):]] = form_obj.__getattribute__(
                a).data
        elif a.startswith(rstruct.rgen_typebool):
            out[a[len(rstruct.rgen_typebool
                      ):]] = True if form_obj.__getattribute__(
                          a).data == '1' else False
        elif a.startswith(rstruct.rgen_actkey):
            form_action = form_obj.__getattribute__(
                a[len(rstruct.rgen_actkey):])
            if callable(form_action):
                out.update(form_action(form_obj))
    return out
Esempio n. 2
0
def getFormAttrList(form_obj):
    '''returns the data of a form. the keyword is rgen_
	it returns a dictionary with the attribute name striped of rgen_
	as the key and value of the actual data'''
    out = {}
    for a in dir(form_obj):
        if a.startswith(rdef.rgen_keyword):
            out[a[len(rdef.rgen_keyword):]] = form_obj.__getattribute__(a).data
        elif a.startswith(rdef.rgen_selkey):
            out[a[len(rdef.rgen_selkey):]] = form_obj.__getattribute__(a).data
    return out
Esempio n. 3
0
def getAttrList(in_obj):
    '''returns a list of attributes of an object, not including
    methods and intrinsic attribute another model of this is under
    auxtools in libraries/python/pymod'''
    out = []
    for a in dir(in_obj):
        if not a.startswith('__') and not callable(getattr(in_obj, a)):
            out.append(a)
    return out
Esempio n. 4
0
def regenerateForm(in_form, target=None):
    for a in dir(in_form):  #for all form attributes
        if a.startswith(
                rdef.rgen_keyword
        ) and target != None:  #only the ones defined under rgen
            model_field = a[len(rdef.rgen_keyword):]  #FOR MODIFY ONLY
            in_form.__getattribute__(a).default = target.__getattribute__(
                model_field)
        elif a.startswith(rdef.rgen_selkey):
            model_field = a[len(rdef.rgen_selkey):]
            fkeyres = rdef.dist_resources[in_form.fKeylist[model_field][0]][
                rdef.sqlClass].query.all()
            in_form.__getattribute__(a).choices = dynamicSelectorHandler(
                fkeyres, in_form.fKeylist[model_field][1])
            if (target != None):
                in_form.__getattribute__(a).default = target.__getattribute__(
                    model_field)
    return in_form
Esempio n. 5
0
def regenerateForm(lkup, in_form, target=None):
    for a in dir(in_form):  #for all form attributes
        if a.startswith(
                rstruct.rgen_keyword
        ) and target != None:  #only the ones defined under rgen
            model_field = a[len(rstruct.rgen_keyword):]  #FOR MODIFY ONLY
            in_form.__getattribute__(a).default = target.__getattribute__(
                model_field)
        elif a.startswith(rstruct.rgen_selkey):
            model_field = a[len(rstruct.rgen_selkey):]  #GETS THE MODEL FIELD
            fkeyres = lkup[in_form.fKeylist[model_field][0]].model.query.all()
            in_form.__getattribute__(a).choices = dynamicSelectorHandler(
                fkeyres, in_form.fKeylist[model_field][1])
            if (target != None):
                in_form.__getattribute__(a).default = target.__getattribute__(
                    model_field)
        elif a.startswith(rstruct.rgen_actkey):
            pass
    return in_form