The input field 'username' was not expected.

62 views
Skip to first unread message

Robert Ramsay

unread,
Jan 6, 2011, 9:04:46 AM1/6/11
to rum-discuss
I'm using RUM 0.2 and pylons. I can create and view my models fine.
But when I try to edit anything it says that the form is not valid and
"The Input field 'username' was not expected."

Michael Brickenstein

unread,
Jan 6, 2011, 11:04:39 AM1/6/11
to rum-discuss
Dear Robert!
Can you post a more detailed stack trace?
Thanks,
Michael

Robert Ramsay

unread,
Jan 6, 2011, 11:25:16 AM1/6/11
to rum-d...@googlegroups.com
I'd love to, how do I get a stack trace for RUM?

> --
> You received this message because you are subscribed to the Google Groups "rum-discuss" group.
> To post to this group, send email to rum-d...@googlegroups.com.
> To unsubscribe from this group, send email to rum-discuss...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/rum-discuss?hl=en.
>
>

Robert Ramsay

unread,
Jan 7, 2011, 12:57:16 AM1/7/11
to rum-discuss
My first issue is with form validation. But if I hit submit again it
will say that the entry has been successfully completed. But then
checking back at the index, the entry is empty. And when attempting to
delete I actually get a halting error with stack trace (attached
below).

I will give some context though. In our pylons app we heavily use
reflection. In fact the model properties are defined using
__table_args__ = {'autoload:True'}. This may be causing the issue, I
don't know.

Robert

File '/home/robert/pylons-env/lib/python2.6/site-packages/rum/
templates/objects/confirm_delete.html', line 13 in <Expression '?'>
<div id="rum-content" py:with="form = get_view()">
File '/home/robert/pylons-env/lib/python2.6/site-packages/rum/
controller.py', line 266 in get_view
self.view = util.adapt_call(self.app.viewfactory, **routes_)
File '/home/robert/pylons-env/lib/python2.6/site-packages/rum/
util.py', line 59 in adapt_call
return func(**kw)
File '<generated code>', line ? in __call__
File '/usr/lib/pymodules/python2.6/peak/rules/core.py', line 153 in
__call__
return self.body(*args, **kw)
File '/home/robert/pylons-env/lib/python2.6/site-packages/
tw.rum-0.4dev_20101208-py2.6.egg/tw/rum/viewfactory.py', line 133 in
__call_default_implemenation
return widget(**args)
File '/home/robert/pylons-env/lib/python2.6/site-packages/
tw.forms-0.9.9-py2.6.egg/tw/forms/fields.py', line 178 in __new__
return super(ContainerMixin, cls).__new__(cls,
id,parent,children,**kw)
File '/home/robert/pylons-env/lib/python2.6/site-packages/
tw.forms-0.9.9-py2.6.egg/tw/forms/core.py', line 56 in __new__
obj = super(InputWidget, cls).__new__(cls, id, parent, children,
**kw)
File '/home/robert/pylons-env/lib/python2.6/site-packages/tw/core/
base.py', line 285 in __new__
if not [obj._append_child(c) for c in children]:
File '/home/robert/pylons-env/lib/python2.6/site-packages/tw/core/
util.py', line 54 in wrapper
return func(self, *args, **kw)
File '/home/robert/pylons-env/lib/python2.6/site-packages/tw/core/
base.py', line 719 in _append_child
raise ValueError("Can only append Widgets or Childs, not %r" % obj)
ValueError: Can only append Widgets or Childs, not
rum.fields.PrimaryKey(type=rum.fields.Integer(name=u'id',
required=True, label=u'Id', default=<function get_next_id at
0x9a820c8>, read_only=False, range=(None, None), sortable=True,
searchable=True, description=''), auto=True, order=None)


On Jan 6, 11:25 am, Robert Ramsay <robert.alan.ram...@gmail.com>
wrote:

Michael Brickenstein

unread,
Jan 7, 2011, 1:40:18 AM1/7/11
to rum-d...@googlegroups.com
Hi Robert!
Sorry, the delete error is independent from the other problems (I have a look at it).

Regarding the username problem.
RUM constructs the form twice
once on the action
edit (form display)
once on
update (validation and update values).

It generates a toscawidgets form, which validates with a formencode Schema.
On of the parameters of this schema is to raise an error when there appear unexpected arguments.

So, I suppose, that two different forms are generated, one with username and one without.
Do you have any customizations, policy, widgets...?
You should provide rum with the same rules for edit and update.

Cheers,
Michael

-------------------------------------------
Dr. rer. nat. Michael Brickenstein
Mathematisches Forschungsinstitut Oberwolfach gGmbH
Schwarzwaldstr. 9 - 11
77709 Oberwolfach
Tel.: 07834/979-31
Fax: 07834/979-38

Michael Brickenstein

unread,
Jan 7, 2011, 2:16:47 AM1/7/11
to rum-d...@googlegroups.com
Hi Robert!

