cherrypy

returning xml documents from cherrypy

I am new to web programming and am trying to return an xml document from the cherrypy web server. But, what I see in the browser is a string value stripped off all the xml tags. i.e. <Foo> <Val1> </Foo> <Bar> <Val2> </Bar> shows up in the browser as Val1 Val2 I am sure that I am generating the document correctly but somewhere a...

CherryPy - saving checkboxes selection to variables

Hi. I'm trying to build a simple webpage with multiple checkboxes, a Textbox and a submit buttom. I've just bumped into web programing in Python and am trying to figure out out to do it with CherryPy. I need to associate each checkbox to a variable so my .py file knows which ones were selected when clicking the 'Start button'. Can som...

Can logging and CherryPy share the same config file?

Both the Python logging module and CherryPy's Config API use ConfigParser files. Therefore, I assumed that I could use one single config file for my own applications configuration, it's logging configuration, and CherryPy's configuration. When my logging and CherryPy were separate, they worked fine, and my config file does parse with n...

How to determine if CherryPy is caching responses?

Is it possible that CherryPy, in its default configuration, is caching the responses to one or more of my request handlers? And, if so, how do I turn that off? ...

Memory consumption in Cherrypy

I am using Cherrypy in a RESTful web service and server returns XML as a result (lxml is being used to create XML). Some of those XMLs are quite large. I have noticed that memory is not being released after such request (that return large XML) has been processed. So, I have isolated a problem and created this one very short dummy examp...

How to receive JSON in a POST request in CherryPy?

How to receive JSON from POST requests in CherryPy? I've been to this page http://goo.gl/t4hI [docs.cherrypy.org], and though it does a good job explaining the API, its parameters, and what it does; I can't seem to figure out how to use them to parse the incoming JSON into an object. Here's what I have so far: import cherrypy imp...

Selecting a Python Web Framework

Hello everybody. This may seem like a subjective question. But it is not (that's not the idea, at least). I'm developing an Advertising software (like AdWords, AdBrite, etc) and i've decide to use Python. And would like to use one of those well known web frameworks (Django, Cherrypy, pylons, etc). The question is: Given that it will ...

403 error when trying to run CherryPy behind Apache

I am trying to run CherryPy behind Apache using mod_rewrite, as described in the CherryPy documentation (BehindApache, ModRewrite), and it is not working. Edit: Earlier, my description of this problem was somewhat inaccurate. It seems like I forgot to restart Apache during some of my attempts. I have revised the question significantly. ...

URL Builder for CherryPy

After using werkzeug as a web framework (which is great and simple, but doesnt support some features), i'm now trying cherrypy. Now what I miss in cherrypy is werkzeug's elegant way of building urls (e.g. for links in templates) using the name of a decorated function like this: @expose('/archive/<int:year>/<int:month>') def archive(req...

Handling HTTP/1.1 Upgrade requests in CherryPy

I'm using CherryPy for a web server, but would like it to handle HTTP/1.1 Upgrade requests. Thus, when a client sends: OPTIONS * HTTP/1.1 Upgrade: NEW_PROTOCOL/1.0 Connection: Upgrade I'd like the server to hand the connection off to some NEW_PROTOCOL handler after responding with the necessary HTTP/1.1 101 Switching Protocols..., as...

django.contrib.admin like application for cherrypy

Is there a django.contrib.admin like app / module for cherrypy? I really like the simplicity of cherrypy, but it would be nice, to have the user authentication and password management type things taken care of... Or is it possible to run a cherrypy application behind the django admin app ? ...

cherrypy session disappears on transparent redirect

I have a checkout page that uses the braintree payment api. It works by submitting the credit card form directly to braintree's servers, at which point they are redirected to my 'confirm' page. This is detailed here, if you are curious. The cart is stored in-session. If I trace the session data right before I serve the checkout form......

How do I cleanly bridge client connections between a frontend webserver and a backend running CherryPy?

The title may be a bit vague, but here's my goal: I have a frontend webserver which takes incoming HTTP requests, does some preprocessing on them, and then passes the requests off to my real webserver to get the HTTP response, which is then passed back to the client. Currently, my frontend is built off of BaseHTTPServer.HTTPServer and ...

Why are CherryPy object attributes persistent between requests?

I was writing debugging methods for my CherryPy application. The code in question was (very) basically equivalent to this: import cherrypy class Page: def index(self): try: self.body += 'okay' except AttributeError: self.body = 'okay' return self.body index.exposed = True cherryp...

How does CherryPy caching work?

I recently discovered that page object attributes in CherryPy are persistent between requests (and between clients). So I'm wondering, would it make sense to store page output in such an attribute? Like this: class Page: def default(self, pagenumber): if pagenumber not in self.validpages: return 'Page number not ...

CherryPy combine file and dictionary based configuration

I'm setting up a CherryPy application and would like to have the majority of my configuration settings in a .conf file like this: [global] server.socketPort = 8080 server.threadPool = 10 server.environment = "production" However I would also like to setup a few with a dictionary in code like this: conf = {'/': {'tools.staticdir.on': ...

In mako template: call python function within html string

How do I do this in mako: <%! import cherrypy %> ... <link rel="stylesheet" href="${cherrypy.url('/media/layout.css')}" type="text/css" /> AttributeError: 'Undefined' object has no attribute 'url' edit Solved ...

CherryPy Logging: How do I configure and use the global and application level loggers?

Hello all. I'm having trouble with logging. I'm running CherryPy 3.2 and I've been reading through the docs here, but haven't found any examples of how to configure a local log file for output and how to write to it. Raspberry.py: import socket import sys import cherrypy app_roots = { # Sean's laptop dev environmen...