[PDF] web2py8.5plus3minus4plus24plus2minus2Complete Reference





Previous PDF Next PDF



Bases de datos

particularidades de MySQL y PostgreSQL mediante ejemplos y casos prácticos. Conexión y uso de bases de datos en lenguaje PHP ... DATE TIME y TIMESTAMP:.



Learning PHP MySQL & JavaScript

%20MySQL%20%26%20JavaScript_%20with%20jQuery



Comandos básicos de MYSQL

a)ADD INDEX [nombre _ índice][columna _ índice]: añade un índice a la tabla basado en la columna especificada. Si se especifican varias columnas deben ir 



web2py8.5plus3minus4plus24plus2minus2Complete Reference

3.4.1 On date datetime and time format . 22 web2py complete reference manual



MERIT Master Thesis

15.1 Manual of command line Loudness meter . Output wave format. ... We have used the following MySQL connectors in order to insert and query data to ...



Beginning PHP and MySQL E-Commerce: From Novice to

This book is a practical step-by-step PHP and MySQL tutorial that teaches you real-world is to mix PHP instructions with HTML because PHP doesn't have



Jump Start PHP

damages to be caused either directly or indirectly by the instructions contained in this book Install and switch Apache



Database Management System Laboratory

To learn Relational Database (Open source) such as MongoDB/ Oracle/MySQL/SQL This looks like the previous DATETIME format only without the hyphens.



PHP & MySQL: Novice to Ninja 6th Edition

Aug 9 2019 An ? indicates a line break that exists for formatting ... manual installation



Tutorial de SQL

