Author: dmeyer
Date: Fri Jan 27 13:40:44 2006
New Revision: 1134
Modified:
trunk/cherrypy/src/config.py
trunk/cherrypy/src/server.py
trunk/cherrypy/test/cheetah.html
trunk/cherrypy/test/cherrytest.py
Log:
support static files
Modified: trunk/cherrypy/src/config.py
==============================================================================
--- trunk/cherrypy/src/config.py (original)
+++ trunk/cherrypy/src/config.py Fri Jan 27 13:40:44 2006
@@ -30,9 +30,11 @@
__all__ = [ 'config' ]
# kaa imports
-from kaa.base.config import Group, Var
+from kaa.base.config import Group, Var, Dict
# the config group
config = Group(desc='basic server configuration', schema=[
Var(name='port', default=8080, desc='port to listen'),
- Var(name='debug', default=False, desc='turn on extra debug') ])
+ Var(name='debug', default=False, desc='turn on extra debug'),
+ Var(name='root', default=''),
+ Dict(name='static', type=str, schema=Var(type=str)) ])
Modified: trunk/cherrypy/src/server.py
==============================================================================
--- trunk/cherrypy/src/server.py (original)
+++ trunk/cherrypy/src/server.py Fri Jan 27 13:40:44 2006
@@ -143,7 +143,16 @@
'autoreload.on': False,
'server.logToScreen': config.debug,
'logDebugInfoFilter.on': config.debug,
- 'server.socketPort': config.port })
+ 'server.socketPort': config.port,
+ 'staticFilter.root': config.root
+ })
+
+ for key, value in config.static.items():
+ cherrypy.config.update( { key: {
+ 'staticFilter.on': True,
+ 'staticFilter.dir': value
+ } } )
+
cherrypy.server = Server()
cherrypy.server.start(True, WSGIServer)
kaa.notifier.signals['shutdown'].connect(cherrypy.server.stop)
Modified: trunk/cherrypy/test/cheetah.html
==============================================================================
--- trunk/cherrypy/test/cheetah.html (original)
+++ trunk/cherrypy/test/cheetah.html Fri Jan 27 13:40:44 2006
@@ -4,6 +4,7 @@
#for $line in $lines
<li>$line</li>
#end for
+<img src="images/foo.jpg"/>
</ul>
</body>
</html>
Modified: trunk/cherrypy/test/cherrytest.py
==============================================================================
--- trunk/cherrypy/test/cherrytest.py (original)
+++ trunk/cherrypy/test/cherrytest.py Fri Jan 27 13:40:44 2006
@@ -1,3 +1,5 @@
+import os
+
import kaa.cherrypy
import kaa.notifier
import kaa.notifier.thread
@@ -15,22 +17,33 @@
class Test:
@kaa.cherrypy.expose()
- def index(self, pos):
+ def index(self):
return 'test'
-class TemplatePath:
- def __init__(self, engine, path, suffix_list):
- pass
-
+ @kaa.cherrypy.expose()
+ def seven(self):
+ return '7'
+
+class Browse:
+
+ @kaa.cherrypy.expose()
+ def index(self, path='/'):
+ return path
+
+ @kaa.cherrypy.expose()
+ def default(self, *args):
+ return self.index('/' + '/'.join(args))
+
class Root:
test = Test()
-
+ browse = Browse()
+
@kaa.cherrypy.expose(template='test.kid', mainloop=False)
def index(self):
main = kaa.notifier.thread._thread_notifier_mainthread
return dict(title = 'Test Kid Page',
- lines = ['qwe','asd','zxc'],
+ lines = os.listdir('/tmp/'),
header = header.Template(text='index'),
mainloop = main == threading.currentThread())
@@ -55,6 +68,9 @@
kaa.cherrypy.config.port = 8080
kaa.cherrypy.config.debug = True
+kaa.cherrypy.config.root = '..'
+kaa.cherrypy.config.static['/images'] = 'test'
+kaa.cherrypy.config.static['/css'] = '/tmp'
kaa.cherrypy.start(Root)
kaa.notifier.loop()
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog