Commits

Bria...@ Home  committed 8a1ae1a

Updated for web2py 1.97.1
Now includes create.html & add_category.load views since web2py no longer uses generic views due to potential security issues.

  • Participants
  • Parent commits 2149bba

Comments (0)

Files changed (4)

+syntax: glob
+*.bak
+*/errors*
+*/languages*

File applications/select_or_add_option/views/product/add_category.load

+{{'''
+# License: Public Domain
+# Author: Iceberg at 21cn dot com
+
+With this generic.load file, you can use same function to serve two purposes.
+
+= regular action
+- ajax callback (when called with .load)
+
+Example modified from http://www.web2py.com/AlterEgo/default/show/252:
+
+def index():
+    return dict(
+		part1='hello world',
+        	part2=LOAD(url=URL(r=request,f='auxiliary.load'),ajax=True))
+
+def auxiliary():
+    form=SQLFORM.factory(Field('name'))
+    if form.accepts(request.vars):
+        response.flash = 'ok' 
+        return dict(message="Hello %s" % form.vars.name)
+    return dict(form=form)
+
+Notice:
+
+- no need to set response.headers['web2py-response-flash']
+- no need to return a string
+even if the function is called via ajax.
+
+'''}}{{if len(response._vars)==1:}}{{=response._vars.values()[0]}}{{else:}}{{=BEAUTIFY(response._vars)}}{{pass}}

File applications/select_or_add_option/views/product/create.html

+{{extend 'layout.html'}}
+<h1>Create a New Product</h1>
+{{=message}}
+{{=form}}

File web2py.app.select_or_add_option.w2p

Binary file modified.