Convert request form to python values based on namespaced schemas?

Hi all!

Is there a form library (or maybe some utilities scattered across Plone code) that can extract values from a request based on a schema?

I want to be able to say something like:

schema = Schema(ISomething, prefix="some.prefix") + Schema(ISomethingElse, prefix="something.else")
# and then:
values = extract_values(request.form, schema)

where request is something like:

/?some.prefix.title=Hello+world&something.else.showOnTop=true

I know I can probably achieve something like this with Colander and such, is there something closer to Zope + Plone?

There's some info in this thread: How to prefill the title of a dexterity add form

The javascript approach works. I haven't personally checked the allow_prefill_from_GET_request approach, but it looks like it should work too.

Have fun!

So, I've figured out I can do z3c.form.field.Fields(Iface, prefix="something").

Now, only if I can extract values from request without widgets...

The use case is for backend code services for plone.restapi/

It's not clear to me what the actual problem is that you're trying to solve.
Could you try to outline what it is you're trying to do?

I'm writing a plone.restapi endpoint service and I want to receive parameters in the request. These parameters can be described by an Interface, it's actually INavigationPortlet. So, my question is: how can I use the Interface schema to convert the values from the request form to a python object matching that schema?

I've progressed a bit more, here's something along the lines of what I was looking for:

from zope.schema.interfaces import IFromUnicode

def extract_data(schema, raw_data, prefix):
    data = {}

    for name in schema.names():
        field = schema[name]
        raw_value = raw_data.get(prefix + name, field.default)
        value = IFromUnicode(field).fromUnicode(raw_value)
        data[name] = value 
    return data

# and calling it like:
data = extract_data(INavigationPortlet, self.request.form, prefix)