Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1030)

Unified Diff: third_party/cherrypy/scaffold/__init__.py

Issue 9368042: Add CherryPy to third_party. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build/
Patch Set: '' Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/cherrypy/process/wspbus.py ('k') | third_party/cherrypy/scaffold/apache-fcgi.conf » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/cherrypy/scaffold/__init__.py
===================================================================
--- third_party/cherrypy/scaffold/__init__.py (revision 0)
+++ third_party/cherrypy/scaffold/__init__.py (revision 0)
@@ -0,0 +1,61 @@
+"""<MyProject>, a CherryPy application.
+
+Use this as a base for creating new CherryPy applications. When you want
+to make a new app, copy and paste this folder to some other location
+(maybe site-packages) and rename it to the name of your project,
+then tweak as desired.
+
+Even before any tweaking, this should serve a few demonstration pages.
+Change to this directory and run:
+
+ ../cherryd -c site.conf
+
+"""
+
+import cherrypy
+from cherrypy import tools, url
+
+import os
+local_dir = os.path.join(os.getcwd(), os.path.dirname(__file__))
+
+
+class Root:
+
+ _cp_config = {'tools.log_tracebacks.on': True,
+ }
+
+ def index(self):
+ return """<html>
+<body>Try some <a href='%s?a=7'>other</a> path,
+or a <a href='%s?n=14'>default</a> path.<br />
+Or, just look at the pretty picture:<br />
+<img src='%s' />
+</body></html>""" % (url("other"), url("else"),
+ url("files/made_with_cherrypy_small.png"))
+ index.exposed = True
+
+ def default(self, *args, **kwargs):
+ return "args: %s kwargs: %s" % (args, kwargs)
+ default.exposed = True
+
+ def other(self, a=2, b='bananas', c=None):
+ cherrypy.response.headers['Content-Type'] = 'text/plain'
+ if c is None:
+ return "Have %d %s." % (int(a), b)
+ else:
+ return "Have %d %s, %s." % (int(a), b, c)
+ other.exposed = True
+
+ files = cherrypy.tools.staticdir.handler(
+ section="/files",
+ dir=os.path.join(local_dir, "static"),
+ # Ignore .php files, etc.
+ match=r'\.(css|gif|html?|ico|jpe?g|js|png|swf|xml)$',
+ )
+
+
+root = Root()
+
+# Uncomment the following to use your own favicon instead of CP's default.
+#favicon_path = os.path.join(local_dir, "favicon.ico")
+#root.favicon_ico = tools.staticfile.handler(filename=favicon_path)
Property changes on: third_party/cherrypy/scaffold/__init__.py
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « third_party/cherrypy/process/wspbus.py ('k') | third_party/cherrypy/scaffold/apache-fcgi.conf » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698