Changeset 9632 for main


Ignore:
Timestamp:
14 Nov 2012, 18:38:31 (12 years ago)
Author:
uli
Message:

Provide XMLRPC services. We start with a student_id service.

Location:
main/waeup.kofa/trunk
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/webservices.py

    r9507 r9632  
    8080    def render(self):
    8181        return self.output
     82
     83class XMLRPCPermission(grok.Permission):
     84    """Permission for using XMLRPC functions.
     85    """
     86    grok.name('waeup.xmlrpc')
     87
     88class UniversityXMLRPC(grok.XMLRPC):
     89    """XMLRPC webservices for KOFA portals.
     90
     91    Please note, that XMLRPC does not support real keyword arguments
     92    but positional arguments only.
     93    """
     94    grok.context(IUniversity)
     95
     96    @grok.require('waeup.Public')
     97    def xmlrpc_api_version(self):
     98        """Return the current API version for XMLRPC clients.
     99        """
     100        return u'0.1'
     101
     102    @grok.require('waeup.xmlrpc')
     103    def get_student_id(self, reg_number=None):
     104        """Get the id of a student with registration number `reg_number`.
     105
     106        Returns the student id as string if successful, ``None`` else.
     107        """
     108        if reg_number is not None:
     109            cat = getUtility(ICatalog, name='students_catalog')
     110            result = list(
     111                cat.searchResults(reg_number=(reg_number, reg_number),
     112                                  _limit=1))
     113            if not len(result):
     114                return None
     115            return result[0].student_id
     116        return None
  • main/waeup.kofa/trunk/versions.cfg

    r8359 r9632  
    3434# for support of unicode encoded passwords
    3535zope.password = 3.6.1
     36# include bugfix for hanging xmlrpcrequests under paster
     37zope.publisher = 3.12.2
Note: See TracChangeset for help on using the changeset viewer.