Graham Dumpleton
graham.dumpleton at gmail.com
Thu Jan 7 21:52:57 EST 2010
2010/1/8 Doug Epling <depling at insightbb.com>: > Apparently I am having some kind of conflict with Apache modsec. Do the > following lines from the Apache error_log mean anything? Is this something > I need to take up with my distro, which is Fedora Core? Any help here will > be appreciated; I have spent at least two days on this. > > Thanks. > > [Thu Jan 07 19:36:59 2010] [notice] Apache/2.2.14 (Unix) DAV/2 > mod_python/3.3.1 Python/2.6.2 mod_ssl/2.2.14 OpenSSL/1.0.0-fips-beta4 > mod_wsgi/2.5 configured -- resuming normal operations > [Thu Jan 07 19:36:59 2010] [info] Server built: Dec 3 2009 10:25:53 > [Thu Jan 07 19:36:59 2010] [debug] prefork.c(1013): AcceptMutex: sysvsem > (default: sysvsem) > [Thu Jan 07 19:37:22 2010] [error] > /usr/lib/python2.6/site-packages/mod_python/importer.py:32: > DeprecationWarning: the md5 module is deprecated; use hashlib instead > [Thu Jan 07 19:37:22 2010] [error] import md5 > [Thu Jan 07 19:37:38 2010] [error] > /usr/lib/python2.6/site-packages/mod_python/importer.py:32: > DeprecationWarning: the md5 module is deprecated; use hashlib instead > [Thu Jan 07 19:37:38 2010] [error] import md5 The deprecation warning just shows that mod_python is way out of date. The warning shouldn't otherwise cause anything to fail. BTW, why if you are also loading mod_wsgi are you even trying to use mod_python. Why not use one of the WSGI frameworks such as Werkzeug or Django even and save yourself a lot of trouble. If you do use WSGI based solutions, just make sure you disable mod_python and only load mod_wsgi. Graham > On 01/07/2010 04:56 AM, Graham Dumpleton wrote: >> >> If you are getting a 403 forbidden error then you either haven't >> configured Apache correctly such that the mod_python URL you are using >> is a valid URL which can be accessed, that the specific URL is >> matching some pattern elsewhere in Apache which is denied for some >> reason, or, you have named your publisher handler with a leading >> underscore, which are private and therefore forbidden. >> >> You need to work out what is generating the 403, Apache or mod_python. >> >> Graham >> >> 2010/1/6 Doug Epling<depling at insightbb.com>: >> >>> >>> Why would I want to import apache, util? The request object created by >>> the >>> publisher automatically creates a FieldStorage object. So when I pass >>> the >>> request object, whether POST or GET, along with some other trivial data >>> the >>> python script on the server should simply take the data argument as a >>> parameter and return a page with it printed on it. Why doesn't the >>> apache >>> user have this permission? >>> >>> calling page: >>> >>> def index(): >>> s = """\ >>> <html> >>> <head></head> >>> <body> >>> <h2>Hello World!</h2> >>> >>> <form action="script/greet" method="GET"> >>> Name:<input type="text" name="name"><br> >>> <input type="submit"> >>> </form> >>> >>> </body> >>> </html> >>> """ >>> return s >>> >>> server script: >>> >>> def greet(req, name): >>> >>> return 'Hello %s' % name >>> >>> On 01/05/2010 09:40 PM, john burke wrote: >>> >>>> >>>> this should be all you really need. what you do with the data from >>>> request_data is your own business. >>>> >>>> from mod_python import apache, util >>>> >>>> def login(req): >>>> >>>> request_data = util.FieldStorage(req) >>>> >>>> logreqdata(req, request_data) >>>> >>>> qry = "SELECT u.user_id as id, u.user_name as name FROM users u" >>>> qry += " WHERE u.user_name = '" >>>> qry += request_data.getfirst("user_name") >>>> qry += "' AND u.user_pass ='" >>>> qry += request_data.getfirst("user_pass") >>>> qry += "'" >>>> return dorequest(req, qry, "users", "user").toxml("utf-8") >>>> >>>> def logreqdata(req, data): >>>> >>>> if (DEBUG> 0): >>>> >>>> >>>> >>>> apache.log_error("********************************************************") >>>> apache.log_error(str(req.parsed_uri)) >>>> apache.log_error(str(data)) >>>> >>>> in this case you can imagine that the the dorequest method knows how to >>>> query a database (eg. some database is also imported), and that in this >>>> instance it returns xml of the form: >>>> >>>> <users> >>>> <user> >>>> <id>1</id> >>>> <name>john smith</name> >>>> </user> >>>> </users> >>>> >>>> unless it doesn't find the user, in which case it returns an error. the >>>> logrequestdata function logs the url that was called and the data it was >>>> passed. it might look like this: >>>> >>>> [Sun Sep 20 13:25:37 2009] [error] >>>> ******************************************************** >>>> [Sun Sep 20 13:25:37 2009] [error] (None, None, None, None, None, None, >>>> '/site/python/site.py/login', 'user_name=user&user_pass=pass', None) >>>> [Sun Sep 20 13:25:37 2009] [error] {'user_name': [Field('user_name', >>>> 'user')], 'user_pass': [Field('user_pass', 'pass')]} >>>> >>>> based on this information you should be able to determine the proper url >>>> to call and process the passed data. >>>> >>>> good luck >>>> >>>> john >>>> >>>> >>>> Doug Epling wrote: >>>> >>>> >>>>> >>>>> Sorry, but I really need a boost here. I might be dense, but I can >>>>> not get a 'script.py' file with a greet(req, name) function to accept >>>>> either POST or GET arguments. I am getting a 403 Forbidden server >>>>> error. Where might I read about server side parameters? >>>>> >>>>> Thanks. >>>>> >>>>> Graham >>>>> From james at sindacio.us Fri Nov 13 02:45:00 2009 >>>>> From: james at sindacio.us (James Newton) >>>>> Date: Fri Nov 13 02:45:10 2009 >>>>> Subject: [mod_python] POST example? >>>>> In-Reply-To: >>>>> <c2f9e3c20911122342g58179609s1bb0046b24ac6240 at mail.gmail.com> >>>>> >>>>> References:<c2f9e3c20911122342g58179609s1bb0046b24ac6240 at mail.gmail.com> >>>>> >>>>> Message-ID:<c2f9e3c20911122345i3812ac58qc69974240f980a65 at mail.gmail.com> >>>>> >>>>> Hi, >>>>> >>>>> After looking around I can't seem to find a really straight forward >>>>> example >>>>> of how to POST, all I can seem to figure out is GET. Currently I'm >>>>> trying to >>>>> figure this out so I can post to a page with curl, rather then post via >>>>> a >>>>> form, after asking around and getting turned away with "don't use >>>>> mod_python" on most occasions, I was hoping someone on this list could >>>>> give >>>>> me an example of how to post/store post data. >>>>> >>>>> Thanks, >>>>> James Newton >>>>> -------------- next part -------------- >>>>> An HTML attachment was scrubbed... >>>>> URL: >>>>> >>>>> >>>>> http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20091113/8048f618/attachment.html >>>>> >>>>> From graham.dumpleton at gmail.com Fri Nov 13 04:26:17 2009 >>>>> From: graham.dumpleton at gmail.com (Graham Dumpleton) >>>>> Date: Fri Nov 13 04:26:26 2009 >>>>> Subject: [mod_python] POST example? >>>>> In-Reply-To: >>>>> <c2f9e3c20911122345i3812ac58qc69974240f980a65 at mail.gmail.com> >>>>> >>>>> References:<c2f9e3c20911122342g58179609s1bb0046b24ac6240 at mail.gmail.com> >>>>> <c2f9e3c20911122345i3812ac58qc69974240f980a65 at mail.gmail.com> >>>>> >>>>> Message-ID:<88e286470911130126m21222b57v8270616a602069ce at mail.gmail.com> >>>>> >>>>> Read: >>>>> >>>>> http://webpython.codepoint.net/mod_python_tutorial >>>>> >>>>> First result for Google on 'mod_python tutorial'. >>>>> >>>>> Graham >>>>> >>>>> 2009/11/13 James Newton<james at sindacio.us>: >>>>> >>>>> >>>>>> >>>>>> Hi, >>>>>> After looking around I can't seem to find a really straight forward >>>>>> >>>>>> >>>>> >>>>> example >>>>> >>>>> >>>>>> >>>>>> of how to POST, all I can seem to figure out is GET. Currently I'm >>>>>> >>>>>> >>>>> >>>>> trying to >>>>> >>>>> >>>>>> >>>>>> figure this out so I can post to a page with curl, rather then post >>>>>> >>>>>> >>>>> >>>>> via a >>>>> >>>>> >>>>>> >>>>>> form, after asking around and getting turned away with "don't use >>>>>> mod_python" on most occasions, I was hoping someone on this list >>>>>> >>>>>> >>>>> >>>>> could give >>>>> >>>>> >>>>>> >>>>>> me an example of how to post/store post data. >>>>>> Thanks, >>>>>> James Newton >>>>>> >>>>>> _______________________________________________ >>>>>> Mod_python mailing list >>>>>> Mod_python at modpython.org >>>>>> http://mailman.modpython.org/mailman/listinfo/mod_python >>>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>>> From clodoaldo.pinto.neto at gmail.com Fri Nov 13 05:56:08 2009 >>>>> From: clodoaldo.pinto.neto at gmail.com (Clodoaldo Neto) >>>>> Date: Fri Nov 13 05:56:12 2009 >>>>> Subject: Fwd: [mod_python] POST example? >>>>> In-Reply-To: >>>>> <a595de7a0911130107y1067a22exd498225e8aa4baf3 at mail.gmail.com> >>>>> >>>>> References:<c2f9e3c20911122342g58179609s1bb0046b24ac6240 at mail.gmail.com> >>>>> <c2f9e3c20911122345i3812ac58qc69974240f980a65 at mail.gmail.com> >>>>> <a595de7a0911130107y1067a22exd498225e8aa4baf3 at mail.gmail.com> >>>>> >>>>> Message-ID:<a595de7a0911130256i78bb0c99yce88dcbdca1c959f at mail.gmail.com> >>>>> >>>>> Forgot to post to the list. >>>>> >>>>> Clodoaldo >>>>> >>>>> ---------- Forwarded message ---------- >>>>> From: Clodoaldo Neto<clodoaldo.pinto.neto at gmail.com> >>>>> Date: 2009/11/13 >>>>> Subject: Re: [mod_python] POST example? >>>>> To: James Newton<james at sindacio.us> >>>>> >>>>> >>>>> 2009/11/13 James Newton<james at sindacio.us>: >>>>> >>>>> >>>>>> >>>>>> Hi, >>>>>> After looking around I can't seem to find a really straight forward >>>>>> >>>>>> >>>>> >>>>> example >>>>> >>>>> >>>>>> >>>>>> of how to POST, all I can seem to figure out is GET. Currently I'm >>>>>> >>>>>> >>>>> >>>>> trying to >>>>> >>>>> >>>>>> >>>>>> figure this out so I can post to a page with curl, rather then post >>>>>> >>>>>> >>>>> >>>>> via a >>>>> >>>>> >>>>>> >>>>>> form, after asking around and getting turned away with "don't use >>>>>> mod_python" on most occasions, I was hoping someone on this list >>>>>> >>>>>> >>>>> >>>>> could give >>>>> >>>>> >>>>>> >>>>>> me an example of how to post/store post data. >>>>>> >>>>>> >>>>> >>>>> You mean you can read data posted by an html form and can't do it when >>>>> it is posted by curl? If so show what is your curl code. >>>>> >>>>> If what you are looking for is how to read data posted by any means >>>>> read: >>>>> >>>>> http://webpython.codepoint.net/mod_python_tutorial >>>>> >>>>> Regards, Clodoaldo >>>>> >>>>> >>>>> >>>>>> >>>>>> Thanks, >>>>>> James Newton >>>>>> >>>>>> _______________________________________________ >>>>>> Mod_python mailing list >>>>>> Mod_python at modpython.org >>>>>> http://mailman.modpython.org/mailman/listinfo/mod_python >>>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>>> From clodoaldo.pinto.neto at gmail.com Fri Nov 13 05:56:23 2009 >>>>> From: clodoaldo.pinto.neto at gmail.com (Clodoaldo Neto) >>>>> Date: Fri Nov 13 05:56:25 2009 >>>>> Subject: Fwd: [mod_python] POST example? >>>>> In-Reply-To: >>>>> <c2f9e3c20911130153y4f16535bg2759654e7cf92c86 at mail.gmail.com> >>>>> >>>>> References:<c2f9e3c20911122342g58179609s1bb0046b24ac6240 at mail.gmail.com> >>>>> <c2f9e3c20911122345i3812ac58qc69974240f980a65 at mail.gmail.com> >>>>> <a595de7a0911130107y1067a22exd498225e8aa4baf3 at mail.gmail.com> >>>>> <c2f9e3c20911130153y4f16535bg2759654e7cf92c86 at mail.gmail.com> >>>>> >>>>> Message-ID:<a595de7a0911130256i6c82a8c4o1dfb199726e12a73 at mail.gmail.com> >>>>> >>>>> ---------- Forwarded message ---------- >>>>> From: James Newton<james at sindacio.us> >>>>> Date: 2009/11/13 >>>>> Subject: Re: [mod_python] POST example? >>>>> To: clodoaldo.pinto.neto at gmail.com >>>>> >>>>> >>>>> I may be misunderstanding it, I'm assuming POST and GET are handled >>>>> the exact same way? The curl command would be like so: curl -F >>>>> 'postvar=<-' http://url.tld/. I used the example on that website for a >>>>> get var, but using it for post just created another get? I may not >>>>> being reading into this right. >>>>> James >>>>> >>>>> On Fri, Nov 13, 2009 at 3:07 AM, Clodoaldo Neto >>>>> <clodoaldo.pinto.neto at gmail.com> wrote: >>>>> >>>>> >>>>>> >>>>>> 2009/11/13 James Newton<james at sindacio.us>: >>>>>> >>>>>> >>>>>>> >>>>>>> Hi, >>>>>>> After looking around I can't seem to find a really straight >>>>>>> >>>>>>> >>>>> >>>>> forward example >>>>> >>>>> >>>>>>> >>>>>>> of how to POST, all I can seem to figure out is GET. Currently I'm >>>>>>> >>>>>>> >>>>> >>>>> trying to >>>>> >>>>> >>>>>>> >>>>>>> figure this out so I can post to a page with curl, rather then >>>>>>> >>>>>>> >>>>> >>>>> post via a >>>>> >>>>> >>>>>>> >>>>>>> form, after asking around and getting turned away with "don't use >>>>>>> mod_python" on most occasions, I was hoping someone on this list >>>>>>> >>>>>>> >>>>> >>>>> could give >>>>> >>>>> >>>>>>> >>>>>>> me an example of how to post/store post data. >>>>>>> >>>>>>> >>>>>> >>>>>> You mean you can read data posted by an html form and can't do it when >>>>>> it is posted by curl? If so show what is your curl code. >>>>>> >>>>>> If what you are looking for is how to read data posted by any means >>>>>> >>>>>> >>>>> >>>>> read: >>>>> >>>>> >>>>>> >>>>>> http://webpython.codepoint.net/mod_python_tutorial >>>>>> >>>>>> Regards, Clodoaldo >>>>>> >>>>>> >>>>>> >>>>>>> >>>>>>> Thanks, >>>>>>> James Newton >>>>>>> >>>>>>> _______________________________________________ >>>>>>> Mod_python mailing list >>>>>>> Mod_python at modpython.org >>>>>>> http://mailman.modpython.org/mailman/listinfo/mod_python >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>> >>>>> _______________________________________________ >>>>> Mod_python mailing list >>>>> Mod_python at modpython.org >>>>> http://mailman.modpython.org/mailman/listinfo/mod_python >>>>> >>>>> >>>>> >>>>> >>>> >>>> >>> >>> _______________________________________________ >>> Mod_python mailing list >>> Mod_python at modpython.org >>> http://mailman.modpython.org/mailman/listinfo/mod_python >>> >>> > > _______________________________________________ > Mod_python mailing list > Mod_python at modpython.org > http://mailman.modpython.org/mailman/listinfo/mod_python >
|