1. ramkalari
  2. CherryPy


Jason R. Coombs  committed 5755606

Corrected URL in example. Fixes #1125

  • Participants
  • Parent commits 97d9798
  • Branches default

Comments (0)

Files changed (1)

File sphinx/source/concepts/dispatching.rst

View file
     request content. All of these implementation-specific issues are hidden
     behind the Web interface; their nature cannot be assumed by a client that
     only has access through the Web interface.
     `Roy Fielding <http://www.ics.uci.edu/~fielding/pubs/dissertation/evaluation.htm>`_
 When you wish to serve a resource on the Web, you never actually serve the
 ``root.some.page`` object. If this object is exposed (or alternatively, its
 ``index`` method is), it will be called for that URL.
-In our HelloWorld example, adding the ``http://onepage/`` mapping
+In our HelloWorld example, adding the ``http://localhost/onepage/`` mapping
 to ``OnePage().index`` could be done like this::
     class OnePage(object):
     class HelloWorld(object):
         onepage = OnePage()
         def index(self):
             return "hello world"
         index.exposed = True
     def foo(self):
         return 'Foo!'
     foo.exposed = True
     root.foo = foo
 In the example, ``root.foo`` contains a function object, named ``foo``. When
     <form action="doLogin" method="post">
-        <input type="text" name="username" value="" 
+        <input type="text" name="username" value=""
             size="15" maxlength="40"/>
-        <input type="password" name="password" value="" 
+        <input type="password" name="password" value=""
             size="10" maxlength="40"/>
         <p><input type="submit" value="Login"/></p>
         <p><input type="reset" value="Clear"/></p>
         def blog(self, year, month, day):
         blog.exposed = True
     root = Root()
 So the URL above will be mapped as a call to::
         def default(self, year, month, day):
         default.exposed = True
     class Root: pass
     root = Root()
     root.blog = Blog()
     class PageHandler(object):
         """Callable which sets response.body."""
         def __init__(self, callable, *args, **kwargs):
             self.callable = callable
             self.args = args
             self.kwargs = kwargs
         def __call__(self):
             return self.callable(*self.args, **self.kwargs)