Hi James,
Op 15-mrt-2007, om 10:46 heeft James Gardner het volgende geschreven:
>
> Hi Ksenia
>
> The problem here is that the recursive middleware can only forward to
> paths below it. In this case, the recursive middleware is setup in the
> error document middleware in the myproject app so when you try to
> include /someapp the recursive middleware thinks you mean /someapp
> below
> myproject, not /someapp below the root URL.
>
> To fix this you would need to setup recursive middleware above the
> composite app you've setup by adding a recursive filter. I don't
> know if
> it is possible to put a filter before the composite:main section in
> the
> config file itself but depending on how you are serving the file
> you can
> do something like this:
>
> from paste.recursive import RecursiveMiddleware
> from paste.deploy import loadapp
>
> app = loadapp('config:/path/to/config.ini')
> app = RecursiveMiddleware(app)
>
> if __name__ == '__main__':
> from paste.httpserver import serve
> serve(app, port=8000, host="0.0.0.0"
>
> I haven't tested this so let me know if there are any problems.
>
> If you give me some more detail about what the inter-application
> templating system is for I might be able to give you some alternative
> suggestions? The simplest solution would probably be to just create a
> python module which handles the templating calls and can be
> imported by
> both applications.
>
Sorry for the very late response! In the last couple of weeks I've
experimented with several WSGI options (paste.recursive,
paste.cascade) to create clever templating system that will
automagically insert parts of standard applications into the main
site. I ended up not using WSGI for this, but the simplest solution
with python imports :). The situation is very common:
/ ==> website (First Pylons application)
/cms ==> cms system (Second Pylons application) with standard CRUD
modules, e.g.:
/cms/news ==> CRUD news controller
/cms/calendar ==> CRUD calendar controller
etc...
The website naturally uses cms to display information:
/news ==> Display list with news
/news/pylons-is-a-new-cool-framework ==> Display news item
The question is, what is the nicest way to retrieve this information
from cms?
The solution that works the best for me is:
- use ToscaWidgets for reusable display components, like NewsItem or
NewsList
- attach widgets to BaseController.w in cms app, import that
controller into website app and deriver all controllers from it
- if some module requires more interaction with the user on the
website than just displaying (like comments on news), define the
controller in cms and subclass it in the website's controller
- use Mako's great option to specify more than one template
directories to search for templates: first website's template
directory, second cms's template directory. That way I can put simple
common templates into cms and customise it if needed in the website.
So at this moment I am using the cms app not only as application, but
also as a library. The goal is to have a website app skeleton that
will mostly consist from templates, css and js (like Wordpress).
Ksenia.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" 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/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---