cualquier tipo de base de datos (MS Access SQL Server

web2py8.5plus3minus4plus24plus2minus2Complete Reference

MASSIMO DI PIERRO

WEB2PY

COMPLETE REFERENCE MANUAL, 5TH EDITION

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

1Introduction23

1.1Principles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .25

1.2Web frameworks . . . . . . . . . . . . . . . . . . . . . . . . .26

1.3Model-View-Controller . . . . . . . . . . . . . . . . . . . . . .28

1.4Why web2py . . . . . . . . . . . . . . . . . . . . . . . . . . . .31

1.5Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .33

1.6In the box . . . . . . . . . . . . . . . . . . . . . . . . . . . . .36

1.7About this book . . . . . . . . . . . . . . . . . . . . . . . . . .37

1.8Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .39

1.9Contribute . . . . . . . . . . . . . . . . . . . . . . . . . . . . .40

1.10Elements of style . . . . . . . . . . . . . . . . . . . . . . . . .40

1.11License . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .41

1.12Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . .42

2The Python language47

2.1About Python . . . . . . . . . . . . . . . . . . . . . . . . . . .47

2.2Starting up . . . . . . . . . . . . . . . . . . . . . . . . . . . . .48

2.3help, dir . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .49

2.4Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .50

2.4.1str. . . . . . . . . . . . . . . . . . . . . . . . . . . . .50

2.4.2list. . . . . . . . . . . . . . . . . . . . . . . . . . . . .51

2.4.3tuple. . . . . . . . . . . . . . . . . . . . . . . . . . . .52

2.4.4dict. . . . . . . . . . . . . . . . . . . . . . . . . . . . .53

2.5About indentation . . . . . . . . . . . . . . . . . . . . . . . .55

2.6for...in. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .55

6

2.7while. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .56

2.8if...elif...else. . . . . . . . . . . . . . . . . . . . . . . . . .57

2.9try...except...else...finally. . . . . . . . . . . . . . . . . .57

2.10def...return. . . . . . . . . . . . . . . . . . . . . . . . . . . .59

2.10.1lambda. . . . . . . . . . . . . . . . . . . . . . . . . . .62

2.11class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .63

2.12Special attributes, methods and operators . . . . . . . . . . .65

2.13File input/output . . . . . . . . . . . . . . . . . . . . . . . . .66

2.14exec,eval. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .67

2.15import. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .67

2.15.1os. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .68

2.15.2sys. . . . . . . . . . . . . . . . . . . . . . . . . . . . .69

2.15.3datetime. . . . . . . . . . . . . . . . . . . . . . . . . .69

2.15.4time. . . . . . . . . . . . . . . . . . . . . . . . . . . . .70

2.15.5cPickle. . . . . . . . . . . . . . . . . . . . . . . . . . .70

3Overview73

3.1Startup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .73

3.2Simple examples . . . . . . . . . . . . . . . . . . . . . . . . .77

3.2.1Say hello . . . . . . . . . . . . . . . . . . . . . . . . . .77

3.2.2Debugging toolbar . . . . . . . . . . . . . . . . . . . .82

3.2.3Let"s count . . . . . . . . . . . . . . . . . . . . . . . . .82

3.2.4Say my name . . . . . . . . . . . . . . . . . . . . . . .83

3.2.5Postbacks . . . . . . . . . . . . . . . . . . . . . . . . .85

3.2.6Internationalization . . . . . . . . . . . . . . . . . . .88

3.3An image blog . . . . . . . . . . . . . . . . . . . . . . . . . . .89

3.3.1Adding authentication . . . . . . . . . . . . . . . . . .103

3.3.2Adding grids . . . . . . . . . . . . . . . . . . . . . . .105

3.3.3Configuring the layout . . . . . . . . . . . . . . . . . .107

3.4A simple wiki . . . . . . . . . . . . . . . . . . . . . . . . . . .108

3.4.1Ondate,datetimeandtimeformat . . . . . . . . . . .119

3.5The built-in web2py wiki . . . . . . . . . . . . . . . . . . . .120

3.5.1MARKMIN basics . . . . . . . . . . . . . . . . . . . .122

3.5.2Oembed protocol . . . . . . . . . . . . . . . . . . . . .123

3.5.3Referencing wiki content . . . . . . . . . . . . . . . .124

7

3.5.4Wiki menus . . . . . . . . . . . . . . . . . . . . . . . .125

3.5.5Service functions . . . . . . . . . . . . . . . . . . . . .125

3.5.6Extending the auth.wiki feature . . . . . . . . . . . .126

3.5.7Components . . . . . . . . . . . . . . . . . . . . . . . .127

3.6More onadmin. . . . . . . . . . . . . . . . . . . . . . . . . .128

3.6.1Site . . . . . . . . . . . . . . . . . . . . . . . . . . . . .128

3.6.2About . . . . . . . . . . . . . . . . . . . . . . . . . . .131

3.6.3Design . . . . . . . . . . . . . . . . . . . . . . . . . . .131

3.6.4Errors . . . . . . . . . . . . . . . . . . . . . . . . . . .135

3.6.5Mercurial . . . . . . . . . . . . . . . . . . . . . . . . .138

3.6.6Application Wizard (experimental) . . . . . . . . . .139

3.6.7Configuringadmin. . . . . . . . . . . . . . . . . . . .140

3.6.8Mobileadmin. . . . . . . . . . . . . . . . . . . . . . .142

3.7More onappadmin. . . . . . . . . . . . . . . . . . . . . . . .142

4The core145

4.1Command line options . . . . . . . . . . . . . . . . . . . . . .145

4.2Workflow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .149

4.3Dispatching . . . . . . . . . . . . . . . . . . . . . . . . . . . .152

4.4Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .155

4.5Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . .160

4.6API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .162

4.6.1Accessing the API from Python modules . . . . . . .163

4.7request. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .165

4.8response. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .170

4.9session. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .174

4.9.1Separate sessions . . . . . . . . . . . . . . . . . . . . .177

4.10cache. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .177

4.11URL. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .180

4.11.1Absolute urls . . . . . . . . . . . . . . . . . . . . . . .182

4.11.2Digitally signed urls . . . . . . . . . . . . . . . . . . .182

4.12HTTPandredirect. . . . . . . . . . . . . . . . . . . . . . . . .184

4.13Internationalization, and Pluralization withT. . . . . . . . .185

4.13.1Determining the language . . . . . . . . . . . . . . . .186

4.13.2Translating variables . . . . . . . . . . . . . . . . . . .188

8

4.13.3Comments and multiple translations . . . . . . . . .188

4.13.4Pluralization engine . . . . . . . . . . . . . . . . . . .189

4.13.5Translations, pluralization, and MARKMIN . . . . .191

4.14Cookies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .192

4.15Applicationinit. . . . . . . . . . . . . . . . . . . . . . . . . .193

4.16URL rewrite . . . . . . . . . . . . . . . . . . . . . . . . . . . .193

4.16.1Parameter-based system . . . . . . . . . . . . . . . . .194

4.16.2Pattern-based system . . . . . . . . . . . . . . . . . .196

4.16.3Routes on error . . . . . . . . . . . . . . . . . . . . . .200

4.16.4Static asset management . . . . . . . . . . . . . . . . .201

4.17Running tasks in the background . . . . . . . . . . . . . . . .204

4.17.1Cron . . . . . . . . . . . . . . . . . . . . . . . . . . . .205

4.17.2Homemade task queues . . . . . . . . . . . . . . . . .207

4.17.3Scheduler (experimental) . . . . . . . . . . . . . . . .208

4.18Third party modules . . . . . . . . . . . . . . . . . . . . . . .218

4.19Execution environment . . . . . . . . . . . . . . . . . . . . . .219

4.20Cooperation . . . . . . . . . . . . . . . . . . . . . . . . . . . .221

4.21Logging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .222

4.22WSGI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .223

4.22.1External middleware . . . . . . . . . . . . . . . . . . .223

4.22.2Internal middleware . . . . . . . . . . . . . . . . . . .224

4.22.3CallingWSGIapplications . . . . . . . . . . . . . . .224

5The views227

5.1Basic syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . .229

5.1.1for...in. . . . . . . . . . . . . . . . . . . . . . . . . .229

5.1.2while. . . . . . . . . . . . . . . . . . . . . . . . . . . .230

5.1.3if...elif...else. . . . . . . . . . . . . . . . . . . . .230

5.1.4try...except...else...finally. . . . . . . . . . . . .231

5.1.5def...return. . . . . . . . . . . . . . . . . . . . . . . .232

5.2HTML helpers . . . . . . . . . . . . . . . . . . . . . . . . . . .233

5.2.1XML. . . . . . . . . . . . . . . . . . . . . . . . . . . . .235

5.2.2Built-in helpers . . . . . . . . . . . . . . . . . . . . . .236

5.2.3Custom helpers . . . . . . . . . . . . . . . . . . . . . .250

5.3BEAUTIFY. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .251

9

5.4Server-sideDOMand parsing . . . . . . . . . . . . . . . . . .252

5.4.1elements. . . . . . . . . . . . . . . . . . . . . . . . . .252

5.4.2components. . . . . . . . . . . . . . . . . . . . . . . . .254

5.4.3parentandsiblings. . . . . . . . . . . . . . . . . . . .254

5.4.4Replacing elements . . . . . . . . . . . . . . . . . . . .254

5.4.5flatten. . . . . . . . . . . . . . . . . . . . . . . . . .255

5.4.6Parsing . . . . . . . . . . . . . . . . . . . . . . . . . . .255

5.5Page layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . .255

5.5.1Default page layout . . . . . . . . . . . . . . . . . . .259

5.5.2Customizing the default layout . . . . . . . . . . . . .262

5.5.3Mobile development . . . . . . . . . . . . . . . . . . .263

5.6Functions in views . . . . . . . . . . . . . . . . . . . . . . . .264

5.7Blocks in views . . . . . . . . . . . . . . . . . . . . . . . . . .265

6The database abstraction layer267

6.1Dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . .267

6.2Connection strings . . . . . . . . . . . . . . . . . . . . . . . .269

6.2.1Connection pooling . . . . . . . . . . . . . . . . . . .271

6.2.2Connection failures . . . . . . . . . . . . . . . . . . . .272

6.2.3Replicated databases . . . . . . . . . . . . . . . . . . .272

6.3Reserved keywords . . . . . . . . . . . . . . . . . . . . . . . .272

6.4DAL,Table,Field. . . . . . . . . . . . . . . . . . . . . . . . . .273

6.5Record representation . . . . . . . . . . . . . . . . . . . . . .275

6.6Migrations . . . . . . . . . . . . . . . . . . . . . . . . . . . . .281

6.7Fixing broken migrations . . . . . . . . . . . . . . . . . . . .282

6.8insert. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .283

6.9commitandrollback. . . . . . . . . . . . . . . . . . . . . . . .284

6.10Raw SQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .285

6.10.1Timing queries . . . . . . . . . . . . . . . . . . . . . .285

6.10.2executesql. . . . . . . . . . . . . . . . . . . . . . . . .285

6.10.3_lastsql. . . . . . . . . . . . . . . . . . . . . . . . . .286

6.11drop. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .287

6.12Indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .287

6.13Legacy databases and keyed tables . . . . . . . . . . . . . . .287

6.14Distributed transaction . . . . . . . . . . . . . . . . . . . . . .288

10

6.15More on uploads . . . . . . . . . . . . . . . . . . . . . . . . .289

6.16Query,Set,Rows. . . . . . . . . . . . . . . . . . . . . . . . . . .290

6.17select. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .291

6.17.1Shortcuts . . . . . . . . . . . . . . . . . . . . . . . . . .293

6.17.2Fetching aRow. . . . . . . . . . . . . . . . . . . . . . .293

6.17.3Recursiveselects . . . . . . . . . . . . . . . . . . . . .294

6.17.4SerializingRowsin views . . . . . . . . . . . . . . . . .295

6.17.5orderby,groupby,limitby,distinct,having. . . . . . .297

6.17.6Logical operators . . . . . . . . . . . . . . . . . . . . .299

6.17.7count,isempty,delete,update. . . . . . . . . . . . . .299

6.17.8Expressions . . . . . . . . . . . . . . . . . . . . . . . .300

6.17.9case. . . . . . . . . . . . . . . . . . . . . . . . . . . .300

6.17.10update_record. . . . . . . . . . . . . . . . . . . . . . .301

6.17.11Inserting and updating from a dictionary . . . . . . .301

6.17.12firstandlast. . . . . . . . . . . . . . . . . . . . . . .302

6.17.13as_dictandas_list. . . . . . . . . . . . . . . . . . . .302

6.17.14Combining rows . . . . . . . . . . . . . . . . . . . . .302

6.17.15find,exclude,sort. . . . . . . . . . . . . . . . . . . . .303

6.18Other methods . . . . . . . . . . . . . . . . . . . . . . . . . .304

6.18.1update_or_insert. . . . . . . . . . . . . . . . . . . . .304

6.18.2validate_and_insert,validate_and_update. . . . . . .305

6.18.3smart_query(experimental) . . . . . . . . . . . . . . .305

6.19Computed fields . . . . . . . . . . . . . . . . . . . . . . . . .306

6.20Virtual fields . . . . . . . . . . . . . . . . . . . . . . . . . . . .307

6.20.1New style virtual fields . . . . . . . . . . . . . . . . .307

6.20.2Old style virtual fields . . . . . . . . . . . . . . . . . .308

6.21One to many relation . . . . . . . . . . . . . . . . . . . . . . .310

6.21.1Inner joins . . . . . . . . . . . . . . . . . . . . . . . . .311

6.21.2Left outer join . . . . . . . . . . . . . . . . . . . . . . .313

6.21.3Grouping and counting . . . . . . . . . . . . . . . . .313

6.22Many to many . . . . . . . . . . . . . . . . . . . . . . . . . . .314

6.23list:, andcontains. . . . . . . . . . . . . . . . . . . .315

6.24Other operators . . . . . . . . . . . . . . . . . . . . . . . . . .317

6.24.1like,regexp,startswith,contains,upper,lower. . . .317

6.24.2year,month,day,hour,minutes,seconds. . . . . . . . .318

11

6.24.3belongs. . . . . . . . . . . . . . . . . . . . . . . . . . .319

6.24.4sum,avg,min,maxandlen. . . . . . . . . . . . . . . . .319

6.24.5Substrings . . . . . . . . . . . . . . . . . . . . . . . . .320

6.24.6Default values withcoalesceandcoalesce_zero. . .320

6.25Generating raw sql . . . . . . . . . . . . . . . . . . . . . . . .321

6.26Exporting and importing data . . . . . . . . . . . . . . . . . .322

6.26.1CSV (one Table at a time) . . . . . . . . . . . . . . . .322

6.26.2CSV (all tables at once) . . . . . . . . . . . . . . . . .322

6.26.3CSV and remote database synchronization . . . . . .323

6.26.4HTML and XML (one Table at a time) . . . . . . . . .325

6.26.5Data representation . . . . . . . . . . . . . . . . . . .326

6.27Caching selects . . . . . . . . . . . . . . . . . . . . . . . . . .327

6.28Self-Reference and aliases . . . . . . . . . . . . . . . . . . . .328

6.29Advanced features . . . . . . . . . . . . . . . . . . . . . . . .329

6.29.1Table inheritance . . . . . . . . . . . . . . . . . . . . .329

6.29.2filter_inandfilter_out. . . . . . . . . . . . . . . .330

6.29.3before and after callbacks . . . . . . . . . . . . . . . .330

6.29.4Record versioning . . . . . . . . . . . . . . . . . . . .332

6.29.5Common fields and multi-tenancy . . . . . . . . . . .333

6.29.6Common filters . . . . . . . . . . . . . . . . . . . . . .334

6.29.7CustomFieldtypes (experimental) . . . . . . . . . .334

6.29.8Using DAL without define tables . . . . . . . . . . .335

6.29.9PostGIS, SpatiaLite, and MS Geo (experimental) . . .336

6.29.10Copy data from one db into another . . . . . . . . . .337

6.29.11Note on new DAL and adapters . . . . . . . . . . . .338

6.29.12Gotchas . . . . . . . . . . . . . . . . . . . . . . . . . .341

7Forms and validators345

7.1FORM. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .346

7.1.1Theprocessandvalidatemethods . . . . . . . . . . .349

7.1.2Hidden fields . . . . . . . . . . . . . . . . . . . . . . .350

7.1.3keepvalues. . . . . . . . . . . . . . . . . . . . . . . . .352

7.1.4onvalidation. . . . . . . . . . . . . . . . . . . . . . . .352

7.1.5Detect record change . . . . . . . . . . . . . . . . . . .353

7.1.6Forms and redirection . . . . . . . . . . . . . . . . . .353

12

7.1.7Multiple forms per page . . . . . . . . . . . . . . . . .354

7.1.8Sharing forms . . . . . . . . . . . . . . . . . . . . . . .355

7.1.9Adding buttons to FORMs . . . . . . . . . . . . . . .356

7.1.10More about manipulation of FORMs . . . . . . . . .356

7.2SQLFORM. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .356

7.2.1SQLFORMandinsert/update/delete. . . . . . . . . . .361

7.2.2SQLFORMin HTML . . . . . . . . . . . . . . . . . . . . .363

7.2.3SQLFORMand uploads . . . . . . . . . . . . . . . . . . .364

7.2.4Storing the original filename . . . . . . . . . . . . . .366

7.2.5autodelete. . . . . . . . . . . . . . . . . . . . . . . . .367

7.2.6Links to referencing records . . . . . . . . . . . . . . .367

7.2.7Pre-populating the form . . . . . . . . . . . . . . . . .369

7.2.8Adding extra form elements toSQLFORM. . . . . . . .370

7.2.9SQLFORMwithout database IO . . . . . . . . . . . . . .370

7.3Other types of Forms . . . . . . . . . . . . . . . . . . . . . . .371

7.3.1SQLFORM.factory. . . . . . . . . . . . . . . . . . . . . .371

7.3.2One form for multiple tables . . . . . . . . . . . . . .372

7.3.3Confirmation Forms . . . . . . . . . . . . . . . . . . .373

7.3.4Form to edit a dictionary . . . . . . . . . . . . . . . .373

7.4CRUD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .374

7.4.1Settings . . . . . . . . . . . . . . . . . . . . . . . . . .375

7.4.2Messages . . . . . . . . . . . . . . . . . . . . . . . . . .377

7.4.3Methods . . . . . . . . . . . . . . . . . . . . . . . . . .378

7.4.4Record versioning . . . . . . . . . . . . . . . . . . . .380

7.5Custom forms . . . . . . . . . . . . . . . . . . . . . . . . . . .382

7.5.1CSS conventions . . . . . . . . . . . . . . . . . . . . .383

7.5.2Hide errors . . . . . . . . . . . . . . . . . . . . . . . .384

7.6Validators . . . . . . . . . . . . . . . . . . . . . . . . . . . . .385

7.6.1Validators . . . . . . . . . . . . . . . . . . . . . . . . .386

7.6.2Database validators . . . . . . . . . . . . . . . . . . .397

7.6.3Custom validators . . . . . . . . . . . . . . . . . . . .399

7.6.4Validators with dependencies . . . . . . . . . . . . . .401

7.7Widgets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .401

7.7.1Autocomplete widget . . . . . . . . . . . . . . . . . .403

7.8SQLFORM.gridandSQLFORM.smartgrid. . . . . . . . . . . . . . .404

13

8Emails and SMS413

8.1Setting up email . . . . . . . . . . . . . . . . . . . . . . . . . .413

8.1.1Configuring email for Google App Engine . . . . . .414

8.1.2x509and PGP Encryption . . . . . . . . . . . . . . . .414

8.2Sending emails . . . . . . . . . . . . . . . . . . . . . . . . . .415

8.2.1Simple text email . . . . . . . . . . . . . . . . . . . . .415

8.2.2HTML emails . . . . . . . . . . . . . . . . . . . . . . .415

8.2.3Combining text and HTML emails . . . . . . . . . . .416

8.2.4ccandbccemails . . . . . . . . . . . . . . . . . . . . .416

8.2.5Attachments . . . . . . . . . . . . . . . . . . . . . . . .416

8.2.6Multiple attachments . . . . . . . . . . . . . . . . . . .416

8.3Sending SMS messages . . . . . . . . . . . . . . . . . . . . . .416

8.4Using the template system to generate messages . . . . . . .417

8.5Sending messages using a background task . . . . . . . . . .418

8.6Reading and managing email boxes (Experimental) . . . . .419

8.6.1Connection . . . . . . . . . . . . . . . . . . . . . . . .420

8.6.2Fetching mail and updating flags . . . . . . . . . . .421

9Access Control425

9.1Authentication . . . . . . . . . . . . . . . . . . . . . . . . . . .428

9.1.1Restrictions on registration . . . . . . . . . . . . . . .431

9.1.2Integration with OpenID, Facebook, etc. . . . . . . .432

9.1.3CAPTCHA and reCAPTCHA . . . . . . . . . . . . . .434

9.1.4CustomizingAuth. . . . . . . . . . . . . . . . . . . . .435

9.1.5RenamingAuthtables . . . . . . . . . . . . . . . . . .437

9.1.6Other login methods and login forms . . . . . . . . .438

9.1.7Record versioning . . . . . . . . . . . . . . . . . . . .444

9.1.8MailandAuth. . . . . . . . . . . . . . . . . . . . . . .445

9.2Authorization . . . . . . . . . . . . . . . . . . . . . . . . . . .446

9.2.1Decorators . . . . . . . . . . . . . . . . . . . . . . . . .448

9.2.2Combining requirements . . . . . . . . . . . . . . . .449

9.2.3Authorization and CRUD . . . . . . . . . . . . . . . .450

9.2.4Authorization and downloads . . . . . . . . . . . . .451

9.2.5Access Control and Basic Authentication . . . . . . .451

9.2.6Manual Authentication . . . . . . . . . . . . . . . . .452

14

9.2.7Settings and messages . . . . . . . . . . . . . . . . . .452

9.3Central Authentication Service . . . . . . . . . . . . . . . . .458

9.3.1Using web2py to authorize non-web2py apps . . . .460

10Services463

10.1Rendering a dictionary . . . . . . . . . . . . . . . . . . . . . .463

10.1.1HTML, XML, and JSON . . . . . . . . . . . . . . . . .464

10.1.2Generic views . . . . . . . . . . . . . . . . . . . . . . .464

10.1.3RenderingRows. . . . . . . . . . . . . . . . . . . . . .466

10.1.4Custom formats . . . . . . . . . . . . . . . . . . . . . .467

10.1.5RSS . . . . . . . . . . . . . . . . . . . . . . . . . . . . .467

10.1.6CSV . . . . . . . . . . . . . . . . . . . . . . . . . . . . .469

10.2Remote procedure calls . . . . . . . . . . . . . . . . . . . . .470

10.2.1XMLRPC . . . . . . . . . . . . . . . . . . . . . . . . . .472

10.2.2JSONRPC . . . . . . . . . . . . . . . . . . . . . . . . .473

10.2.3JSONRPC and Pyjamas . . . . . . . . . . . . . . . . .474

10.2.4AMFRPC . . . . . . . . . . . . . . . . . . . . . . . . .477

10.2.5SOAP . . . . . . . . . . . . . . . . . . . . . . . . . . . .480

10.3Low level API and other recipes . . . . . . . . . . . . . . . .480

10.3.1simplejson . . . . . . . . . . . . . . . . . . . . . . . . .480

10.3.2PyRTF . . . . . . . . . . . . . . . . . . . . . . . . . . .481

10.3.3ReportLab and PDF . . . . . . . . . . . . . . . . . . .482

10.4Restful Web Services . . . . . . . . . . . . . . . . . . . . . . .483

10.4.1parse_as_rest(experimental) . . . . . . . . . . . . . .486

10.4.2smart_query(experimental) . . . . . . . . . . . . . . .491

10.4.3Access Control . . . . . . . . . . . . . . . . . . . . . .491

10.5Services and Authentication . . . . . . . . . . . . . . . . . . .492

11jQuery and Ajax495

11.1web2py_ajax.html . . . . . . . . . . . . . . . . . . . . . . . . .495

11.2jQuery effects . . . . . . . . . . . . . . . . . . . . . . . . . . .500

11.2.1Conditional fields in forms . . . . . . . . . . . . . . .504

11.2.2Confirmation on delete . . . . . . . . . . . . . . . . .506

11.3Theajaxfunction . . . . . . . . . . . . . . . . . . . . . . . . .507

11.3.1Eval target . . . . . . . . . . . . . . . . . . . . . . . . .508

15

11.3.2Auto-completion . . . . . . . . . . . . . . . . . . . . .508

11.3.3Ajax form submission . . . . . . . . . . . . . . . . . .511

11.3.4Voting and rating . . . . . . . . . . . . . . . . . . . . .512

12Components and plugins515

12.1Components . . . . . . . . . . . . . . . . . . . . . . . . . . . .515

quotesdbs_dbs29.pdfusesText_35
[PDF] 10 Handy Tips on SQL Server Dates - SQLSaturday

[PDF] Php Date Format From String

[PDF] Dix sept wilayas productrices de datte , une richesse inépuisable

[PDF] conditionnement des dattes - Tunisie Industrie

[PDF] Intoxication par le Datura

[PDF] 5352/210 - Administration des Douanes et Impôts Indirects

[PDF] Dauphine en mains - Université Paris-Dauphine

[PDF] Banque, finance, assurance - Offre de formation de l 'Université Paris

[PDF] master-management-luxedauphinefr - Université Paris-Dauphine

[PDF] Année universitaire 2016-2017 Calendrier des Candidatures /E

[PDF] l 'université choisie - Université Paris-Dauphine

[PDF] FOR 7-121 NOTICE LIVRET 2 DEME

[PDF] The Biggest Secret - Download David Icke Books For Free

[PDF] La vérité vous rendra libres - TopChrétien

[PDF] DAVID ICKE quot L humanité est collectivement hypnotisée par une