examples uses cookie based sessions

This commit is contained in:
mdipierro
2013-03-11 08:50:01 -05:00
parent 00fb3b56cc
commit 24daa335b6
9 changed files with 13 additions and 23 deletions
+1 -1
View File
@@ -1 +1 @@
Version 2.4.2-stable+timestamp.2013.03.11.08.24.51
Version 2.4.2-stable+timestamp.2013.03.11.08.49.11
@@ -1,9 +1,5 @@
session.forget()
response.menu = [['home', False, '/%s/default/index'
% request.application], ['docs', True,
'/%s/global/vars' % request.application]]
def get(args):
if args[0].startswith('__'):
return None
@@ -54,13 +54,6 @@ def raisehttp():
raise HTTP(400, 'internal error')
def raiseexception():
""" generates an exeption, logs the event and returns a ticket number """
1 / 0
return 'oops'
def servejs():
""" serves a js document """
@@ -69,7 +62,6 @@ def servejs():
gluon.contenttype.contenttype('.js')
return 'alert("This is a Javascript document, it is not supposed to run!");'
def makejson():
import gluon.contrib.simplejson as sj
return sj.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}])
@@ -1,6 +1,5 @@
from gluon.contrib.spreadsheet import Sheet
def callback():
return cache.ram('sheet1', lambda: None, None).process(request)
@@ -25,12 +25,12 @@
<tr>
<td><a class="btn btn-180 btn-success" href="http://www.web2py.com/examples/static/web2py_src.zip">Source Code</a></td>
<td><a class="btn btn-180 btn-warning" href="http://www.web2py.com/examples/static/nightly/web2py_src.zip">Source Code</a></td>
<td><a class="btn btn-180 btn-danger" href="{{=URL('static', 'epydoc/index.html')}}">Source Code Docs</a></td>
<td><a class="btn btn-180 btn-danger" href="{{=URL('static', 'epydoc/index.html')}}">Epydoc</a></td>
</tr>
<tr>
<td><a class="btn btn-180 btn-success" href="https://dl.dropbox.com/u/18065445/web2py/web2py_manual_5th.pdf">Manual</a></td>
<td><a class="btn btn-180" href="{{=URL('changelog')}}">Change Log</a></td>
<td><a class="btn btn-180" href="http://code.google.com/p/web2py/issues/list">Report a Bug</a></td>
<td></td>
</tr>
</table>
</center>
@@ -119,7 +119,6 @@ def raiseexception():
return 'oops'
""".strip(),language='web2py',link=URL('global','vars'),_class='boxCode')}}
<p>If an exception occurs (other than HTTP) a ticket is generated and the event is logged for the administrator. These tickets and logs can be accessed, reviewed and deleted at any later time.
<br/>Try it here: <a href="/{{=request.application}}/simple_examples/raiseexception">raiseexception</a></p>
<h3>Example {{=c}}{{c+=1}}</h3><b>In controller: simple_examples.py</b>
{{=CODE("""
@@ -17,7 +17,7 @@ random.shuffle(quotes)
<div class="span12">
<div class="span8">
<h3>web2py<sup>TM</sup> Web Framework</h3>
<p>Free open source full-stack framework for rapid development of fast, scalable, <a href="http://www.web2py.com/book/default/chapter/01#Security" target="_blank">secure</a> and portable database-driven web-based applications. Written and programmable in <a href="http://www.python.org" target="_blank">Python</a>. <a href="http://www.gnu.org/licenses/lgpl.html">LGPLv3 License</a>.</p>
<p>Free open source full-stack framework for rapid development of fast, scalable, <a href="http://www.web2py.com/book/default/chapter/01#Security" target="_blank">secure</a> and portable database-driven web-based applications. Written and programmable in <a href="http://www.python.org" target="_blank">Python</a>.</p>
<table width="100%">
<tr>
<td>
@@ -37,7 +37,7 @@ random.shuffle(quotes)
</td>
</tr>
</table>
<p>Current version: <a href="{{=URL('download')}}">{{=request.env.web2py_version}}</p>
<p>Current version: <a href="{{=URL('download')}}">{{=request.env.web2py_version}} (<a href="http://www.gnu.org/licenses/lgpl.html">LGPLv3 License</a>)</p>
</div>
<div class="span4" style="text-align:center">
<a href="http://www.infoworld.com/slideshow/24605/infoworlds-2012-technology-of-the-year-award-winners-183313#slide23"><img src="{{=URL('static','images/infoworld2012.jpeg')}}" width="200px"/></a><br/>
+3 -3
View File
@@ -19,7 +19,7 @@
<br/>
{{pass}}
{{if doc:}}<br/><br/>{{=CODE(str(doc),language=None,counter=None,_class='boxCode')}}{{pass}}
{{if doc:}}<br/><br/>{{=MARKMIN(doc)}}{{pass}}
<br/><br/>
<div class="boxInfo">
{{if attributes:}}
@@ -32,7 +32,7 @@
<tr>
<td>
{{if key.count('.')<2:}}
{{=A(key,_href=URL(args=key.split('.')))}}
{{=A(key,_rel="nofollow",_href=URL(args=key.split('.')))}}
{{else:}}
{{=key}}
{{pass}}
@@ -43,7 +43,7 @@
{{if c1:}} belongs to class {{=c1}}{{pass}}
<br/>
{{pass}}
{{if doc1:}}{{=XML(cgi.escape(str(doc1)).replace(chr(13),'<br/>'))}}{{pass}}
{{if doc1:}}{{=MARKMIN(doc1)}}{{pass}}
</td>
</tr>
<tr><td colspan=2><hr/></td></tr>
@@ -1,5 +1,9 @@
{{extend 'layout.html'}}
<style>
input {width: 70px;}
input:focus {background-color: yellow}
table, td, tr { border: 0; margin: 0; padding: 0}
</style>
<h1>Excel-like spreadsheet widget</h1>
Try insert "=r0c1+1" in cell r0c0 and "2" in r0c1. Formulas start with "=" as in Excel. You can use a subset of python commands and math function, and reference cells by r[row]c[col]. All computations are performed serverside via Ajax (input is validated for security). Cell values and formulas can be set and locked serverside. The shape of the spreadsheet can be modifed serverside and does not need to be tabular (think of it as a graph of css-friendly widgets you can place where you want). Cells can be given arbistrary names. This example is distributed with web2py so look at the source code of the example to learn more.