widget status

0 views
Skip to first unread message

Kevin Dangoor

unread,
Feb 3, 2006, 3:52:17 PM2/3/06
to turbo...@googlegroups.com
A small update. I had some other appointments today, so I haven't been
able to do anything else on widgets (other than commit a couple of
patches). The API still has a couple more tweaks to go (see the
separate discussion about cleaned up widget APIs). These should be
minor tweaks, so if you want to start coding against the new API just
run turbogears.widgets.use_new_widgets() and have at it!

I hope that on Monday we can finalize those last details. At that
point, I'll flip-flop the old and new as I did earlier in the week
with controllers.py.

Kevin

--
Kevin Dangoor
Author of the Zesty News RSS newsreader

email: k...@blazingthings.com
company: http://www.BlazingThings.com
blog: http://www.BlueSkyOnMars.com

Randall

unread,
Feb 3, 2006, 5:45:42 PM2/3/06
to TurboGears
Kevin,

I know this is alpha software so things break, but I want to let you
know, if you didn't already, that the last patches broke lots of stuff.
You'll see if you run a DataController. First, the Form class
requires a non-keyword arg for the widgets(fields), so line 209 in
datacontroller.py needs to have the kwarg removed. After fixing that
I'm getting this error, which I don't know how to fix yet.

svn/turbogears/turbogears/fastdata/templates/datagrid.py", line 31, in
_pull
NameError: name 'name' is not defined

Randall

Randall

unread,
Feb 3, 2006, 6:04:11 PM2/3/06
to TurboGears
"Lots" may be an overstatement since I haven't got past the second bug
yet.

Alberto Valverde

unread,
Feb 3, 2006, 7:58:02 PM2/3/06
to turbo...@googlegroups.com
Hi Randall,

The problem you're suffering is that DataGrid has been upgraded (since r637) to the new widget's API. I think Kevin has tried his best to keep everything backwards compatible with the old API (by creating newforms.py and newbase.py, etc) but missed it on this one (I wrote the patch and didn't think this could happen either, so I guess I'm the one to blame here)

I think the best thing you can do is to switch to the new API (by running turbogears.widgets.use_new_widgets() after you import turbogears.widgets) and start working against it (and help us smooth out the sharp edges on the way... ;). This, I think, will solve all the problems you're describing with DataController.

Either this or updating all the fastdata tree to r636.

I'm really sorry for breaking your app but, as you said, this is alpha software... ;)

Regards,
Alberto

Alberto Valverde

