Author: dmeyer
Date: Fri Apr 27 15:37:52 2007
New Revision: 2660

Removed:
   trunk/cherrypy/src/config.py
   trunk/cherrypy/src/server.py
Modified:
   trunk/cherrypy/src/__init__.py
   trunk/cherrypy/src/controller.py

Log:
adjust to cherrypy >= 3.0.0

Modified: trunk/cherrypy/src/__init__.py
==============================================================================
--- trunk/cherrypy/src/__init__.py      (original)
+++ trunk/cherrypy/src/__init__.py      Fri Apr 27 15:37:52 2007
@@ -10,7 +10,7 @@
 #
 # -----------------------------------------------------------------------------
 # kaa.cherrypy - Web Framework for Kaa based on CherryPy
-# Copyright (C) 2006 Dirk Meyer
+# Copyright (C) 2006-2007 Dirk Meyer
 #
 # First Edition: Dirk Meyer <[EMAIL PROTECTED]>
 # Maintainer:    Dirk Meyer <[EMAIL PROTECTED]>
@@ -31,8 +31,29 @@
 #
 # -----------------------------------------------------------------------------
 
+# system cherrypy installation
+import cherrypy
+if int(cherrypy.__version__.split('.')[0]) < 3:
+    msg = 'CherryPy >= 3.0.0 required, %s found' % cherrypy.__version__
+    raise ImportError(msg)
+
+# kaa imports
+import kaa
+
 # kaa.cherrypy imports
 from version import VERSION
-from config import config
-from server import start
 from controller import expose, Template, template, thread_template
+
+config = cherrypy.config
+
+def start():
+    """
+    Start cherrypy server.
+    """
+    def _stop():
+        cherrypy.engine.stop()
+        cherrypy.server.stop()
+    cherrypy.server.quickstart()
+    cherrypy.engine.SIGHUP = cherrypy.engine.SIGTERM = None
+    cherrypy.engine.start(blocking=False)
+    kaa.notifier.signals['shutdown'].connect(_stop)

Modified: trunk/cherrypy/src/controller.py
==============================================================================
--- trunk/cherrypy/src/controller.py    (original)
+++ trunk/cherrypy/src/controller.py    Fri Apr 27 15:37:52 2007
@@ -88,11 +88,14 @@
     def decorator(func):
 
         def newfunc(self, *args, **kwargs):
-            _function = _execute_func
+            _function = func
             if mainloop and not is_mainthread():
-                _function = MainThreadCallback(_execute_func)
+                _function = MainThreadCallback(func)
                 _function.set_async(False)
-            return _function(self, template, engine, func, args, kwargs)
+            result = _function(self, *args, **kwargs)
+            if not template:
+                return result
+            return engine.parse(template, result)
 
         try:
             newfunc.func_name = func.func_name
@@ -105,19 +108,6 @@
     return decorator
 
 
-
-def _execute_func(self, filename, engine, func, args, kwargs):
-    """
-    Helper function to call the function and handle kid. This whole function
-    will be called from the main thread (when mainloop==True)
-    """
-    if not filename:
-        return func(self, *args, **kwargs)
-    return engine.parse(filename, func(self, *args, **kwargs))
-
-
-
-
 class Template(object):
     """
     A class wrapping a template. It has a __call__ function to execute

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to