Skip to content

Commit

Permalink
[svn] Fixed app globals issue, noticed by Matt Feifarek.
Browse files Browse the repository at this point in the history
--HG--
branch : trunk
  • Loading branch information
bbangert committed Jul 25, 2006
1 parent 74aa7a1 commit c252334
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions docs/getting_started.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ We can test the template project like this::
cd helloworld
paster serve --reload development.ini

Again Windows users may need a slightly longer version of the command with the path to their ``Scripts`` directory if they haven't followed the instructions in `Windows Notes <windowsnotes.txt>`_::
Again Windows users may need a slightly longer version of the command with the path to their ``Scripts`` directory if they haven't followed the instructions in `Windows Notes <windowsnotes.html>`_::

python "C:\Python24\Scripts\paster" serve --reload development.ini

Expand Down Expand Up @@ -281,14 +281,16 @@ Here is an example of using the ``g`` variable. First modify your ``lib/app_glob
def __init__(self, defaults, app, **extra):
self.message = 'Hello'

Then add this new method to the end of the ``helloworld/controllers/hello.py``:
Then add this new method to the end of the ``helloworld/controllers/hello.py``::

def app_globals_test(self):
resp = Response()
if g.message == 'Hello':
m.write(g.message)
resp.write(g.message)
g.message = 'Hello World!'
else:
m.write(g.message)
resp.write(g.message)
return resp

This time if you run the server and visit http://127.0.0.1:5000/hello/app_globals_test/ you should see the message ``Hello``. If you visit the page again the message will be changed to ``Hello World!`` and it will remain changed for all subsequent requests because the application global variable was modified on the first request.

Expand Down

0 comments on commit c252334

Please sign in to comment.