Code

Correct initial- and end-handshakes for SSL
[roundup.git] / roundup / xmlrpc.py
index 0014df36428156f831878d80478d60144a3ab3a1..86c8f992b207e443bacbd101311b16c3b209bae2 100644 (file)
@@ -59,6 +59,14 @@ class RoundupInstance:
         self.actions = actions
         self.translator = translator
 
+    def schema(self):
+        s = {}
+        for c in self.db.classes:
+            cls = self.db.classes[c]
+            props = [(n,repr(v)) for n,v in cls.properties.items()]
+            s[c] = props
+        return s
+
     def list(self, classname, propname=None):
         cl = self.db.getclass(classname)
         if not propname:
@@ -107,11 +115,12 @@ class RoundupInstance:
         for key in props:
             if not self.db.security.hasPermission('Edit', self.db.getuid(), classname,
                                                   property=key):
-                raise Unauthorised('Permission to create %s denied'%classname)
+                raise Unauthorised('Permission to set %s.%s denied'%(classname, key))
 
         # do the actual create
         try:
             result = cl.create(**props)
+            self.db.commit()
         except (TypeError, IndexError, ValueError), message:
             raise UsageError, message
         return result
@@ -127,9 +136,11 @@ class RoundupInstance:
                 raise Unauthorised('Permission to edit %s of %s denied'%
                                    (p, designator))
         try:
-            return cl.set(itemid, **props)
+            result = cl.set(itemid, **props)
+            self.db.commit()
         except (TypeError, IndexError, ValueError), message:
             raise UsageError, message
+        return result
 
 
     builtin_actions = {'retire': actions.Retire}
@@ -154,7 +165,12 @@ class RoundupDispatcher(SimpleXMLRPCDispatcher):
     def __init__(self, db, actions, translator,
                  allow_none=False, encoding=None):
 
-        SimpleXMLRPCDispatcher.__init__(self, allow_none, encoding)
+        try:
+            # python2.5 and beyond
+            SimpleXMLRPCDispatcher.__init__(self, allow_none, encoding)
+        except TypeError:
+            # python2.4
+            SimpleXMLRPCDispatcher.__init__(self)
         self.register_instance(RoundupInstance(db, actions, translator))