[Twisted-web] Re: Twisted-web Digest, Vol 19, Issue 22

Boh Yap bhyz00 at gmail.com
Mon Oct 24 14:24:57 MDT 2005


have since solved the problem.

I called the resource 'vwZMbr_detl' via a wrapper in the root resource
published as .tac. This wrapper was a child in the toplevel resorce.

In my class declaration for the wrapper, I did not inherit
resource.PostableResource, just 'resource.Resource', altho I had this
in the actual 'vwZMbr_detl' class.

below is the solution and parts of code, hope this helps somebody...

ie:

---start code snippet---
(ZMembr.tac)                                                          
<-- module that was published
   ....
   class  zoomMbr_detl(resource.Resource):     <-- the wrapper class that
                                                                      
                   called 'vwZMbr_detl' class

   class  zoomMbr_detl(resource.PostableResource):  <-- changed to this,
                                                                      
                              now works!
   ...
   class Toplevel(resource.Resource)             <-- top level resource
   ...

         child_vwZMbr_detl = zoomMbr_detl()     <--child of top-level resource

         def render(self, ctx)                                     <--
render mthd for top level
                                                                      
                 resource
               ....

site = server.Site(Toplevel())                             <--
boilerplate for publishing
                                                                      
               twisted resources.
from twisted.application import service, strports
application = service.Application("ZMembr")
webserver = strports.service('tcp:8780', http.HTTPFactory(site))
webserver.setServiceParent(application)

---end---



On 10/25/05, twisted-web-request at twistedmatrix.com
<twisted-web-request at twistedmatrix.com> wrote:
> Send Twisted-web mailing list submissions to
>         twisted-web at twistedmatrix.com
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
> or, via email, send a message with subject or body 'help' to
>         twisted-web-request at twistedmatrix.com
>
> You can reach the person managing the list at
>         twisted-web-owner at twistedmatrix.com
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Twisted-web digest..."
>
>
> Today's Topics:
>
>    1. Form POST to a twisted web2 Resource fails... (Boh Yap)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Mon, 24 Oct 2005 04:31:42 +0800
> From: Boh Yap <bhyz00 at gmail.com>
> Subject: [Twisted-web] Form POST to a twisted web2 Resource fails...
> To: twisted-web at twistedmatrix.com
> Message-ID:
>         <5ca6b3580510231331y1393e6bhf0d2b817676aa319 at mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> hi,
>
> I have recently (last 2 weeks) been working with twisted2 and web2.
> However when submitting a form using 'method="POST" ', I get this error:
>
>   The requested method POST is not supported by
> /vwZMbr_detl?mbr_id=6&listuse=edit&LOI=0.
>
> But when I use 'method="GET", its OK.
>
> I followed the example in the Twisted2 docs.
> <http://twistedmatrix.com/projects/web2/documentation/examples/demo.html>
>
> this is what I have in the HTML form:
> (vwZMbr_detl is the Resource thats suppose to process the Web form)
>
> --snip--
> <form method="POST" enctype="x-www-form-urlencoded">   <-- following
> example code
>
> ...error_msg: The requested method POST is not supported by
>                         /vwZMbr_detl?mbr_id=6&listuse=edit&LOI=0.
>
>
> <form action="vwZMbr_detl" method="POST">                         <--
> this doesnt work either!
>
>     error_msg:  The requested method POST is not supported by /vwZMbr_detl.
>
>
> <form action="vwZMbr_detl" method="get">                <-- this works !
> ...
> --snip--
>
> my resource has this:
>
>     class MyResc(resource.PostableResource):
>         ....
>           def render(self, ctx):
>        <-- reneder method to return a string
>                 ....
>
> further notes:
>  the code has been ported over from Twisted1.xx and web1, and is
> working fine as .rpy's (as beta but not yet deployed in pproduction)
>  Am porting over to Twisted2 and Web2 as starting on a new project, as
> might as well use the latest and greatest... is that advisable? Can
> someone pls advise if Twisted2 + Web2 is ready for production? The
> app. will have start off with reltively low volume, but may need to
> scale up qite quickly. Any advise will be appreciated.
>
>
> I've dug around but cannot seem to find a solution,  and any help will
> be appreciated....
>
> thanks,
>
> Boh Yap
> bhyz at mac.com
>
>
>
> ------------------------------
>
> _______________________________________________
> Twisted-web mailing list
> Twisted-web at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
>
>
> End of Twisted-web Digest, Vol 19, Issue 22
> *******************************************
>
'



More information about the Twisted-web mailing list