Browse Source

[IMP] review points

pull/252/head
Holger Brunn 9 years ago
parent
commit
6a21060cc5
  1. 4
      web_favicon/README.rst
  2. 3
      web_favicon/controllers/web_favicon.py
  3. 2
      web_favicon/tests/test_web_favicon.py
  4. 2
      web_favicon/views/templates.xml

4
web_favicon/README.rst

@ -25,9 +25,7 @@ Usage
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot :alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/{repo_id}/8.0
.. repo_id is available in https://github.com/OCA/maintainer-tools/blob/master/tools/repos_with_ids.txt
:target: https://runbot.odoo-community.org/runbot/162/8.0
For further information, please visit: For further information, please visit:

3
web_favicon/controllers/web_favicon.py

@ -28,10 +28,11 @@ class WebFavicon(http.Controller):
@http.route('/web_favicon/favicon', type='http', auth="none") @http.route('/web_favicon/favicon', type='http', auth="none")
def icon(self): def icon(self):
request = http.request request = http.request
company = request.env['res.company'].search([], limit=1)
if 'uid' in request.env.context: if 'uid' in request.env.context:
user = request.env['res.users'].browse(request.env.context['uid']) user = request.env['res.users'].browse(request.env.context['uid'])
company = user.sudo(user.id).company_id company = user.sudo(user.id).company_id
else:
company = request.env['res.company'].search([], limit=1)
favicon = company.favicon_backend favicon = company.favicon_backend
favicon_mimetype = company.favicon_backend_mimetype favicon_mimetype = company.favicon_backend_mimetype
if not favicon: if not favicon:

2
web_favicon/tests/test_web_favicon.py

@ -37,8 +37,6 @@ class FakeResponse(object):
self.headers = dict(headers) self.headers = dict(headers)
class TestWebFavicon(TransactionCase): class TestWebFavicon(TransactionCase):
def test_web_favicon(self): def test_web_favicon(self):
original_request = http.request original_request = http.request

2
web_favicon/views/templates.xml

@ -3,7 +3,7 @@
<data> <data>
<template id="layout" inherit_id="web.layout"> <template id="layout" inherit_id="web.layout">
<xpath expr="//link[@rel='shortcut icon']" position="replace"> <xpath expr="//link[@rel='shortcut icon']" position="replace">
<link rel="shortcut icon" href="/web_favicon/favicon" />
<link rel="icon" href="/web_favicon/favicon" />
</xpath> </xpath>
</template> </template>
</data> </data>

Loading…
Cancel
Save