unread,
Feb 3, 2006, 8:07:52 PM2/3/06
to turbo...@googlegroups.com
On 04/02/2006, at 1:58, Alberto Valverde wrote:
>
> The problem you're suffering is that DataGrid has been upgraded
> (since r637) to the new widget's API. I think Kevin has tried his
> best to keep everything backwards compatible with the old API (by
> creating newforms.py and newbase.py, etc) but missed it on this one
> (I wrote the patch and didn't think this could happen either, so I
> guess I'm the one to blame here)


Just clarifying myself... I wrote the DataGrid updater patch (#502),
not the new widgets API (which is Kevin's, Michele's and David's
great work ;)

Alberto

Randall

unread,
Feb 3, 2006, 8:38:48 PM2/3/06
to TurboGears
Sounds good. What's the best way to use the new API? I see the
commented #use_new_widgets() function. Should I just uncomment that?

Don't mean to complain. Just trying to let you know what's broken if
you didn't already. I appreciate your work.

Randall

Kevin Dangoor

unread,
Feb 3, 2006, 11:05:37 PM2/3/06
to turbo...@googlegroups.com
On 2/3/06, Randall <ran...@tnr.cc> wrote:
> I know this is alpha software so things break, but I want to let you
> know, if you didn't already, that the last patches broke lots of stuff.

I hadn't considered that aspect when I applied the patch. Here's what
I've done as a corrective measure: I've put the old fastdata package
in place and moved the new one into "newfastdata". In my current
mental state (it's a bit late for me), I couldn't come up with a good
way around circular imports, so if you want to use the new widgets
with the updated grid widget, you'll need to

import turbogears
from turbogears import newfastdata
turbogears.fastdata = newfastdata

I'm not even 100% certain this will work, because of the template.

Hopefully on Monday I'll be able to switch in the new widgets (thus
breaking everything for people with custom widgets, but hopefully it's
a quick migration).

Kevin

Randall

unread,
Feb 3, 2006, 11:52:47 PM2/3/06
to TurboGears
Thanks Kevin. Hopefully you won't read this until Monday and I hope
you had a good weekend. Just want to get this down while its on my
mind. I switched to the new API and I'm just using the DataController
against a simple two text field SQLObject class. There is a problem
with kid (I think) rendering for an edit and the output is nearly
useless.

TypeError: dispatch_error() got multiple values for keyword argument
'tg_errors'

I've stepped thru code trying to find out where the exception is thrown
but no luck yet. I have noted that in the kid template form.kid, when
obj is replaced with None in ${form.insert(obj, action=action)}, the
form renders fine. When obj is included it throws the exception shown
above. I checked that obj has both attributes (permissionId,
description) required by the form.

Randall

unread,
Feb 4, 2006, 1:56:00 AM2/4/06
to TurboGears
I fiddled with the controller so I could see the real exception and
this is interesting:

File
"/home/randall/downloads/svn/turbogears/thirdparty/kid/kid/pull.py",
line 206, in _coalesce
for ev, item in stream:
File "<string>", line 66, in _pull
File
"/usr/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1516-py2.4.egg/sqlobject/main.py",
line 898, in get
id = cls.sqlmeta.idType(id)
ValueError: invalid literal for int(): permissionId

It looks like the SO get method is sent the wrong value. That seems
weird to me though becuase by the time form.insert is called, the SO
instance has already been fetched.

Alberto Valverde

unread,
Feb 4, 2006, 4:31:49 AM2/4/06
to turbo...@googlegroups.com
I ran into this problem too... The porblem is at neforms.py:415 in:
py:replace="field.display(value=value.get(field.name),
options=options.get(field.name))"

A you can see, the form template tries too fetch the object's value
via "get" (instead of normal attribute lookup).

I fixed, err, worked-around it, by sending the SO object as a
dictionary via database.so_to_dict.
I'k not sure wether this is a bug or new behaviour, though....

Alberto

Kevin Dangoor

unread,
Feb 4, 2006, 7:47:04 AM2/4/06
to turbo...@googlegroups.com
Yeah, that's a bug. It needs to switch to doing getattr() and it also
needs to wrap incoming dictionaries in a util.DictWrapper.

Kevin

Michele Cella

unread,
Feb 4, 2006, 8:03:08 AM2/4/06
to TurboGears
Alberto Valverde wrote:
> I ran into this problem too... The porblem is at neforms.py:415 in:
> py:replace="field.display(value=value.get(field.name),
> options=options.get(field.name))"
>
> A you can see, the form template tries too fetch the object's value
> via "get" (instead of normal attribute lookup).
>
> I fixed, err, worked-around it, by sending the SO object as a
> dictionary via database.so_to_dict.
> I'k not sure wether this is a bug or new behaviour, though....
>

I talked with Kevin about this two days ago, it's not a new behavior
but my fault. :-/
This will be fixed with an AttrDict wrapper.

Ciao
Michele

Michele Cella

unread,
Feb 4, 2006, 8:05:26 AM2/4/06
to TurboGears
Michele Cella wrote:
>
> I talked with Kevin about this two days ago, it's not a new behavior
> but my fault. :-/
> This will be fixed with an AttrDict wrapper.
>

Wow, I'm really slow.
Sorry, didn't notice Kevin already replied.

Ciao
Michele

Reply all
Reply to author
Forward
0 new messages