]> git.decadent.org.uk Git - dak.git/blobdiff - daklib/dbconn.py
Wrap __doc__ and func_name in @session_wrapper.
[dak.git] / daklib / dbconn.py
index c2de12cecc5553a1aeeb8302f42ee8f70f602dee..905bc47d081e5445228f250a13e951353fa943dd 100755 (executable)
@@ -64,7 +64,7 @@ def session_wrapper(fn):
         session = kwargs.get('session')
 
         # No session specified as last argument or in kwargs, create one.
-        if session is None and len(args) == len(getargspec(fn)[0]) - 1:
+        if session is None or len(args) == len(getargspec(fn)[0]) - 1:
             private_transaction = True
             kwargs['session'] = DBConn().session()
 
@@ -75,6 +75,9 @@ def session_wrapper(fn):
                 # We created a session; close it.
                 kwargs['session'].close()
 
+    wrapped.__doc__ = fn.__doc__
+    wrapped.func_name = fn.func_name
+
     return wrapped
 
 ################################################################################
@@ -1426,6 +1429,7 @@ class Queue(object):
                 # TODO: Move into database as above
                 if conf.FindB("Dinstall::SecurityQueueBuild"):
                     # Copy it since the original won't be readable by www-data
+                    import utils
                     utils.copy(src, dest)
                 else:
                     # Create a symlink to it