Man o man. So amongst smaller problems. I have reduced to problem to this:
The following files work correctly(including the link to the css in
the html output):
######/tester/tester/controllers.py
class Root(controllers.RootController):
@expose(template="tester.templates.index")
def index(self):
#widget, widgetData = {}, {}
#widget['menu'] = Menu()
#widgetData['menu'] = {}
widget = Menu()
widgetData = {}
return dict(widget=widget, widgetData=widgetData)
#######/tester/tester/templates/index.kid
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#"
py:extends="'master.kid'">
<head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type"
py:replace="''"/>
</head>
<body>
<?python #${widget['menu'](**widgetData['menu'])} ?>
${widget(**widgetData)}
</body>
</html>
Now if I change to using a dictionary it does not include the css:
######/tester/tester/controllers.py
class Root(controllers.RootController):
@expose(template="tester.templates.index")
def index(self):
widget, widgetData = {}, {}
widget['menu'] = Menu()
widgetData['menu'] = {}
return dict(widget=widget, widgetData=widgetData)
#######/tester/tester/templates/index.kid
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#"
py:extends="'master.kid'">
<head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type"
py:replace="''"/>
</head>
<body>
${widget['menu'](**widgetData['menu'])}
</body>
</html>
Do I really have to pass all the widgets as explict members of the return dict?
Thanks.
-Ian
On 9/15/06, Jorge Godoy <[EMAIL PROTECTED]> wrote:
>
> "Adam Jones" <[EMAIL PROTECTED]> writes:
>
> > Ok, let me see if I understand this correctly. This problem would be
> > solved like this:
> >
> > (assuming that /$projectname/widgets/static/css points to the correct
> > directory)
> >
> > ::In the controller::
> >
> > import os.path
> > import pkg_resources
> >
> > pkg_path = pkg_resources.resource_filename(__name__,
> > os.path.join("widgets","static", "css"))
> > register_static_directory("mywidgets.css", pkg_path)
> >
> > Then the widget could be change to:
> >
> > class Menu(Widget):
> > template = """
> > ...
> > """
> > css = [CSSLink('mywidgets.css', name="menu.css")]
>
> I can't answer without testing to see if it works. From the page below it
> looks like it is correct.
>
> > By the way, I am pulling this from the widget packaging tutorial at:
> > http://trac.turbogears.org/turbogears/wiki/WidgetPackages
>
> That's the document I was thinking about. :-)
>
> > Please let me know if there is a more up to date doc.
>
> I don't believe there's one. This is the technique I use here.
>
> --
> Jorge Godoy <[EMAIL PROTECTED]>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---