Hi,

I am trying to write a base crud controller class that does the
following:

class BaseCrudController:
    model = ""
    field_validation = {}
    template_dir = ""

    @expose(self.template_dir)
    def new(self, *args, **kwargs)
        ....

    @validate(self.field_validation, error_handler=new)
    @expose()
    def  post(self, *args, **kwargs):
        ...

My intent is to have my controllers extend this base class, set the
model, field_validation, and template locations, and am ready to go.

Unfortunately, decorators (to my understanding), are interpreted when
the function is defined.  Hence it won't have access to instance's
value.  Is there a way to pass in dynamic data or values from the sub
class?

If not, I guess I could use override_template as a workaround to
expose and set the template within the controller action.  How would I
go about validating the form within the controller action?

Thanks,
Steve

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en.

Reply via email to