Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- from ladon.ladonizer import ladonize
- from ladon.types.ladontype import LadonType
- from ladon.types.typeconverter import TypeConverter
- import syslog
- class Group(LadonType):
- cn = str
- name = str
- description = str
- numbers = [int]
- class Person(LadonType):
- uid = str
- name = str
- age = int
- groups = [Group]
- class PersonResponse(LadonType):
- person = unicode
- name = str
- height = [float]
- groups = [Group]
- class MyService:
- @ladonize(int,str,[Person],str, rtype=PersonResponse,allow_unsafe_conversion=False,encoding='utf-8')
- def adduser(self,id,desc,users,is_public='wefwe',**kw):
- """Add a < user to the system. æøå
- Storage location is created aswell
- wpofkwpoef
- @param id: The user's ID
- @param desc:
- Some describing text
- Some more
- @param is_public:
- Mark whether the user should be visible to others or not.
- Second line of doc.
- owkefposdfwe
- @rtype: Line1
- Returns information about the result of the method
- """
- tc = TypeConverter('utf-8')
- response = PersonResponse()
- response.person = 'jakobsg'
- response.name = tc.from_unicode_string(u'Ærgelige Bendt',str)
- response.height = [185.3,23,543,625,423]
- g1 = Group({'cn':u'g1','name':u'Group1','description':u'1 group','numbers':[u'111',u'222',u'333']},tc=tc)
- g2 = Group()
- response.groups = [g1]#,g2]
- #return [1,2,3,4]
- return response
- @ladonize(rtype=str,encoding='UTF-8')
- def deluser(self):
- pass
- class MyService2:
- @ladonize(int,str,[Group],str, rtype=[str])
- def adduser(self,id,desc,users,is_public='wefwe',**kw):
- """Add a < user to the system.
- Storage location is created aswell
- wpofkwpoef
- @param id: The user's ID
- @param desc:
- Some describing text
- Some more
- @param is_public:
- Mark whether the user should be visible to others or not.
- Second line of doc.
- owkefposdfwe
- @rtype: Line1
- Returns information about the result of the method
- """
- return ['2']
- @ladonize(rtype=str)
- def deluser(self):
- pass
- #from ladon.ladonizer.collection import global_service_collection
- #s = global_service_collection().services_by_name("MyService")
- #print s[0].method('adduser')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement