new method not work after restart ladon-wsgi server only restart computer

Bug #819750 reported by romankrv
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ladon
Invalid
Undecided
jsgaarde

Bug Description

If i add new function

to class
for ex:

 @ladonize(rtype=unicode)
    def ViewI(self):
        return "Hello"
 --

and restart wsgi - server : like this:
 if __name__=='__main__':
    PROJECT_DIR = os.path.dirname(os.path.abspath(__file__))
    print PROJECT_DIR

    sys.path.insert(0, os.path.dirname(PROJECT_DIR))
    PROJECT_NAME = PROJECT_DIR.split('/')[-1]
    print "---"
    print PROJECT_NAME

    os.environ['DJANGO_SETTINGS_MODULE'] = "%s.settings" % PROJECT_NAME

    port = 8000
    application = LadonWSGIApplication(['MYGateway','Calculator'], ['.'])
    server = wsgiref.simple_server.make_server('', port , application)
    server.serve_forever()

and try to use new function

from suds.client import Client;
url = 'http://127.0.0.1:8000/TaleoGateway/soap/description'
client1 = Client(url)
client1.service.ViewInterviewww("EEE")

i get error:

client1.service.ViewInterviewww("EEE")
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (31, 0))

---------------------------------------------------------------------------
MethodNotFound Traceback (most recent call last)

/home/krv/PROJECTS/hv/<ipython console> in <module>()

/home/krv/VIRTUALENVS/LADON/lib/python2.6/site-packages/suds/client.pyc in __getattr__(self, name)
    297 else:
    298 port = default
--> 299 return getattr(port, name)
    300
    301 def __getitem__(self, name):

/home/krv/VIRTUALENVS/LADON/lib/python2.6/site-packages/suds/client.pyc in __getattr__(self, name)
    401 else:
    402 m = default
--> 403 return getattr(m, name)
    404
    405 def __getitem__(self, name):

/home/krv/VIRTUALENVS/LADON/lib/python2.6/site-packages/suds/client.pyc in __getattr__(self, name)
    492 @rtype: L{Method}
    493 """
--> 494 return self[name]
    495
    496 def __getitem__(self, name):

/home/krv/VIRTUALENVS/LADON/lib/python2.6/site-packages/suds/client.pyc in __getitem__(self, name)
    505 if m is None:
    506 qn = '.'.join((self.__qn, name))
--> 507 raise MethodNotFound, qn
    508 return Method(self.__client, m)
    509

MethodNotFound: Method not found: 'TaleoGateway.TaleoGateway.ViewInterviewww'

I work in virtualenvwrapper and pip and I created env as: mkvirtualenv --no-site-packages

Revision history for this message
jsgaarde (jakob-simon-gaarde) wrote :

The bug is not in Ladon but the way you use strings. When you ladonize a method to use unicode you must be sure to return that type:

# -*- coding: utf-8 -*-
from ladon.ladonizer import ladonize

class TaleoGateway(object):
        @ladonize(rtype=unicode)
        def ViewI(self):
                return unicode("Hello")

Best Regards
Jakob Simon-Gaarde

Changed in ladon:
assignee: nobody → jsgaarde (jakob-simon-gaarde)
Revision history for this message
jsgaarde (jakob-simon-gaarde) wrote :

Can you confirm this solved the problem?

Revision history for this message
romankrv (romankrv) wrote :

Yes it is resolved

Changed in ladon:
status: New → Invalid
Revision history for this message
romankrv (romankrv) wrote :

sorry for repat but --> I try agian add new method like :
 @ladonize(rtype=unicode)
        def ViewI(self):
                return unicode("Hello")

but it work only restart computer

Please who fix it?

Thanks !

Changed in ladon:
status: Invalid → New
status: New → In Progress
Revision history for this message
jsgaarde (jakob-simon-gaarde) wrote :

Please paste the whole source if it is large then attach it as a file.

Revision history for this message
romankrv (romankrv) wrote :

from ladon.ladonizer import ladonize
from ladon.types.ladontype import LadonType

from django.contrib.auth import models

from django.contrib.auth import authenticate
from django.contrib.auth.models import Permission

class CommonResult(LadonType):
        res_code = int
        #res_msg = unicode
        #res_details = unicode

class TaleoGateway(object):
    """
    Service for customers of TaleoGateway that proivdes some methods ...
    """

    @ladonize(unicode, rtype=unicode)
    def RequestInterview(self, requestXml):
        return " %(requestXml)s --> RequestInterview" % locals()

    @ladonize(unicode, rtype=unicode)
    def ViewInterview(self, requestXml):
        return "%(requestXml)s --> ViewInterview" % locals()

    @ladonize(int, rtype=CommonResult)
    def login_test(self, pos):
       # data = Permission.objects.all()[pos].name
        m = models.User.objects.get(pk=int(pos)).email
        #user = authenticate(username=username, password=password)
        return #user.is_staff

    @ladonize(int,int,rtype=int)
    def add(self,a,b):
        return a+b
------------------------------

i add new def add(self,a,b): but it not work only after restart computer

Thanks

Revision history for this message
jsgaarde (jakob-simon-gaarde) wrote :

ViewInterview and RequestInterview both should return unicode strings but they don't. The add function should work. It would be nice if you sent the exception that Ladon produces.

Best regards
Jakob Simon-Gaarde

Changed in ladon:
status: In Progress → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

  • ladon: e

Remote bug watches

Bug watches keep track of this bug in other bug trackers.