However now, since we need to implement a generic webapp with is more
focused on speed of development and execution, we chose to go for the
future proof SA/GENSHI versions.
However it is somewhat not easy to start out with SA and GENSHI since
the TG1.0b2 contains the SA bug (import line). And Genshi Documentation
at the moment is sparse at best (but luckily Genshi is so easy and
natural that that can be done anyways).
Now however, Genshi breaks widgets. There have been multiple
discussions around Genshi working with traditional widgets by using the
TRUNK or patching the widgets code. But I want to give ToscaWidgets a
try. If it can do simple round-trip form verification, I will be happy.
Now ToscaWidgets documentation is non-existent, which is well explained
on the website. What I do not understand is, why even the 'tg-sample'
breaks.
The Widgets get displayed as XML and are escaped by both Genshi and
KID. I found no clue as to why and of course they dont work like that.
I tried using KID's XML function which also breaks.
Please take a look at
http://trac.exilante.de:9000/trac/wiki/GenshiQuickStartLog
for details about the simple setup.
What can be done?
Martin
I don't recommend using the widgets in trunk as they will soon be
discontinued in favor of ToscaWidgets for TG 2.0
>
> Now ToscaWidgets documentation is non-existent, which is well explained
> on the website. What I do not understand is, why even the 'tg-sample'
> breaks.
>
tgsample uses kid as a default page template language
"tg.default_view='kid'". Are you sure tgsample breaks untouched? (works
fine in my system). If so, could you please checkout ToscaWidgets from
http://www.turbogears.org/svn/turbogears/projects/ToscaWidgets/trunk
and run "python setup.py test" and send me the results if they fail?
To use genshi as a default page template language you need to add a genshi
master.html and sitetemplate.html. I'll soon upload an example tg app
using genshi to show how it's done.
Alberto
Please upgrade both the forms and core packages by:
easy_install -U ToscaWidgets
easy_install -U ToscaWidgetsForms
Before trying it so we are tuned in the same frequency ;)
The important bits are at:
* start-tgsamplegenshi.py
Where the TurboGears HostFramework object is initialized.
* tgsamplegenshi/config.app.cfg
Where genshi is set as tg.defaultview and options are passed to genshi,
errr, *should* be passed but aren't... looks like a bug in TG.... maybe
http://tinyurl.com/yz5pjk??
* templates/{master,sitetemplate,home}.html
The templates you should XInclude for resources to be included in pages
that need them
Please keep me up with how it goes...
Alberto
No handlers could be found for logger "toscawidgets.view"
Traceback (most recent call last):
File "start-tgsample_genshi.py", line 30, in ?
from tgsample_genshi.controllers import Root
File
"c:\python24\lib\site-packages\myghty-1.1-py2.4.egg\myghty\importer.py",
line 54, in import_module
return builtin_importer(name, globals, locals, fromlist)
File "c:\Documents and
Settings\slingareddy\workspace\genshiproj\trunk\example
s\tgsample-genshi\tgsample_genshi\controllers.py", line 4, in ?
from tw_samples import AddUserForm
File
"c:\python24\lib\site-packages\myghty-1.1-py2.4.egg\myghty\importer.py",
line 54, in import_module
return builtin_importer(name, globals, locals, fromlist)
ImportError: No module named tw_samples
But I want to provide now a look-ahead-while-typing text field. So im
just right now at updating the TW installation. Ill be back in some
mins with more info.
does break again, this time it breaks while trying to load all the JS
links:
{{{ File ...."\TurboGears-1.0b2-py2.4.egg\turbogears\controllers.py",
line 68, in _process_output
js[script.location].add(script)
KeyError: 'bodybottom'}}}
This is related to the samples not requiring TW post r2229. There's
been a change on how TG apps load the HostFramework object (now done
by a TG extension and configured in the config file) and the examples
require latest TW.
Try:
easy_install -U ToscaWidgets==dev
As a side note, if latest dev still breaks, would you mind sending me
privately the results of the tests? To run them you'll have to do a
checkout from http://www.turbogears.org/svn/turbogears/projects/
ToscaWidgets/trunk and run "python setup.py test" there.
Thanks for the feedback :)
Alberto
the update worked fine (now to TW rev:2235 and the TG App doesnt break
in the sense that it executes without complaining, but the following
source gives you an idea of what I ve been wondering in the first
place:
{{{
<body>
<form id="form" action="save" method="POST"
class="adduserform">
<input type="hidden" name="id" class="hiddenfield" id="form_id"
value="I'm hidden!">
<ul class="field_list">
<li class="even">
<label id="form_name.label" for="form_name"
class="fieldlabel required">Name</label>
<input type="text" name="name" class="textfield
required" id="form_name" value="Your name here">
</li><li class="odd">
<label id="form_age.label" for="form_age"
class="fieldlabel">Age</label>
<select name="age" class="singleselectfield"
id="form_age">
<option value="0">0</option><option
value="1">1</option><option
value="2">2</option><option
value="3">3</option><option
value="4">4</option><option value="5">5</
</select>
}}}
Its escaped again and much more so this time, it is escaped so heavily
that you have the "<" even in the view.
The tests results in 22 errors and 3 failures, refer to
http://trac.exilante.de:9000/trac/attachment/wiki/GenshiQuickStartLog/error.log
for the output.
I really wonder how this can happen, am I missing some installation
step?
This is because the display rules are broken. There are two tests
failing from test_genericfunctions.py.
>
> The tests results in 22 errors and 3 failures, refer to
>
> http://trac.exilante.de:9000/trac/attachment/wiki/
> GenshiQuickStartLog/error.log
>
> for the output.
> I really wonder how this can happen, am I missing some installation
> step?
This is something that has bugged others too but I'm not sure yet why
it happens... :( It seems to be related with outdated packages more
precisely RuleDispatch and TurboKid.
TurboKid needs to be at least 0.9.9. You can upgrade it by:
easy_install -U TurboKid>=0.9.9
TW also needs latest RuleDispatch. There are pre-compiled eggs for
windows at http://toscawidgets.org/download. You can upgrade it by:
easy_install -f http://toscawidgets.org/download -U
RuleDispatch>=0.5a0.dev_r2247
Tell me how it goes... :)
Thanks,
Alberto
Since im using Genshi and TurboKid sounds so Kid dy...
TurbKid is neccesary for those tests to pass only. I've updated the
requirement so they won't run unless 0.9.9 is present. You dont need
if if using genshi-only widgets.
Can you try upgrading ToscaWidgets and ToscaWidgetsForms again? I've
inluded an explitict pkg_resources.require
("RuleDispatch>=0.5a0.dev_r2247") in genericfunctions.py which should
make sure no older version is used by mistake. At least 3 persons I'm
aware of (counting you) had this problem before and was related to
old requirements being installed.... I'm trying to track why those
are not being upgraded and make the "require" checks more strict to
see if setuptools can handle this automatically... no luck yet... :(
BTW:
I'll be releasing nightly snapshots of TW and related packages (those
that are not available at the cheeseshop) from http://
toscawidgets.org/download so if you're not running from SVN I'd
recommend to update regularily as this is moving fast ATM.
Alberto
Gee, I've missed this message and just reading it now... sorry.
tw_samples is in a separate egg I made to factor out the samples to use
in different framework apps. You can install them by:
easy_install -f http://toscawidgets.org/download TWSampleWidgets
Alberto