Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #454 (closed enhancement: fixed)

Opened 13 years ago

Last modified 12 years ago

[PATCH] WidgetsDeclaration class

Reported by: michele Owned by: anonymous
Priority: normal Milestone: 0.9
Component: TG Widgets Version:
Severity: normal Keywords:
Cc:

Description

I'm going to attach my work, it's not implemented in TG for the moment (anyway it's just a matter of putting the classes in base.py and preparing some tests) but it's a small example script.

We will also need the declaration_counter.patch to keep track of istantation precedence in TG widgets (I've adapted this from formencode).

Please comment on this as I'm not a guru as I've already said.

Anyway seems to work well here.

Attachments

widgets_declaration.py Download (1.5 KB) - added by michele 13 years ago.
The example script
declaration_counter.patch Download (706 bytes) - added by michele 13 years ago.
The tg widgets patch
new_widgets_declaration.py Download (2.1 KB) - added by michele 13 years ago.
New version
widgets-declaration.patch Download (4.7 KB) - added by michele 13 years ago.
Patch that adds WidgetsDeclaration? to TG

Change History

Changed 13 years ago by michele

The example script

Changed 13 years ago by michele

The tg widgets patch

comment:1 Changed 13 years ago by michele

By the way subclassing a list can still cause name collisions.

For example by using:

class ContactFields(WidgetsDeclaration):
    extend = widgets.TextField()

Changed 13 years ago by michele

New version

comment:2 Changed 13 years ago by michele

I've attached a new version that fixes all those problems.

Again comments are welcome.

Changed 13 years ago by michele

Patch that adds WidgetsDeclaration? to TG

comment:3 Changed 13 years ago by michele

  • Summary changed from WidgetsDeclaration class to [PATCH] WidgetsDeclaration class

I've attached a patch that implements this, I've also re-enabled tests (I've changed a bit the overriding one, take a look please).

The patch is just there so that if the solution is good you can apply it.

Note: There is also a small fix for retrieve_css and retrieve_javascript on forms.

comment:4 Changed 13 years ago by kevin

declaration counter is in [580]. I'm bouncing between things right now, so the widget list is not there yet.

I now see that a new patch has come in. I'll fix up what I've got with the new patch.

comment:5 Changed 13 years ago by kevin

  • Status changed from new to closed
  • Resolution set to fixed
  • Milestone set to 0.9

I've committed this in [581]. I made a minor change: the import check around itertools isn't necessary because itertools was introduced in Python 2.3 (according to the docs, at least).

Note: See TracTickets for help on using tickets.