diff options
| author | Christophe Matthieu <chm@odoo.com> | 2015-06-10 10:42:28 +0200 |
|---|---|---|
| committer | Christophe Matthieu <chm@odoo.com> | 2015-07-10 17:00:15 +0200 |
| commit | fd5361c0f7116e951cf9e69e2d97a8ccb07ce1b6 (patch) | |
| tree | 96d765ac0ddc3738e8b6ca40d7a27ddf84e334cc /addons/website_links/controller/main.py | |
| parent | 2868a86401cf34ab28e036c3b359673c8efe324b (diff) | |
[IMP] mass_mailing: remove depends to website. Create a website_mass_mailing bridge to add subscribe snippet into website builder. Split website_links to have link_tracker to create short and trackable URLs, and website_links to have a website layout for link_tracker and add button to share page.
Diffstat (limited to 'addons/website_links/controller/main.py')
| -rw-r--r-- | addons/website_links/controller/main.py | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/addons/website_links/controller/main.py b/addons/website_links/controller/main.py index 46da968a5c4..a91021161e2 100644 --- a/addons/website_links/controller/main.py +++ b/addons/website_links/controller/main.py @@ -10,7 +10,7 @@ class Website_Url(http.Controller): def create_shorten_url(self, **post): if 'url' not in post or post['url'] == '': return {'error': 'empty_url'} - return request.env['website.links'].create(post).read() + return request.env['link.tracker'].create(post).read() @http.route('/r', type='http', auth='user', website=True) def shorten_url(self, **post): @@ -18,28 +18,22 @@ class Website_Url(http.Controller): @http.route('/website_links/add_code', type='json', auth='user') def add_code(self, **post): - link_id = request.env['website.links.code'].search([('code', '=', post['init_code'])], limit=1).link_id.id - new_code = request.env['website.links.code'].search_count([('code', '=', post['new_code']), ('link_id', '=', link_id)]) + link_id = request.env['link.tracker.code'].search([('code', '=', post['init_code'])], limit=1).link_id.id + new_code = request.env['link.tracker.code'].search_count([('code', '=', post['new_code']), ('link_id', '=', link_id)]) if new_code > 0: return new_code.read() else: - return request.env['website.links.code'].create({'code': post['new_code'], 'link_id': link_id})[0].read() + return request.env['link.tracker.code'].create({'code': post['new_code'], 'link_id': link_id})[0].read() @http.route('/website_links/recent_links', type='json', auth='user') def recent_links(self, **post): - return request.env['website.links'].recent_links(post['filter'], post['limit']) + return request.env['link.tracker'].recent_links(post['filter'], post['limit']) @http.route('/r/<string:code>+', type='http', auth="user", website=True) def statistics_shorten_url(self, code, **post): - code = request.env['website.links.code'].search([('code', '=', code)], limit=1) + code = request.env['link.tracker.code'].search([('code', '=', code)], limit=1) if code: return request.website.render("website_links.graphs", code.link_id.read()[0]) else: return werkzeug.utils.redirect('', 301) - - @http.route('/r/<string:code>', type='http', auth='none', website=True) - def full_url_redirect(self, code, **post): - request.env['website.links.click'].add_click(code, request.httprequest.remote_addr, request.session['geoip'].get('country_code'), stat_id=False) - redirect_url = request.env['website.links'].get_url_from_code(code) - return werkzeug.utils.redirect(redirect_url or '', 301) |
