web2py_manual_5th.pdf

(6581 KB) Pobierz
MASSIMODIPIERRO
WEB2PY
COMPLETEREFERENCEMANUAL,5THEDITION
EXPERTS4SOLUTIONS
Copyright2008-2013by Massimo Di Pierro. All rights reserved.
THE CONTENT OF THIS BOOK IS PROVIDED UNDER THE TERMS OF THE CREATIVE
COMMONS PUBLIC LICENSE BY-NC-ND3.0.
THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY
USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPY-
RIGHT LAW IS PROHIBITED.
BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND
AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LI-
CENSE MAY BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU
THE RIGHTS CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF
SUCH TERMS AND CONDITIONS.
Limit of Liability/Disclaimer of Warranty: While the publisher and author have used their
best efforts in preparing this book, they make no representations or warranties with respect
to the accuracy or completeness of the contents of this book and specifically disclaim any
implied warranties of merchantability or fitness for a particular purpose. No warranty
may be created ore extended by sales representatives or written sales materials. The advice
and strategies contained herein may not be suitable for your situation. You should consult
with a professional where appropriate. Neither the publisher nor author shall be liable for
any loss of profit or any other commercial damages, including but not limited to special,
incidental, consequential, or other damages.
For more information about appropriate use of this material contact:
Massimo Di Pierro
School of Computing
DePaul University
243 S Wabash Ave
Chicago, IL 60604 (USA)
Email: massimo.dipierro@gmail.com
Library of Congress Cataloging-in-Publication Data:
ISBN:978-0-578-12021-8
Build Date: March3,2013
to my family
Contents
1 Introduction 23
1.1 Principles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
1.2 Web frameworks . . . . . . . . . . . . . . . . . . . . . . . . . 26
1.3 Model-View-Controller . . . . . . . . . . . . . . . . . . . . . . 28
1.4 Why web2py . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
1.5 Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
1.6 In the box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
1.7 About this book . . . . . . . . . . . . . . . . . . . . . . . . . . 37
1.8 Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
1.9 Contribute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
1.10Elements of style . . . . . . . . . . . . . . . . . . . . . . . . . 40
1.11License . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
1.12Acknowledgments
. . . . . . . . . . . . . . . . . . . . . . . . 42
2 The Python language 47
2.1 About Python . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
2.2 Starting up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
2.3 help, dir . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
2.4 Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
2.4.1 str . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
2.4.2 list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
2.4.3 tuple . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
2.4.4 dict . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
2.5 About indentation . . . . . . . . . . . . . . . . . . . . . . . . 55
2.6 for...in . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Zgłoś jeśli naruszono regulamin