diff options
| author | Fabien Pinckaers <fp@tinyerp.com> | 2013-11-24 22:02:21 +0100 |
|---|---|---|
| committer | Fabien Pinckaers <fp@tinyerp.com> | 2013-11-24 22:02:21 +0100 |
| commit | 105fc16c117e783fe4e1fb28e52b7aadea8b9a2a (patch) | |
| tree | 58361baef1dc745553b48f23ea2551ad4029e461 /addons/website/controllers/main.py | |
| parent | fb0abe39bc4742f8080feefcadecc6e5b2e315c5 (diff) | |
[IMP] events improvements
bzr revid: fp@tinyerp.com-20131124210221-hwalp7983olmrhew
Diffstat (limited to 'addons/website/controllers/main.py')
| -rw-r--r-- | addons/website/controllers/main.py | 39 |
1 files changed, 3 insertions, 36 deletions
diff --git a/addons/website/controllers/main.py b/addons/website/controllers/main.py index 6b11c065552..9a9bffe332e 100644 --- a/addons/website/controllers/main.py +++ b/addons/website/controllers/main.py @@ -48,42 +48,9 @@ class Website(openerp.addons.web.controllers.main.Home): @website.route('/pagenew/<path:path>', type='http', auth="user") def pagenew(self, path, noredirect=NOPE): - module = 'website' - # completely arbitrary max_length - idname = slugify(path, max_length=50) - - request.cr.execute('SAVEPOINT pagenew') - imd = request.registry['ir.model.data'] - view = request.registry['ir.ui.view'] - view_model, view_id = imd.get_object_reference( - request.cr, request.uid, 'website', 'default_page') - newview_id = view.copy( - request.cr, request.uid, view_id, context=request.context) - newview = view.browse( - request.cr, request.uid, newview_id, context=request.context) - newview.write({ - 'arch': newview.arch.replace("website.default_page", - "%s.%s" % (module, idname)), - 'name': path, - 'page': True, - }) - # Fuck it, we're doing it live - try: - imd.create(request.cr, request.uid, { - 'name': idname, - 'module': module, - 'model': 'ir.ui.view', - 'res_id': newview_id, - 'noupdate': True - }, context=request.context) - except psycopg2.IntegrityError: - logger.exception('Unable to create ir_model_data for page %s', path) - request.cr.execute('ROLLBACK TO SAVEPOINT pagenew') - return werkzeug.exceptions.InternalServerError() - else: - request.cr.execute('RELEASE SAVEPOINT pagenew') - - url = "/page/%s" % idname + web = request.registry['website'] + path = web.new_page(request.cr, request.uid, path, request.context) + url = "/page/" + path if noredirect is not NOPE: return werkzeug.wrappers.Response(url, mimetype='text/plain') return werkzeug.utils.redirect(url) |
