Hi all,

I try to use the growing table field with singleselect inside

Here is my form setup  (more comments below):

@memoized(scope="read_groups")
def _groups():
    return get_group_options()

def groups():
    return _groups()

@memoized(scope="read_users")
def _users():
    return get_user_options()

def users():
    return _users()

class EditPermissionForm(GrowingTableForm):
    template = "project.widgets.templates.table_form"

    submit_text = 'Edit Permissions'
    fields = [
        GrowingTableFieldSet('edit_permissions',
            children = [
                        SingleSelectField('user_name', options=users),
                        SingleSelectField('group_name',
options=groups),
                        CheckBoxList('permissions',
                                     options = ["read", "write"]),
                        ],
            label_text='Permissions',
            help_text = "Select permissions to grant/revoke on this
content."),
        HiddenField('media_id'),
            ]

1/ I understood that the only way to dynamically set options in
growing's children is by setting a callable to the 'options' of the
SingleSelect
2/ in my use case get_user_options is very both very network and cpu
intensive, so I tried to setup a memoized decorator, otherwise the
computing is done for every instance call. That is, if I set some data
in the 'values' of the forms, once for each field
3/ I have the callable itself call the memoized decorated function,
otherwise tw crashed with a "memoized object is not iterable"

Now I need the cache to expire after the form has been rendered.
I don't really know how I can achieve that (The memoized object has a
purge method)

Of course it would be simpler if I had a way to send the options to
the selectfields from the controller (in params), is there a way to do
that ?

closest subject on the list :

http://groups.google.com/group/turbogears/browse_thread/thread/f43a6fa5cab47d14/4386b782e36df38d

thanks

NIL

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