Skip to content

Commit

Permalink
Add a WSGI middleware filter that can be used to run Diazo in a WSGI …
Browse files Browse the repository at this point in the history
…pipeline

svn path=/diazo/trunk/; revision=48910
  • Loading branch information
optilude committed Apr 17, 2011
1 parent 11f5653 commit d991583
Show file tree
Hide file tree
Showing 17 changed files with 1,388 additions and 1 deletion.
10 changes: 9 additions & 1 deletion buildout.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
parts =
diazo
test
wsgi
develop = .

[diazo]
Expand All @@ -11,5 +12,12 @@ interpreter = py

[test]
recipe = zc.recipe.testrunner
eggs = diazo
eggs = diazo [test]
defaults = ['--auto-color']

[wsgi]
recipe = zc.recipe.egg
eggs =
diazo [wsgi]
PasteScript
scripts = paster
13 changes: 13 additions & 0 deletions examples/wsgi/rules.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<rules
xmlns="http://namespaces.plone.org/diazo"
xmlns:css="http://namespaces.plone.org/diazo+css"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<theme href="static/theme/index.html" />

<replace content="/html/head/title" theme="/html/head/title" />

<replace css:content="#content" css:theme="#content" if="$foo = 'bar'" />
<replace css:content="#extra" css:theme="#extra" href="/inc.html" />

</rules>
29 changes: 29 additions & 0 deletions examples/wsgi/server.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[server:main]
use = egg:Paste#http
host = 0.0.0.0
port = 5000

[composite:main]
use = egg:Paste#urlmap
/static = static
/ = default

[pipeline:default]
pipeline = theme
content

[filter:theme]
use = egg:diazo
rules = %(here)s/rules.xml
prefix = /static

# Custom parameters
foo = bar

[app:content]
use = egg:Paste#static
document_root = %(here)s/static/content

[app:static]
use = egg:Paste#static
document_root = %(here)s/static/theme
3 changes: 3 additions & 0 deletions examples/wsgi/static/content/inc.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div id="extra">
Extra
</div>
11 changes: 11 additions & 0 deletions examples/wsgi/static/content/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<html>
<head>
<title>Content</title>
</head>
<body>

<h1>Content title</h1>
<div id="content">Content content</div>

</body>
</html>
12 changes: 12 additions & 0 deletions examples/wsgi/static/theme/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<html>
<head>
<title>Theme</title>
<link rel="stylesheet" href="./theme.css" />
</head>
<body>

<h1>Theme title</h1>
<div id="content">Theme content</div>
<div id="extra">Theme extra</div>
</body>
</html>
3 changes: 3 additions & 0 deletions examples/wsgi/static/theme/theme.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
h1 {
color: red;
}
Loading

0 comments on commit d991583

Please sign in to comment.