[IMP] some titles, move auth=public from website-dependency to website-layoutify
auth=public is not necessary to depending on website, however rendering within website/website's layout blows up if there is no current user
This commit is contained in:
parent
c9d4371119
commit
fdc63e3a67
|
@ -15,8 +15,8 @@ Howto: build a website with OpenERP
|
|||
For production deployment, see the dedicated guides :ref:`using-gunicorn`
|
||||
and :ref:`using-mod-wsgi`.
|
||||
|
||||
Hello, world!
|
||||
=============
|
||||
Creating a basic module
|
||||
=======================
|
||||
|
||||
In OpenERP, doing things takes the form of creating modules, and these modules
|
||||
customize the behavior of the OpenERP installation. The first step is thus to
|
||||
|
@ -82,8 +82,8 @@ returned by the ``index`` method to get a more page-ish output:
|
|||
|
||||
.. todo:: screenshot
|
||||
|
||||
Data input: URL and query
|
||||
=========================
|
||||
Controller Parameters
|
||||
=====================
|
||||
|
||||
Being able to build a static page in code is nice, but makes for limited
|
||||
usefulness (you could do that with static files).
|
||||
|
@ -116,8 +116,8 @@ from a string URL section to a python integer) and will perform a some
|
|||
validation (if the ``id`` is not a valid integer, the converter will return a
|
||||
``404 Not Found`` instead of a 500 server error when the conversion fails).
|
||||
|
||||
Templating: better experience in editing
|
||||
========================================
|
||||
Basic templates
|
||||
===============
|
||||
|
||||
So far we've output HTML by munging strings. It works, but is not exactly fun
|
||||
to edit (and somewhat unsafe to boot) as even advanced text editors have a
|
||||
|
@ -273,7 +273,7 @@ installed after the ``academy`` module, its index page takes over routing (two
|
|||
index pages exist, and one is picked over the other).
|
||||
|
||||
To fix the issue, we can simply add ``website`` as a dependency to ``academy``
|
||||
(that is, tell OpenERP that ``academy`` needs ``website`` to work right):
|
||||
(that is, tell OpenERP that ``academy`` needs ``website`` to work correctly):
|
||||
|
||||
.. needs -u all to update metadata
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# HG changeset patch
|
||||
# Parent b2da66732141558bdf8fcc21000b98a8b67a1340
|
||||
# Parent f84f5783ecf4eabd018fd27548423b5cefc1d2dc
|
||||
|
||||
diff --git a/__openerp__.py b/__openerp__.py
|
||||
--- a/__openerp__.py
|
||||
|
@ -16,12 +16,9 @@ diff --git a/__openerp__.py b/__openerp__.py
|
|||
diff --git a/controllers/my_controller.py b/controllers/my_controller.py
|
||||
--- a/controllers/my_controller.py
|
||||
+++ b/controllers/my_controller.py
|
||||
@@ -12,20 +12,12 @@ teaching_assistants = [
|
||||
]
|
||||
|
||||
@@ -14,18 +14,10 @@ teaching_assistants = [
|
||||
class my_controller(main.Home):
|
||||
- @http.route('/', auth='none')
|
||||
+ @http.route('/', auth='public')
|
||||
@http.route('/', auth='none')
|
||||
def index(self):
|
||||
- cr, uid, context = http.request.cr, http.request.uid, http.request.context
|
||||
- tas = [
|
||||
|
@ -37,7 +34,7 @@ diff --git a/controllers/my_controller.py b/controllers/my_controller.py
|
|||
- }, context=context)
|
||||
-
|
||||
- @http.route('/tas/<int:id>/', auth='none')
|
||||
+ @http.route('/tas/<int:id>/', auth='public', website=True)
|
||||
+ @http.route('/tas/<int:id>/', auth='none', website=True)
|
||||
def ta(self, id):
|
||||
- cr, uid, context = http.request.cr, http.request.uid, http.request.context
|
||||
- return http.request.registry['ir.ui.view'].render(
|
||||
|
|
|
@ -1,6 +1,24 @@
|
|||
# HG changeset patch
|
||||
# Parent 307d452da9602b1bc1a8ed208e6949924ba0e5cf
|
||||
# Parent 341dd9480911ad71df915449944e21275a1f32c6
|
||||
|
||||
diff --git a/controllers/my_controller.py b/controllers/my_controller.py
|
||||
--- a/controllers/my_controller.py
|
||||
+++ b/controllers/my_controller.py
|
||||
@@ -12,12 +12,12 @@ teaching_assistants = [
|
||||
]
|
||||
|
||||
class my_controller(main.Home):
|
||||
- @http.route('/', auth='none')
|
||||
+ @http.route('/', auth='public')
|
||||
def index(self):
|
||||
return http.request.website.render('academy.index', {
|
||||
'tas': teaching_assistants,
|
||||
})
|
||||
|
||||
- @http.route('/tas/<int:id>/', auth='none', website=True)
|
||||
+ @http.route('/tas/<int:id>/', auth='public', website=True)
|
||||
def ta(self, id):
|
||||
return http.request.website.render('academy.ta', teaching_assistants[id])
|
||||
diff --git a/views/templates.xml b/views/templates.xml
|
||||
--- a/views/templates.xml
|
||||
+++ b/views/templates.xml
|
||||
|
|
Loading…
Reference in New Issue