Well, subject says it all. I've applied a bunch of patches and
comitted some fixes in the last hours and I would appreciate some
beating if I broke your app :)
Thanks,
Alberto
I am getting some strange behavior from the SingleSelectField widget
(not a toscawidget).
The rendered html in 1.01 contains this for the first option:
<option value="">Please select an Mcode</option>
While in r2845 'value=""' is missing for this option.
<option>Please select an Mcode</option>
Here is the widget definition (it's part of a WidgetsList):
mcode = widgets.SingleSelectField(validator=validators.Regex(r"^M
\d{7}$"))
The option list is passed in from the controller here:
def createrequest(self,tg_errors=None,**params):
return dict(form =
study_request_form,values=params,option_list=
{'model':model_list,'mcode':mcode_list})
The kid temple contains:
${form.display(value=values,options=option_list)}
mcode_list is just a global variable:
mcode_list = [('','Please select an Mcode')]+ get_mcode_list()
I'm passing the options list in like this because of bug #1309, btw
If you need more info let me know.
Steve
>
> Hi,
>
> I am getting some strange behavior from the SingleSelectField widget
> (not a toscawidget).
>
> The rendered html in 1.01 contains this for the first option:
>
> <option value="">Please select an Mcode</option>
>
> While in r2845 'value=""' is missing for this option.
>
> <option>Please select an Mcode</option>
>
>
> Here is the widget definition (it's part of a WidgetsList):
>
> mcode = widgets.SingleSelectField(validator=validators.Regex(r"^M
> \d{7}$"))
>
> The option list is passed in from the controller here:
>
> def createrequest(self,tg_errors=None,**params):
>
> return dict(form =
> study_request_form,values=params,option_list=
> {'model':model_list,'mcode':mcode_list})
>
> The kid temple contains:
>
> ${form.display(value=values,options=option_list)}
>
> mcode_list is just a global variable:
>
> mcode_list = [('','Please select an Mcode')]+ get_mcode_list()
>
> I'm passing the options list in like this because of bug #1309, btw
Hmm, I think http://trac.turbogears.org/changeset/2843 is what is
causing this... (now I remember while selectionfield didn't convert
values with from_python...)
Does the new behavior cause a bug? (sorry, too lazy to check out if
w3c allows empty attributes ;) If it does I'll probably have to
revert that changeset.
Thanks for reporting this!
Alberto
There may be a better way for me to do what I'm trying to do. I'm kind
of new to web forms in general.
Here is more of the code that gerenates the option list:
def get_mcode_list():
mcodes = []
reader = csv.reader(open('mf_mcodes.csv','rb'))
reader.next()
for row in reader:
mcodes.append([row[0],row[0]+' - '+row[1]])
return mcodes
mcode_list = [('','Please select an Mcode')]+ get_mcode_list()
Thanks,
shday
On Apr 7, 10:47 am, Alberto Valverde <albe...@toscat.net> wrote:
> On Apr 7, 2007, at 2:57 AM, shday wrote:
>
>
>
>
>
>
>
> > Hi,
>
> > I am getting some strange behavior from the SingleSelectField widget
> > (not a toscawidget).
>
> > The rendered html in 1.01 contains this for the first option:
>
> > <option value="">Please select an Mcode</option>
>
> > While in r2845 'value=""' is missing for this option.
>
> > <option>Please select an Mcode</option>
>
> > Here is the widget definition (it's part of a WidgetsList):
>
> > mcode = widgets.SingleSelectField(validator=validators.Regex(r"^M
> > \d{7}$"))
>
> > The option list is passed in from the controller here:
>
> > def createrequest(self,tg_errors=None,**params):
>
> > return dict(form =
> > study_request_form,values=params,option_list=
> > {'model':model_list,'mcode':mcode_list})
>
> > The kid temple contains:
>
> > ${form.display(value=values,options=option_list)}
>
> > mcode_list is just a global variable:
>
> > mcode_list = [('','Please select an Mcode')]+ get_mcode_list()
>
> > I'm passing the options list in like this because of bug #1309, btw
>
> Hmm, I thinkhttp://trac.turbogears.org/changeset/2843is what is
> causing this... (now I remember while selectionfield didn't convert
> values with from_python...)
>
> Does the new behavior cause a bug? (sorry, too lazy to check out if
> w3c allows empty attributes ;) If it does I'll probably have to
> revert that changeset.
>
> Thanks for reporting this!
>
> Alberto- Hide quoted text -
>
> - Show quoted text -
I tested the page with http://validator.w3.org/ and there where no
problems with the value="". (My file_fields.widgets.FileField did
raise a warning though!).
Steve
This works fine in 1.0.1 but not in the 1.0 branch (r2845).
Here is how the option list is created:
technician_list = get_distribution_list(config.get('dl.technicians'))+
[('','none')]
Here is the traceback when I try to show the form:
Page handler: <bound method StudyRequestController.default of
<srt.controllers.StudyRequestController instance at 0x00EC1BE8>>
Traceback (most recent call last):
File "C:\Python24\lib\site-packages\cherrypy-2.2.1-py2.4.egg\cherrypy
\_cphttptools.py", line 105, in _run
self.main()
File "C:\Python24\lib\site-packages\cherrypy-2.2.1-py2.4.egg\cherrypy
\_cphttptools.py", line 254, in main
body = page_handler(*virtual_path, **self.params)
File "<string>", line 3, in default
File "C:\Documents and Settings\Stephen\Desktop\tg_checkout
\turbogears\controllers.py", line 334, in expose
File "<string>", line 5, in run_with_transaction
File "C:\Documents and Settings\Stephen\Desktop\tg_checkout
\turbogears\database.py", line 352, in sa_rwt
File "C:\Documents and Settings\Stephen\Desktop\tg_checkout
\turbogears\database.py", line 341, in sa_rwt
File "<string>", line 5, in _expose
File "C:\Documents and Settings\Stephen\Desktop\tg_checkout
\turbogears\controllers.py", line 351, in <lambda>
File "C:\Documents and Settings\Stephen\Desktop\tg_checkout
\turbogears\controllers.py", line 378, in _execute_func
File "C:\Documents and Settings\Stephen\Desktop\tg_checkout
\turbogears\errorhandling.py", line 73, in try_call
File "C:\Documents and Settings\Daystev\Desktop\srt_trunk\srt-project
\srt\controllers.py", line 154, in default
return action(item, **params)
File "<string>", line 3, in addtechs
File "C:\Documents and Settings\Stephen\Desktop\tg_checkout
\turbogears\controllers.py", line 330, in expose
File "<string>", line 5, in _expose
File "C:\Documents and Settings\Stephen\Desktop\tg_checkout
\turbogears\controllers.py", line 351, in <lambda>
File "C:\Documents and Settings\Stephen\Desktop\tg_checkout
\turbogears\controllers.py", line 391, in _execute_func
File "C:\Documents and Settings\Stephen\Desktop\tg_checkout
\turbogears\controllers.py", line 82, in _process_output
File "c:\documents and settings\daystev\desktop\tg_checkout
\turbogears\view\base.py", line 131, in render
return engine.render(**kw)
File "C:\Python24\lib\site-packages\turbokid-0.9.9-py2.4.egg\turbokid
\kidsupport.py", line 174, in render
return t.serialize(encoding=self.defaultencoding, output=format,
fragment=fragment)
File "C:\Python24\lib\site-packages\kid-0.9.4-py2.4.egg\kid
\__init__.py", line 283, in serialize
return serializer.serialize(self, encoding, fragment, format)
File "C:\Python24\lib\site-packages\kid-0.9.4-py2.4.egg\kid
\serialization.py", line 109, in serialize
text = ''.join(tuple(
File "C:\Python24\lib\site-packages\kid-0.9.4-py2.4.egg\kid
\serialization.py", line 630, in generate
for ev, item in self.apply_filters(stream, format):
File "C:\Python24\lib\site-packages\kid-0.9.4-py2.4.egg\kid
\serialization.py", line 165, in format_stream
for ev, item in stream:
File "C:\Python24\lib\site-packages\kid-0.9.4-py2.4.egg\kid
\parser.py", line 218, in _coalesce
for ev, item in stream:
File "C:\Python24\lib\site-packages\kid-0.9.4-py2.4.egg\kid
\serialization.py", line 480, in inject_meta_tags
for ev, item in stream:
File "C:\Python24\lib\site-packages\kid-0.9.4-py2.4.egg\kid
\parser.py", line 174, in _track
for p in stream:
File "C:\Python24\lib\site-packages\kid-0.9.4-py2.4.egg\kid
\filter.py", line 28, in apply_matches
item = stream.expand()
File "C:\Python24\lib\site-packages\kid-0.9.4-py2.4.egg\kid
\parser.py", line 103, in expand
for ev, item in self._iter:
File "C:\Python24\lib\site-packages\kid-0.9.4-py2.4.egg\kid
\parser.py", line 174, in _track
for p in stream:
File "C:\Python24\lib\site-packages\kid-0.9.4-py2.4.egg\kid
\parser.py", line 218, in _coalesce
for ev, item in stream:
File "C:\Documents and Settings\Daystev\Desktop\srt_trunk\srt-project
\srt\templates\editrequest.py", line 64, in _pull
File "c:\documents and settings\daystev\desktop\tg_checkout
\turbogears\widgets\base.py", line 352, in display
return super(CompoundWidget, self).display(value, **params)
File "c:\documents and settings\daystev\desktop\tg_checkout
\turbogears\widgets\forms.py", line 51, in _update_path
returnval = func(self, *args, **kw)
File "c:\documents and settings\daystev\desktop\tg_checkout
\turbogears\widgets\forms.py", line 236, in display
return super(InputWidget, self).display(value, **params)
File "c:\documents and settings\daystev\desktop\tg_checkout
\turbogears\widgets\base.py", line 264, in display
return view.engines.get('kid').transform(params, self.template_c)
File "C:\Python24\lib\site-packages\turbokid-0.9.9-py2.4.egg\turbokid
\kidsupport.py", line 191, in transform
return ElementStream(t.transform()).expand()
File "C:\Python24\lib\site-packages\kid-0.9.4-py2.4.egg\kid
\parser.py", line 103, in expand
for ev, item in self._iter:
File "C:\Python24\lib\site-packages\kid-0.9.4-py2.4.egg\kid
\parser.py", line 174, in _track
for p in stream:
File "C:\Python24\lib\site-packages\kid-0.9.4-py2.4.egg\kid
\parser.py", line 174, in _track
for p in stream:
File "C:\Python24\lib\site-packages\kid-0.9.4-py2.4.egg\kid
\filter.py", line 22, in apply_matches
for ev, item in stream:
File "C:\Python24\lib\site-packages\kid-0.9.4-py2.4.egg\kid
\parser.py", line 174, in _track
for p in stream:
File "C:\Python24\lib\site-packages\kid-0.9.4-py2.4.egg\kid
\parser.py", line 218, in _coalesce
for ev, item in stream:
File "C:\Documents and Settings\Daystev\Desktop\srt_trunk\srt-project
\srt\templates\edit_request_form.py", line 68, in _pull
File "c:\documents and settings\daystev\desktop\tg_checkout
\turbogears\widgets\forms.py", line 51, in _update_path
returnval = func(self, *args, **kw)
File "c:\documents and settings\daystev\desktop\tg_checkout
\turbogears\widgets\forms.py", line 236, in display
return super(InputWidget, self).display(value, **params)
File "c:\documents and settings\daystev\desktop\tg_checkout
\turbogears\widgets\base.py", line 261, in display
self.update_params(params)
File "c:\documents and settings\daystev\desktop\tg_checkout
\turbogears\widgets\forms.py", line 909, in update_params
optlist[i] = (self.validator.from_python(option[0])[0], option[1],
option_attrs)
TypeError: unsubscriptable object
>
> The MultipleSelectField widget doesn't allow empty strings in the
> option list (my option list is a list of tuples, with the first value
> as an empty string for one option). An empty sting value is useful
> because there is no way to unselect all preselected options (all least
> not in IE or Firefox).
>
> This works fine in 1.0.1 but not in the 1.0 branch (r2845).
>
> Here is how the option list is created:
>
> technician_list = get_distribution_list(config.get('dl.technicians'))+
> [('','none')]
>
> Here is the traceback when I try to show the form:
>
> [...]
I've just reverted the change that's causing this. Can you try latest
HEAD see if it's fixed?
Thanks again for the report!
Alberto
Steve
> Hello,
>
> I have had a fancy error (traceback below). I have figured out that
> latest formencode calls i18n gettext function which tries to look
> up a locale key on session. It fails because testutil.DummyRequest
> doesn't support a session.
>
> I have implemented a workaround in [2865] by adding a DummySession
> instance to DummyRequest.
Thanks!
Alberto
Thanks everyone for the patches!
Alberto
I was just starting to work on it ! I'll look at this today.
Cheers,
Florent.
I'm getting:
Traceback (most recent call last):
File "c:\python24\scripts\tg-admin-script.py", line 7, in ?
sys.exit(
File
"C:\Python24\lib\site-packages\setuptools-0.6c5-py2.4.egg\pkg_resources.py",
line 236, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File
"C:\Python24\lib\site-packages\setuptools-0.6c5-py2.4.egg\pkg_resources.py",
line 2097, in load_entry_point
return ep.load()
File
"C:\Python24\lib\site-packages\setuptools-0.6c5-py2.4.egg\pkg_resources.py",
line 1830, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "c:\paj\turbogears\turbogears\__init__.py", line 6, in ?
from turbogears.controllers import expose, flash, validate, redirect, \
File "c:\paj\turbogears\turbogears\controllers.py", line 14, in ?
from turbogears.validators import Invalid
File "c:\paj\turbogears\turbogears\validators.py", line 29, in ?
Validator.gettextargs['domain'] = 'FormEncode' # FormEncode should
call Tg's gettext \
AttributeError: type object 'Validator' has no attribute 'gettextargs'
I will look into this some more now.
Paul
I've put a kg_resources.require in vaidators.py so next one will see
a friendlier error message.
Alberto
....
Searching for RuleDispatch>=0.5a0.dev-r2303
Reading http://cheeseshop.python.org/pypi/RuleDispatch/
Couldn't retrieve index page for 'RuleDispatch'
Scanning index of all packages (this may take a while)
Reading http://cheeseshop.python.org/pypi/
No local packages or download links found for RuleDispatch>=0.5a0.dev-
r2303
error: Could not find suitable distribution for
Requirement.parse('RuleDispatch>
=0.5a0.dev-r2303')
Then I tried installing from an svn checkout of RuleDispatch, but got
this:
C:\Documents and Settings\Stephen\Desktop\RuleDispatch_co>
\python24\python setup.py install
running install
running bdist_egg
running egg_info
writing requirements to src\RuleDispatch.egg-info\requires.txt
writing src\RuleDispatch.egg-info\PKG-INFO
writing top-level names to src\RuleDispatch.egg-info\top_level.txt
writing dependency_links to src\RuleDispatch.egg-info
\dependency_links.txt
writing manifest file 'src\RuleDispatch.egg-info\SOURCES.txt'
installing library code to build\bdist.win32\egg
running install_lib
running build_py
creating build\lib.win32-2.4
creating build\lib.win32-2.4\dispatch
copying src\dispatch\ast_builder.py -> build\lib.win32-2.4\dispatch
copying src\dispatch\combiners.py -> build\lib.win32-2.4\dispatch
copying src\dispatch\functions.py -> build\lib.win32-2.4\dispatch
copying src\dispatch\interfaces.py -> build\lib.win32-2.4\dispatch
copying src\dispatch\predicates.py -> build\lib.win32-2.4\dispatch
copying src\dispatch\strategy.py -> build\lib.win32-2.4\dispatch
copying src\dispatch\__init__.py -> build\lib.win32-2.4\dispatch
creating build\lib.win32-2.4\dispatch\tests
copying src\dispatch\tests\doctest.py -> build\lib.win32-2.4\dispatch
\tests
copying src\dispatch\tests\test_dispatch.py -> build
\lib.win32-2.4\dispatch\test
s
copying src\dispatch\tests\test_parsing.py -> build
\lib.win32-2.4\dispatch\tests
copying src\dispatch\tests\__init__.py -> build\lib.win32-2.4\dispatch
\tests
copying src\dispatch\combiners.txt -> build\lib.win32-2.4\dispatch
running build_ext
error: The .NET Framework SDK needs to be installed before building
extensions f
or Python.
There are pre-built packages for windows on the "eggs" directory in
SVN. To dowload from there until we move them to their final location
try:
easy_install -f http://svn.turbogears.org/site_resources/eggs/
RuleDispatch PyProtocols
Alberto
Here is what I get:
C:\Documents and Settings\Daystev\Desktop\Downloads>easy_install -f
http://svn.t
urbogears.org/site_resources/eggs/ RuleDispatch PyProtocols
Searching for RuleDispatch
Best match: RuleDispatch 0.5a0.dev-r2115
Processing ruledispatch-0.5a0.dev_r2115-py2.4-win32.egg
ruledispatch 0.5a0.dev-r2115 is already the active version in easy-
install.pth
Using c:\python24\lib\site-packages\ruledispatch-0.5a0.dev_r2115-py2.4-
win32.egg
Processing dependencies for RuleDispatch
Searching for PyProtocols
Best match: PyProtocols 1.0a0dev-r2082
Processing pyprotocols-1.0a0dev_r2082-py2.4-win32.egg
pyprotocols 1.0a0dev-r2082 is already the active version in easy-
install.pth
Using c:\python24\lib\site-packages\pyprotocols-1.0a0dev_r2082-py2.4-
win32.egg
Processing dependencies for PyProtocols
On Apr 24, 9:18 am, Alberto Valverde <albe...@toscat.net> wrote:
> On Apr 24, 2007, at 4:32 AM, shday wrote:
>
>
>
>
>
> > I think I need binary egg for RuleDispatch in order to test this.
> > After running "setup.py install" from the checkout folder it goes fine
> > until this:
>
> > ....
> > Searching for RuleDispatch>=0.5a0.dev-r2303
> > Readinghttp://cheeseshop.python.org/pypi/RuleDispatch/
> > Couldn't retrieve index page for 'RuleDispatch'
> > Scanning index of all packages (this may take a while)
> > Readinghttp://cheeseshop.python.org/pypi/
http://trac.turbogears.org/browser/site_resources/eggs
It is not yet on the download page...
Cheers,
Florent.
I got the same thing. I even tried installing the .NET sdk but that
didn't solve the problem installing the latest RuleDispatch.
http://trac.turbogears.org/browser/site_resources/eggs/RuleDispatch-0.5a0.dev_r2303-py2.5-win32.egg
or
http://trac.turbogears.org/browser/site_resources/eggs/RuleDispatch-0.5a0.dev_r2303-py2.4-win32.egg
> Where can we find the source or a non windows egg? I'm trying to
> install on the latest ubuntu.
Try:
easy_install -U svn://svn.eby-sarna.com/svnroot/PyProtocols
easy_install -U svn://svn.eby-sarna.com/svnroot/RuleDispatch
You'll need to install subversion for this to work if you haven't
already,
apt-get install subversion
Alberto