Commit 13e7c56f authored by O'Reilly Media, Inc.'s avatar O'Reilly Media, Inc.
Browse files

Initial commit

parents
Loading
Loading
Loading
Loading

README.md

0 → 100644
+15 −0
Changes for README.md: 15 added lines, 0 removed lines.
Original line number Diff line number Diff line
## Example files for the title:  
  
# Web Applications with Python and the Pyramid Framework, by Paul Everitt
  
[![Web Applications with Python and the Pyramid Framework, by Paul Everitt](http://akamaicovers.oreilly.com/images/9781771374361/cat.gif)](https://www.safaribooksonline.com/library/view/title/9781771374361//)
  
The following applies to example files from material published by O’Reilly Media, Inc. Content from other publishers may include different rules of usage. Please refer to any additional usage rights explained in the actual example files or refer to the publisher’s website.
  
O'Reilly books are here to help you get your job done. In general, you may use the code in O'Reilly books in your programs and documentation. You do not need to contact us for permission unless you're reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from our books does not require permission. Answering a question by citing our books and quoting example code does not require permission. On the other hand, selling or distributing a CD-ROM of examples from O'Reilly books does require permission. Incorporating a significant amount of example code from our books into your product's documentation does require permission.
  
We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN.
  
If you think your use of code examples falls outside fair use or the permission given here, feel free to contact us at <permissions@oreilly.com>.
  
Please note that the examples are not production code and have not been carefully testing. They are provided "as-is" and come with no warranty of any kind.
+7 −0
Changes for Web Applications with Python and the Pyramid Framework - Working Files/Chapter 1/No Work Files.rtf: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf350
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\margl1440\margr1440\vieww9000\viewh8400\viewkind0
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural

\f0\fs24 \cf0 No work files for this lesson...}
 No newline at end of file
+32 −0
Changes for Web Applications with Python and the Pyramid Framework - Working Files/Chapter 2/Multiple Routes and Views/app.py: 32 added lines, 0 removed lines.
Original line number Diff line number Diff line
from wsgiref.simple_server import make_server
from pyramid.config import Configurator
from pyramid.view import view_config


@view_config(route_name='home_page', renderer='home.jinja2')
def home(request):
    return dict(site_name='MyApp')


@view_config(route_name='hello', renderer='hello_world.jinja2')
def hello_world(request):
    return dict()


@view_config(route_name='hello', renderer='hello_name.jinja2',
             request_param='name')
def hello_name(request):
    name = request.params.get('name')
    return dict(name=name)


if __name__ == '__main__':
    config = Configurator()
    config.include('pyramid_jinja2')
    config.add_route('home_page', '/')
    config.add_route('hello', '/hello')
    config.scan()
    app = config.make_wsgi_app()
    server = make_server('0.0.0.0', 6543, app)
    print('Serving at http://127.0.0.1:6543')
    server.serve_forever()
+2 −0
Changes for Web Applications with Python and the Pyramid Framework - Working Files/Chapter 2/Multiple Routes and Views/hello_name.jinja2: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
<h1>Hello</h1>
<p>Hi, <strong>{{ name }}</strong>.</p>
 No newline at end of file
+2 −0
Changes for Web Applications with Python and the Pyramid Framework - Working Files/Chapter 2/Multiple Routes and Views/hello_world.jinja2: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
<h1>Hello World</h1>
<p>Nothing appeared in the URL for ?name.</p>
 No newline at end of file
Loading