-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

thanks iain,

as i think of it more, my problem was to put in a widget, the entire
status of a controller, like forms in the case of a crud controller.

that is inefficient indeed, hence i need an uri way to access this info,
thus to keep it in a server wide dictionary.

then, i could access state and data at
tg.url(/model_crud/table_name/edit?id=999), or restless,
tg.url(/model_crud/edit?table=table_name&id=999).

to implement that, i'd make a model_crud controller, that will load on
demand and keep tables in a dictionary, and allow accessing them like that.

thanks again for your input,

alex

iain duncan wrote:
> On Thu, 2007-27-12 at 05:36 +0200, alex bodnaru wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>>
>> hi friends,
>>
>> i have a dynamic crud controller (table name as an __init__ parameter),
>> that i wish to be part of a page, where also may be choosen the table to
>> be crud.
>>
>> could the entire crud controller (has only one template) be encapsulated
>> as a widget?
> 
> You probably could, but having made the mistake of cramming too much
> into widgets before and regretting it, I'd advise against it. Hard to
> debug, easy to make RAM-pig apps. What I did recently that worked well
> for me was to make a base class for a generic crud controller, and it
> included generic view & edit widgets. Then it was easy to either
> override the associated widget, or inherit from it, or only override the
> template, but the whole underlying architecture was not tied to widgets.
> 
> I included a list of widget fields in the model, allowing the generic
> controller to build the widgets by having a model class passed in. Brief
> example
> 
> class Thing(object):
>   _edit_fields = [ widget field list ]
>   _list_fields = [ widget field list ]
> 
> Then the crud controller could do this
> 
> thing_controller = CrudController( Model=Thing, etc etc )
> 
> and it was able to make widgets in it's contstructor:
> 
> self.edit_widget = CrudEditWidget( fields=self.Model._edit_fields )
> 
> etc
> 
> If you are interested, I can post code, but it needs clean up. Works
> though!
> 
> Iain
> 
> 
> 
> > 
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQCVAwUBR3NUatpwN1sq38njAQIxiQP+IMHFbYS56zvl2FOWz/68tfLlJql4wq9l
NHUlQXKviNfq1rTP9qpOHZpmQe/QLO7K8aAF4m3UnFUJh6/H6rqDO5ud9KT5ge2H
i/byH8VnGamKs2Q2/oLfKXdhPj9saitk689uGoIdndlO1YOoQXgcYSjuq9tzD8ID
4i5kjWeNnyM=
=OiKp
-----END PGP SIGNATURE-----

--~--~---------~--~----~------------~-------~--~----~
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