Skip to content

Commit

Permalink
Basically switching some imports around
Browse files Browse the repository at this point in the history
  • Loading branch information
chbrown committed Mar 16, 2010
1 parent 60d94b0 commit 95f37d1
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
3 changes: 2 additions & 1 deletion tw2/forms/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
This package contains the basic form widgets.
"""

from widgets import (Button, CheckBox, PostlabeledCheckBox,
from widgets import (Button, CheckBox,
FieldSet, FileField, Form, HiddenField, IgnoredField, ImageButton,
Label, Spacer, ListLayout, TableLayout, PasswordField,
RadioButton, ResetButton, SubmitButton, TextField, TextArea,
Expand All @@ -11,4 +11,5 @@
VerticalRadioButtonTable, VerticalCheckBoxTable,
TableFieldSet, ListFieldSet, FormPage, FileValidator,
LabelField, LinkField)
from mashups import PostlabeledCheckBox, PostlabeledPartialRadioButton
from calendars import CalendarDatePicker, CalendarDateTimePicker
4 changes: 1 addition & 3 deletions tw2/forms/calendars.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,8 @@

import formencode
from formencode.validators import *
from formencode.foreach import ForEach
from formencode.compound import *
from formencode.api import Invalid, NoDefault
from formencode.schema import Schema
from formencode.api import Invalid

__all__ = ["CalendarDatePicker", "CalendarDateTimePicker", "calendar_js", "calendar_setup"]

Expand Down
13 changes: 13 additions & 0 deletions tw2/forms/mashups.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import tw2.core as twc
from widgets import CheckBox, PostlabeledInputField

class PostlabeledCheckBox(CheckBox, PostlabeledInputField):
pass

class PostlabeledPartialRadioButton(PostlabeledInputField):
"""This is basically a manual mixin of RadioButton and IgnoredField. Inheritance doesn't work."""
type = "radio"
checked = twc.Param(attribute=True, default=False)

def _validate(self, value):
return twc.EmptyField
8 changes: 4 additions & 4 deletions tw2/forms/widgets.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import tw2.core as twc, re, itertools, webob, cgi
import tw2.core as twc
import itertools
import webob
import cgi
import math

#--
Expand Down Expand Up @@ -40,9 +43,6 @@ def prepare(self):
self.attrs['checked'] = self.value and 'checked' or None
self.value = None

class PostlabeledCheckBox(CheckBox, PostlabeledInputField):
pass

class RadioButton(InputField):
type = "radio"
checked = twc.Param(attribute=True, default=False)
Expand Down

0 comments on commit 95f37d1

Please sign in to comment.