[PEAK] little fix for running/logs.py and a first draft of a webdemo

Phillip J. Eby pje at telecommunity.com
Thu Feb 26 12:45:27 EST 2004


At 03:17 PM 2/26/04 +0100, Ulrich Eck wrote:
>Hi Phillip,
>
>1. this is a little fix for running/logs.py that prevents exceptions
>    from being hidden from another exception when logged:

Thanks.


>2. I started a little webdemo app in peakplace:
>
>http://peakplace.tigris.org/source/browse/peakplace/src/sandbox/ueck/xslweb/
>
>It consists currently of 2 packages
>
>xslskins: A SkinService, XSLResource that does xsl-transformations on
>           resources and a XSLTransformDOMlet that can be used in p.w.t's
>           to include styled xml-fragments (one could think of slots)
>           additionally there is a first draft of a Element->XML DOMlet
>           that automatically renders XML from the model.Elements's
>           class/feature information.

I'm curious.  Why did you create a SkinService?  From what I can tell, it 
would have sufficed to do something like:

[Files *.pwt]
file_factory = xslskins.StyleWrapperFactory(
      style_pattern="%s_style", factory="peak.web.resources.TemplateResource"
  )

In order to create a wrapper object that loads the underlying resource type 
and then applies a named style to it.

So, it doesn't seem to me that creating a SkinService makes any sense for 
adding the styling.  A given layer or resource directory can easily use 
styled or non-styled resources this way.


>webdemo: A basic setup for a peak.web application with simple
>          security-declarations. It shows how one can use datamanagers,
>          elements and components with url-traversal.
>          several templates and stylesheets are provided in the
>          resources directory. it also shows how to use the
>          xsl-skin-service.
>
>          there are 2 helpers onboard: debug.py adds the command:
>
>          "peak publish import:webdemo.webapp.WebApp <url>"
>
>          that just publishes the url to stdout
>          and twistedweb.py, a wrapper for the twisted-http-server:
>
>          "peak twisted.web import:webdemo.webapp.WebApp"
>
>          that starts a twisted.http-server and serves the
>          app from there.
>
>
>If you find some time to look into it, i'ld be interested in your
>opinion and potential improvements/fixes to the codebase as it is now.
>
>this project is mostly for researching the current p.w capabilities
>so contributions/critics/tips/... are very welcome.
>
>till now peak.web works fairly good for what i can tell.

Yeah, but it's very verbose IMO.  I mean, peak.web forces you to declare 
lots of things that could possibly be done more simply or at least less 
repetitively.  I'm thinking about having something like:

[Web views for SomePackage.SomeClass]
index_html = web.useResource('SomePackage/www/index_html.pwt', 
permission=security.Anybody)
...

that can be used in an application configuration file, such that you could 
define an app's web UI and security almost entirely external to the 
application, or at least put it in a 'web-ui.ini' file in the package, that 
somebody could then include into their top-level config, possibly then 
overriding parts that they needed to.





More information about the PEAK mailing list