The explanation is fully correct, but both errors are not specific to your application.

Before christmas I implemented the wonderful 'join'-feature (you will see)
on heavy user requirements and as it
handles common problems in a good way.
Unfortunately, I had to change nearly the complete rum source code
to adapt to the functionality.

While I have already fixed most bugs, these hit me surprisingly.

Many thanks for the bug reports!!!

I hope that I can give an update until the end of the day.

Cheers,
Michael

Michael Brickenstein

unread,
Jan 7, 2011, 4:17:32 AM1/7/11
to rum-d...@googlegroups.com
Dear Robert!

Thanks again for your feedback and sorry for your inconveniences.

You can find
an update in our repository
or on PYPI
easy_install -U rum

Cheers,
Michael

Robert Ramsay

unread,
Jan 7, 2011, 8:27:07 AM1/7/11
to rum-d...@googlegroups.com
Thanks for the quick response. pip and easy_install now install
rum-0.4dev-20110107. And I get the following stacktrace

URL: http://localhost:5000/admin/users/
File '/home/robert/pylons-env/lib/python2.6/site-packages/WebError-0.10.3-py2.6.egg/weberror/evalexception.py',
line 431 in respond
app_iter = self.application(environ, detect_start_response)
File '/home/robert/pylons-env/lib/python2.6/site-packages/Beaker-1.5.4-py2.6.egg/beaker/middleware.py',
line 152 in __call__
return self.wrap_app(environ, session_start_response)
File '/home/robert/pylons-env/lib/python2.6/site-packages/routes/middleware.py',
line 131 in __call__
response = self.app(environ, start_response)
File '/home/robert/pylons-env/lib/python2.6/site-packages/Pylons-1.0-py2.6.egg/pylons/wsgiapp.py',
line 107 in __call__
response = self.dispatch(controller, environ, start_response)
File '/home/robert/pylons-env/lib/python2.6/site-packages/Pylons-1.0-py2.6.egg/pylons/wsgiapp.py',
line 312 in dispatch
return controller(environ, start_response)
File '/media/OS/Users/Robert/workspace/shirtsbyme/shirtsbyme/controllers/admin.py',
line 62 in AdminController
return dynamic_app(req.environ, start_response)
File '/home/robert/pylons-env/lib/python2.6/site-packages/rum/wsgiapp.py',
line 314 in __call__
return self.wsgi_app(environ, start_response)
File '/home/robert/pylons-env/lib/python2.6/site-packages/paste/registry.py',
line 379 in __call__
app_iter = self.application(environ, start_response)
File '/home/robert/pylons-env/lib/python2.6/site-packages/WebError-0.10.3-py2.6.egg/weberror/evalexception.py',
line 235 in __call__
return self.respond(environ, start_response)
File '/home/robert/pylons-env/lib/python2.6/site-packages/WebError-0.10.3-py2.6.egg/weberror/evalexception.py',
line 418 in respond
return self.application(environ, start_response)
File '/home/robert/pylons-env/lib/python2.6/site-packages/repoze/tm/__init__.py',
line 23 in __call__
result = self.application(environ, save_status_and_headers)
File '/home/robert/pylons-env/lib/python2.6/site-packages/tw/core/middleware.py',
line 43 in __call__
return self.wsgi_app(environ, start_response)
File '/home/robert/pylons-env/lib/python2.6/site-packages/tw/core/middleware.py',
line 68 in wsgi_app
resp = req.get_response(self.application)
File '/home/robert/pylons-env/lib/python2.6/site-packages/webob/request.py',
line 937 in get_response
application, catch_exc_info=False)
File '/home/robert/pylons-env/lib/python2.6/site-packages/webob/request.py',
line 906 in call_application
app_iter = application(self.environ, start_response)
File '/home/robert/pylons-env/lib/python2.6/site-packages/rum/wsgiapp.py',
line 325 in wsgi_app
return self.dispatch(request)(environ, start_response)
File '/home/robert/pylons-env/lib/python2.6/site-packages/rum/router.py',
line 23 in __call__
return next_app(environ, start_response)
File '/home/robert/pylons-env/lib/python2.6/site-packages/rum/controller.py',
line 98 in __call__
output = self.call_action(routes)
File '<generated code>', line ? in call_action
File '/home/robert/pylons-env/lib/python2.6/site-packages/rum/controller.py',
line 592 in _initialize_repository
return next_method(self, routes)
File '/home/robert/pylons-env/lib/python2.6/site-packages/rum/controller.py',
line 560 in _validate_input
validator = self._get_view(routes)
File '/home/robert/pylons-env/lib/python2.6/site-packages/rum/controller.py',
line 263 in _get_view
routes_['fields']=self.fields
AttributeError: 'CRUDController' object has no attribute 'fields'

Reply all
Reply to author
Forward
0 new messages