diff options
| author | Gustavo Picon <tabo@tabo.pe> | 2012-04-03 00:02:27 -0500 |
|---|---|---|
| committer | Gustavo Picon <tabo@tabo.pe> | 2012-04-03 00:02:27 -0500 |
| commit | 0d9bf9db6e6a12dc1a94c0153723f67d33e57673 (patch) | |
| tree | 23e0b1a01a9515e833f7f7c83013dfc2262c46bd /cherrypy/tutorial | |
| parent | ef56af7d85746127e38b3d37c2c413e72d42a401 (diff) | |
| download | cherrypy-git-0d9bf9db6e6a12dc1a94c0153723f67d33e57673.tar.gz | |
Removed trailing whitespace from the codebase.
sed -i '' -e 's/ *$//' `find cherrypy -name '*.py'`
Diffstat (limited to 'cherrypy/tutorial')
| -rw-r--r-- | cherrypy/tutorial/__init__.py | 2 | ||||
| -rw-r--r-- | cherrypy/tutorial/tut02_expose_methods.py | 4 | ||||
| -rw-r--r-- | cherrypy/tutorial/tut03_get_and_post.py | 4 | ||||
| -rw-r--r-- | cherrypy/tutorial/tut04_complex_site.py | 14 | ||||
| -rw-r--r-- | cherrypy/tutorial/tut05_derived_objects.py | 12 | ||||
| -rw-r--r-- | cherrypy/tutorial/tut06_default_method.py | 6 | ||||
| -rw-r--r-- | cherrypy/tutorial/tut07_sessions.py | 8 | ||||
| -rw-r--r-- | cherrypy/tutorial/tut08_generators_and_yield.py | 12 | ||||
| -rw-r--r-- | cherrypy/tutorial/tut09_files.py | 10 | ||||
| -rw-r--r-- | cherrypy/tutorial/tut10_http_errors.py | 16 |
10 files changed, 44 insertions, 44 deletions
diff --git a/cherrypy/tutorial/__init__.py b/cherrypy/tutorial/__init__.py index c4e2c558..08c142c5 100644 --- a/cherrypy/tutorial/__init__.py +++ b/cherrypy/tutorial/__init__.py @@ -1,3 +1,3 @@ # This is used in test_config to test unrepr of "from A import B" -thing2 = object()
\ No newline at end of file +thing2 = object() diff --git a/cherrypy/tutorial/tut02_expose_methods.py b/cherrypy/tutorial/tut02_expose_methods.py index 600fca34..c17e9d29 100644 --- a/cherrypy/tutorial/tut02_expose_methods.py +++ b/cherrypy/tutorial/tut02_expose_methods.py @@ -8,12 +8,12 @@ handler. import cherrypy class HelloWorld: - + def index(self): # Let's link to another method here. return 'We have an <a href="showMessage">important message</a> for you!' index.exposed = True - + def showMessage(self): # Here's the important message! return "Hello world!" diff --git a/cherrypy/tutorial/tut03_get_and_post.py b/cherrypy/tutorial/tut03_get_and_post.py index 283477d5..6163b42a 100644 --- a/cherrypy/tutorial/tut03_get_and_post.py +++ b/cherrypy/tutorial/tut03_get_and_post.py @@ -18,7 +18,7 @@ class WelcomePage: <input type="submit" /> </form>''' index.exposed = True - + def greetUser(self, name = None): # CherryPy passes all GET and POST variables as method parameters. # It doesn't make a difference where the variables come from, how @@ -27,7 +27,7 @@ class WelcomePage: # You can define default parameter values as usual. In this # example, the "name" parameter defaults to None so we can check # if a name was actually specified. - + if name: # Greet the user! return "Hey %s, what's up?" % name diff --git a/cherrypy/tutorial/tut04_complex_site.py b/cherrypy/tutorial/tut04_complex_site.py index b4d820ed..9ced38dd 100644 --- a/cherrypy/tutorial/tut04_complex_site.py +++ b/cherrypy/tutorial/tut04_complex_site.py @@ -13,7 +13,7 @@ class HomePage: return ''' <p>Hi, this is the home page! Check out the other fun stuff on this site:</p> - + <ul> <li><a href="/joke/">A silly joke</a></li> <li><a href="/links/">Useful links</a></li> @@ -36,7 +36,7 @@ class LinksPage: # handler objects. Simply create them inside their __init__ # methods! self.extra = ExtraLinksPage() - + def index(self): # Note the way we link to the extra links page (and back). # As you can see, this object doesn't really care about its @@ -44,15 +44,15 @@ class LinksPage: # links exclusively. return ''' <p>Here are some useful links:</p> - + <ul> <li><a href="http://www.cherrypy.org">The CherryPy Homepage</a></li> <li><a href="http://www.python.org">The Python Homepage</a></li> </ul> - + <p>You can check out some extra useful links <a href="./extra/">here</a>.</p> - + <p>[<a href="../">Return</a>]</p> ''' index.exposed = True @@ -63,12 +63,12 @@ class ExtraLinksPage: # Note the relative link back to the Links page! return ''' <p>Here are some extra useful links:</p> - + <ul> <li><a href="http://del.icio.us">del.icio.us</a></li> <li><a href="http://www.mornography.de">Hendrik's weblog</a></li> </ul> - + <p>[<a href="../">Return to links page</a>]</p>''' index.exposed = True diff --git a/cherrypy/tutorial/tut05_derived_objects.py b/cherrypy/tutorial/tut05_derived_objects.py index 3d4ec9b1..2649bc6d 100644 --- a/cherrypy/tutorial/tut05_derived_objects.py +++ b/cherrypy/tutorial/tut05_derived_objects.py @@ -13,7 +13,7 @@ import cherrypy class Page: # Store the page title in a class attribute title = 'Untitled Page' - + def header(self): return ''' <html> @@ -23,13 +23,13 @@ class Page: <body> <h2>%s</h2> ''' % (self.title, self.title) - + def footer(self): return ''' </body> </html> ''' - + # Note that header and footer don't get their exposed attributes # set to True. This isn't necessary since the user isn't supposed # to call header or footer directly; instead, we'll call them from @@ -40,11 +40,11 @@ class Page: class HomePage(Page): # Different title for this page title = 'Tutorial 5' - + def __init__(self): # create a subpage self.another = AnotherPage() - + def index(self): # Note that we call the header and footer methods inherited # from the Page class! @@ -59,7 +59,7 @@ class HomePage(Page): class AnotherPage(Page): title = 'Another Page' - + def index(self): return self.header() + ''' <p> diff --git a/cherrypy/tutorial/tut06_default_method.py b/cherrypy/tutorial/tut06_default_method.py index fe24f380..3a4bd8ef 100644 --- a/cherrypy/tutorial/tut06_default_method.py +++ b/cherrypy/tutorial/tut06_default_method.py @@ -20,7 +20,7 @@ import cherrypy class UsersPage: - + def index(self): # Since this is just a stupid little example, we'll simply # display a list of links to random, made-up users. In a real @@ -31,7 +31,7 @@ class UsersPage: <a href="./lorenzo">Lorenzo Lamas</a><br/> ''' index.exposed = True - + def default(self, user): # Here we react depending on the virtualPath -- the part of the # path that could not be mapped to an object method. In a real @@ -45,7 +45,7 @@ class UsersPage: out = "Lorenzo Lamas, famous actor and singer!" else: out = "Unknown user. :-(" - + return '%s (<a href="./">back</a>)' % out default.exposed = True diff --git a/cherrypy/tutorial/tut07_sessions.py b/cherrypy/tutorial/tut07_sessions.py index 4b1386b4..26c3658b 100644 --- a/cherrypy/tutorial/tut07_sessions.py +++ b/cherrypy/tutorial/tut07_sessions.py @@ -12,16 +12,16 @@ import cherrypy class HitCounter: - + _cp_config = {'tools.sessions.on': True} - + def index(self): # Increase the silly hit counter count = cherrypy.session.get('count', 0) + 1 - + # Store the new value in the session dictionary cherrypy.session['count'] = count - + # And display a silly hit count message! return ''' During your current session, you've viewed this diff --git a/cherrypy/tutorial/tut08_generators_and_yield.py b/cherrypy/tutorial/tut08_generators_and_yield.py index a6fbdc24..2b33a9a7 100644 --- a/cherrypy/tutorial/tut08_generators_and_yield.py +++ b/cherrypy/tutorial/tut08_generators_and_yield.py @@ -11,24 +11,24 @@ import cherrypy class GeneratorDemo: - + def header(self): return "<html><body><h2>Generators rule!</h2>" - + def footer(self): return "</body></html>" - + def index(self): # Let's make up a list of users for presentation purposes users = ['Remi', 'Carlos', 'Hendrik', 'Lorenzo Lamas'] - + # Every yield line adds one part to the total result body. yield self.header() yield "<h3>List of users:</h3>" - + for user in users: yield "%s<br/>" % user - + yield self.footer() index.exposed = True diff --git a/cherrypy/tutorial/tut09_files.py b/cherrypy/tutorial/tut09_files.py index 4c8e5815..6a7b4a34 100644 --- a/cherrypy/tutorial/tut09_files.py +++ b/cherrypy/tutorial/tut09_files.py @@ -49,7 +49,7 @@ from cherrypy.lib import static class FileDemo(object): - + def index(self): return """ <html><body> @@ -63,7 +63,7 @@ class FileDemo(object): </body></html> """ index.exposed = True - + def upload(self, myFile): out = """<html> <body> @@ -72,7 +72,7 @@ class FileDemo(object): myFile mime-type: %s </body> </html>""" - + # Although this just counts the file length, it demonstrates # how to read large files in chunks instead of all at once. # CherryPy reads the uploaded file into a temporary file; @@ -83,10 +83,10 @@ class FileDemo(object): if not data: break size += len(data) - + return out % (size, myFile.filename, myFile.content_type) upload.exposed = True - + def download(self): path = os.path.join(absDir, "pdf_file.pdf") return static.serve_file(path, "application/x-download", diff --git a/cherrypy/tutorial/tut10_http_errors.py b/cherrypy/tutorial/tut10_http_errors.py index dfa57331..d8352e38 100644 --- a/cherrypy/tutorial/tut10_http_errors.py +++ b/cherrypy/tutorial/tut10_http_errors.py @@ -16,10 +16,10 @@ import cherrypy class HTTPErrorDemo(object): - + # Set a custom response for 403 errors. _cp_config = {'error_page.403' : os.path.join(curpath, "custom_error.html")} - + def index(self): # display some links that will result in errors tracebacks = cherrypy.request.show_tracebacks @@ -27,7 +27,7 @@ class HTTPErrorDemo(object): trace = 'off' else: trace = 'on' - + return """ <html><body> <p>Toggle tracebacks <a href="toggleTracebacks">%s</a></p> @@ -45,21 +45,21 @@ class HTTPErrorDemo(object): </body></html> """ % trace index.exposed = True - + def toggleTracebacks(self): - # simple function to toggle tracebacks on and off + # simple function to toggle tracebacks on and off tracebacks = cherrypy.request.show_tracebacks cherrypy.config.update({'request.show_tracebacks': not tracebacks}) - + # redirect back to the index raise cherrypy.HTTPRedirect('/') toggleTracebacks.exposed = True - + def error(self, code): # raise an error based on the get query raise cherrypy.HTTPError(status = code) error.exposed = True - + def messageArg(self): message = ("If you construct an HTTPError with a 'message' " "argument, it wil be placed on the error page " |
