my second shot smaller code.... i omitted the 3rd function "init" as in the first shot...
class Group1_disabled: def f1(self): print "f1 disabled" def f2(self): print "f2 disabled" class Group1_visible: def f1(self): print "f1 visible" def f2(self): print "f2 visible" class Load_fields(object): def __init__(self,fields): self.fields=fields MyGroup1=Load_fields([Load_visible(),Load_disabled()]) Results in smaller code but still not very clever is it??? Regards 2017-10-27 16:48 GMT+01:00 António Ramos <ramstei...@gmail.com>: > This is my best shot... > It works but as it can have for example 30 groups of fields it may not be > the simplest/smartest code > > class Group1_fields(object): > def __init__(self, fields): > print "calling init" > self.fields = fields > > class f1(object): > def __init__(self, visible,disabled) : > print "calling f1" > self.visible=oc_visible > self.disabled=oc_disabled > > class f1_visible(object): > def __init__(self): > print "calling f1 visible" > > class f1_disabled(object): > def __init__(self): > print "calling f1 disabled" > > class f2(object): > def __init__(self, visible,disabled) : > print "calling f2" > self.visible=oc_visible > self.disabled=oc_disabled > > class f2_visible(object): > def __init__(self): > print "calling f2 visible" > > class f2_disabled(object): > def __init__(self): > print "calling f2 disabled" > > > MyGroup1=Group1_fields([ > f1(f1_visible(),f1_disabled()), > f2(f2_visible(),f2_disabled()) > ] > ) > > 2017-10-27 16:06 GMT+01:00 António Ramos <ramstei...@gmail.com>: > >> Hello i'm blocked so i need your opinion >> >> I have many groups of Objects. >> Each group has some fields. >> Each field has 3 functions: visible,init and disabled. >> >> >> I'm coding something like >> >> main.py >> from all_fields import * >> >> >> all_fields.py >> >> Class Load_fields: >> def f1(): >> this field should have inside 3 functions like explained above >> def f2(): >> etc.. >> >> Class Another_group: >> def f3(): >> this field should have inside 3 functions like explained above >> >> >> I know i´m doing something wrong but can "unlock" my mind... >> I need 3 functions inside each fx function but this is not the way... >> >> Any ideas? >> >> Regards >> >> >> >> > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.