Advertisement
aldak

Ladon test WS

Feb 7th, 2012
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.04 KB | None | 0 0
  1. from ladon.ladonizer.decorator import ladonize
  2. from ladon.types.ladontype import LadonType
  3. from ladon.compat import PORTABLE_STRING
  4. import logging
  5.  
  6. logging.basicConfig(filename='/home/webhosting/ws.dev.savvy.cz/www/service/logs/test.log',level=logging.DEBUG)
  7.  
  8. class ContactType(LadonType):
  9.     ID = {
  10.           'type' : int,
  11.           'nullable' : True,
  12.           'doc' : "ID of contact type"
  13.           }
  14.     Name = {
  15.             'type' : PORTABLE_STRING,
  16.             'nullable' : True,
  17.             'doc' : "Name of contact type"
  18.             }
  19.  
  20. class Contact(LadonType):
  21.     ID = {
  22.           'type' : int,
  23.           'nullable' : True,
  24.           'doc' : "ID of contact type"
  25.           }
  26.    
  27.     contactType = ContactType
  28.  
  29. class TestLadon(object):
  30.     '''
  31.    Test ladon webservice
  32.    '''
  33.  
  34.     @ladonize(Contact, rtype = PORTABLE_STRING)
  35.     def test(self, contact):
  36.         logging.debug(contact.contactType)
  37.         logging.debug(contact.contactType.ID)
  38.         logging.debug(contact.contactType.Name)
  39.         return "test"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement