Thursday, July 5, 2012

Re: Still need help with the 405....please

Is your code still the same as you posted earlier:
http://djangosnippets.org/snippets/2638/? And the error is occuring on
ln 28?

_Nik

On 7/5/2012 11:01 AM, Jeff Silverman wrote:
> The print output is:
>
> <type 'function'>
>
>
> On Jul 5, 1:38 pm, Nikolas Stevenson-Molnar <nik.mol...@consbio.org>
> wrote:
>> Hmmm, not sure about this one. Try printing out the type of
>> DjangoSoapApp before that line is called:
>>
>> print type(DjangoSoapApp)
>>
>> _Nik
>>
>> On 7/5/2012 5:20 AM, Jeff Silverman wrote:
>>
>>
>>
>>> Ok, I'm further along, I think. Now I'm getting the following
>>> response = super(DjangoSoapApp, self).__call__(environ,
>>> start_response)
>>> (Pdb) p start_response
>>> <function start_response at 0x25d1ed8>
>>> (Pdb) super(DjangoSoapApp, self).__call__(environ, start_response)
>>> *** TypeError: super() argument 1 must be type, not function
>>> On Jul 3, 3:47 pm, Nikolas Stevenson-Molnar <nik.mol...@consbio.org>
>>> wrote:
>>>> Looking at the soaplib source, it looks like it required requests to be
>>>> made using POST. If you're loading this in a web browser to test, then
>>>> you're making a GET request. Try making a POST request (using something
>>>> like Fiddler) instead.
>>>> https://github.com/soaplib/soaplib/blob/master/src/soaplib/core/serve...
>>>> (line 84/85)
>>>> _Nik
>>>> On 7/3/2012 12:20 PM, Jeff Silverman wrote:
>>>>> http://djangosnippets.org/snippets/2638/
>>>>> On Jul 3, 2:56 pm, Nikolas Stevenson-Molnar <nik.mol...@consbio.org>
>>>>> wrote:
>>>>>> Would you please provide a reference to the snippet or to your complete
>>>>>> code? It's hard to understand what's going on from this small bit.
>>>>>> _Nik
>>>>>> On 7/3/2012 11:33 AM, Jeff Silverman wrote:
>>>>>>> Thanks for the reply. Removing that did not change the result. Just
>>>>>>> an FYI, but I copied the code verbatim from the snippet. that's why I
>>>>>>> cannot understand what's going on. I continually get the405method
>>>>>>> not allowed error regardless.
>>>>>>> On Jul 3, 1:28 pm, Nikolas Stevenson-Molnar <nik.mol...@consbio.org>
>>>>>>> wrote:
>>>>>>>> I'm not sure that this is the problem, but typically constructors should
>>>>>>>> not have a return value. Try removing the "return" from your
>>>>>>>> DjangoSoapApp constructor.
>>>>>>>> _Nik
>>>>>>>> On 7/3/2012 6:32 AM, Jeff Silverman wrote:
>>>>>>>>> Below is the code from the views.py
>>>>>>>>> The405is retunred from the 'return super(DjangoSoapApp,
>>>>>>>>> self).__init__(Application(services, tns))' statement. I am using
>>>>>>>>> python 2.6, soaplib20 and django 1.3. I am struggling to understand
>>>>>>>>> what exactly is wrong here.
>>>>>>>>> class HelloWorldService(DefinitionBase):
>>>>>>>>> @soap(String,Integer,_returns=Array(String))
>>>>>>>>> def say_smello(self,name,times):
>>>>>>>>> results = []
>>>>>>>>> for i in range(0,times):
>>>>>>>>> results.append('Hello, %s'%name)
>>>>>>>>> return results
>>>>>>>>> class DjangoSoapApp(WSGIApplication):
>>>>>>>>> csrf_exempt = True
>>>>>>>>> def __init__(self, services, tns):
>>>>>>>>> """Create Django view for given SOAP soaplib services and
>>>>>>>>> tns"""
>>>>>>>>> return super(DjangoSoapApp,
>>>>>>>>> self).__init__(Application(services, tns))
>>>>>>>>> def __call__(self, request):
>>>>>>>>> django_response = HttpResponse()
>>>>>>>>> def start_response(status, headers):
>>>>>>>>> django_response.status_code = int(status.split(' ', 1)[0])
>>>>>>>>> for header, value in headers:
>>>>>>>>> django_response[header] = value
>>>>>>>>> response = super(DjangoSoapApp, self).__call__(request.META,
>>>>>>>>> start_response)
>>>>>>>>> django_response.content = '\n'.join(response)
>>>>>>>>> return django_response
>>>>>>>>> # the view to use in urls.py
>>>>>>>>> hello_world_service = DjangoSoapApp([HelloWorldService], '__name__')- Hide quoted text -
>>>>>>>> - Show quoted text -- Hide quoted text -
>>>>>> - Show quoted text -- Hide quoted text -
>>>> - Show quoted text -- Hide quoted text -
>> - Show quoted text -


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment