Code

Allow XMLRPC clients to fetch tracker schema.
authorstefan <stefan@57a73879-2fb5-44c3-a270-3262357dd7e2>
Fri, 19 Jun 2009 17:10:07 +0000 (17:10 +0000)
committerstefan <stefan@57a73879-2fb5-44c3-a270-3262357dd7e2>
Fri, 19 Jun 2009 17:10:07 +0000 (17:10 +0000)
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/roundup/trunk@4233 57a73879-2fb5-44c3-a270-3262357dd7e2

roundup/xmlrpc.py

index 0014df36428156f831878d80478d60144a3ab3a1..f41c6d6f5905cfde0fb8ce966f6346abac677892 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,7 +115,7 @@ 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: