Commit Graph
143 Commits
Author SHA1 Message Date
Denis Ledoux 5cf29dcff2 [FIX] web, website: overrideable images controller
The `binay_image` and `content_disposition` are moved
from the web controller to the `ir.http` model,
to be able to override these methods.

This makes possible to browse the records images as sudo
when the record is published on the website.
e.g. to see the partner images on the website `/partners` page
from the `website_crm_partner_assign` module.

opw-659244
2015-12-11 13:58:49 +01:00
Christophe Simonis 56a442e205 [MERGE] forward port of branch saas-6 up to dade7e3 2015-11-25 13:26:02 +01:00
Denis Ledoux d47ee18fef [MERGE] forward port of branch 8.0 up to c9fce1a 2015-11-17 13:19:14 +01:00
Christophe Simonis 5b77f9d39f [FIX] website: pass context as keyword argument when calling method. 2015-11-12 12:09:53 +01:00
Christophe Simonis d750206c49 [MERGE] forward port of branch saas-6 up to e9f1ee4 2015-10-01 15:16:59 +02:00
Denis Ledoux bcc2f620db [FIX] website: geoip not defined in session for invalid session
The method that set `geoip` in the session, `_geoip_resolve`,
is called just before `self._authenticate`, which logout the user
when the session is invalid, and therefore reset the session.

Therefore, `geoip` could not be in the session in that place.
This isn't that bad, as, at the next request, the `geoip` will be
correctly set in the session.

During the analysis of this issue, we observed that the reset
of the session is actually not saved, because the save
of this session is done in `Root.get_response`, through the call
`self.session_store.save(httprequest.session)`,
but `Root.get_response` is not called in `Root.dispatch` in case
of HTTPException (500 internal server error in this case).

This might need to be changed, to do the session save with a finally
in this `Root.dispatch` method, so the above bug could have been
resolved with a simple refresh (which would have re-defined the
`geoip` in the session).

opw-650416
2015-09-29 14:56:22 +02:00
Christophe Simonis 57168a9e90 [MERGE] forward port of branch saas-6 up to a669433 2015-09-23 14:34:26 +02:00
Goffin Simon 5b554499e8 [IMP] website_version: cache enable
The visitors who have the same sequence of versions for their running experiments must
share the same cache.
2015-09-18 10:31:21 +02:00
Christophe Matthieu 8c559044a5 [IMP] web_editor: split website into web_editor (to use editor in backend for html field) and website 2015-07-10 17:00:11 +02:00
Christophe Simonis 45a805c76b [MERGE] forward port of branch 8.0 up to 26e7742 2015-05-21 16:45:05 +02:00
Olivier Dony 8d745f9f50 [FIX] account, mail, etc.: uniformize evaluated expressions
opw-626694
2015-05-21 15:26:35 +02:00
Antony Lesuisse fffaf40617 [FIX] website: geoip restore city file location
And change the warning message with instruction on how to install the database,
debian geoip-database-contrib has a script to easily install it.
2015-05-18 11:46:42 +02:00
Antony Lesuisse 49a5a355c2 [FIX] website: ir.http cache add lang in key 2015-05-18 11:06:34 +02:00
Odoo Online ffd72b7f58 [FIX] website: http cache some handler dont have routing 2015-05-17 17:44:30 +02:00
Antony Lesuisse ceb53fad6d [IMP] website: ir.http route cache for auth public
- remove useless cache clear_prefix
- add a route cache attribute when used it will save the rendered page into the
  ormcache for the specified time, this is only enabled if the user is public
  and reponse code is 200
- enable it on /page controller for 5min
2015-05-17 17:08:13 +02:00
Antony Lesuisse 714aaca03e [FIX] website: ir.http geoip default file
- set the default value to be the debian bundled geoip database.
- split into 2 methods to avoir bloating dispatch
2015-05-17 16:45:22 +02:00
Christophe Simonis 2260496879 [MERGE] forward port of branch 8.0 up to a939a27 2015-05-05 18:48:34 +02:00
Jeremy Kersten 9f93a9ae1c [IMP] ir_http: add facebookinternalhit in the list of bot.
Avoid redirect in en_US if lang is installed  when a link is added via Facebook
2015-05-05 10:55:00 +02:00
Olivier Dony c667eb06b8 [FIX] website: only consider valid languages in URL path
Improves aea358ca67 and avoid spurious
redirects for URLs that do not match a controller but do not
have a valid language.

When the URL does not match any controller, the language
matcher tried to strip the leading path component, treating
it as a language code. For example:
    /fr_BE/page/homepage
would not match any route, so it would be rerouted internally
as  /page/homepage, after setting `request.lang` to fr_BE.

This breaks the magical 404 handler that allows ir.attachment
entries to be mapped to static URLs. Due to the internal rerouting,
the mapping of e.g. /website_mycompany/static/src/image/logo.png
would be rerouted to /static/src/image/logo.png and not match
the mapped URL anymore.

Now the stripping of the path component will only occur if
that path component matches an installed language code.

The consequence is that URLs containing uninstalled language codes
will now lead to 404 errors - an acceptable trade-off (e.g.
when an older version of the website is still indexed by a search
engine)
2015-05-05 10:12:22 +02:00
Jeremy Kersten aea358ca67 [FIX] website: ir_http - auto redirect for lang, use cookies to save pref language
Save in cookie the last lang selected to allow to stay consistent at the next visit from visitor
2015-04-29 14:19:52 +02:00
Jeremy Kersten 6ced9780e9 [IMP] ir_http: add facebookinternalhit in the list of bot.
Avoid redirect in en_US if lang is installed  when a link is added via Facebook
2015-04-24 12:31:42 +02:00
Jeremy Kersten 1e810a5493 [IMP] base: auto redirect if // in url
Redirect odoo.com/page//contactus ==> odoo.com/page/contactus

(only for get method)

Apache don't redirect but search for route with only one slash...
For SEO optimization, Odoo force a redirect permanently
2015-04-14 10:10:16 +02:00
Christophe Simonis 3206a35aed [MERGE] forward port of branch 8.0 up to 8ac8281 2015-04-13 12:07:58 +02:00
Xavier Morel 64a72d3780 [FIX] ir.http: avoid re-authing when not needed
The extra auth blows an environment and causes an extra query
of ``website`` before calling the controller.

The preceding two SQL queries likely can't be avoided: one uses uid1 to fetch
the current website's public user in order to set it, the other one
fetches the current website using the user set beforehand
2015-04-10 18:23:31 +02:00
Christophe Simonis db23690db3 [FIX] website: json are not multilang by default.
This avoid useless redirection.
2015-04-08 18:31:43 +02:00
Jeremy Kersten a696913364 [FIX] website: ir_http - no redirect for bot and save lang in cookie
Detect most of bots/crawlers to avoid auto redirect. Most bots fetch
with lang en_US, so even if default website lang was not in en_US,
googlebot was redirected to en_US page.

Now we keep also the language selected by user into a cookie.
If cookie exists but lang not in url, we redirect the user into
his preferred language.

Manage special case to allow to change the lang in url to set the
default lang at fly in url and set the cookie...

Many routes are not specified as multilang=False but should be.
With the auto redirection, we need to update these routes to avoid
useless redirects !
2015-04-08 15:39:57 +02:00
Raphael Collet 58d6bb30ab [FIX] ormcache: fix calls to ormcache with unexpected context parameter
The implementation of ormcache does not work on methods that take a context
parameter. Because of the decorator decorator, the arguments of the call are
passed positionally to the method ormcache.lookup, and positional arguments
are used in the cache key.

The fix consists in removing the context parameter from the faulty methods,
either directly, or by caching a private method called by the public method.
2015-03-26 18:44:51 +01:00
Christophe Simonis 313acf87a2 [MERGE] forward port of branch 8.0 up to d780014 2015-03-26 18:44:22 +01:00
FalcoBolger 95b921d0f7 [FIX] website: move support for ir.attachment resources to web module
Commit 540b753bf8 introduced
support for resources stored as ir.attachment records in
asset bundles too.
This is specifically useful for customizations.

However the HTTP route for reaching those resources
when they are *not* in a bundle was originally created
in the `website` module (as a special handling for
404 requests)

This means that these dynamic resources would only
be partially supported when `website` is not installed,
causing various problems:
 - missing resources in debug mode where bundles are skipped
 - errors when trying to define new client-side Qweb templates
   via XML resources - which are loaded with a direct request
 - ...

This commit moves back the supporting code to the web module.

The `mimetype` column is not present in ir.attachment without
the `website` module, but sniffing it based on the attachment
name works fine at serving time too.

Closes #6002
2015-03-26 17:33:19 +01:00
Goffin Simon 9850080eb0 [ADD] Versioning Module.
This module allow to make versioning and A/B testing of the website.
2015-01-16 23:13:58 +01:00
Christophe Simonis d248ae0669 Revert "[ADD] website_version: website versioning and ab testing"
With more than 100 comments on github[1], this commit is clearly not
production-ready.

This reverts commit c255b5bc34, reversing
changes made to e5ac65de59.

[1] https://github.com/odoo/odoo/commit/c255b5bc3461c803e38057c72c45530235de84dd
2015-01-08 14:49:18 +01:00
Jérome Maes ea82efe9a8 [FIX] ir_http : move the handeling of virtual path to ir_attachment from website to base. This will allow css generated from less to be called in the backend. 2015-01-07 18:32:00 +01:00
Goffin Simon 421a76dabb [ADD] Versioning Module. 2015-01-07 18:17:13 +01:00
Christophe Matthieu 196ecf17a1 [FIX] website: auto-increment when new page; fix link (key) search page 2015-01-05 10:17:10 +01:00
Jeremy Kersten 70ab2a6ed1 [IMP] ir_http: don't handle exception in dev mode but use the werkzeug debugger except if cause has been already identified (website Qweb) 2014-12-08 16:25:30 +01:00
Christophe Simonis 52fee2811d [MERGE] forward port of branch 8.0 up to 2b192be 2014-10-16 16:04:39 +02:00
Jeremy Kersten c8e14f301f [FIX] GeoIP - allow to specify the path to GeoIP in the server config.
--geoip_db='the_path'  which can be used via openerp.tool.config['geoip_database']
2014-10-13 16:47:12 +02:00
Fabien Meghazi 060fa29883 [FIX] request.website browse record bad context 2014-09-16 14:16:43 +02:00
Fabien Meghazi 819d1df642 [FIX] request.website browse record bad context 2014-09-16 14:12:00 +02:00
Goffin Simon 5f258c831e [WIP] Multi website 2014-09-16 14:11:08 +02:00
Olivier Dony 1d230f1222 [MERGE] Forward-port of 8.0 up to d32d120 2014-09-08 17:01:35 +02:00
Olivier Dony d32d120a0a [MERGE] Forward-port of saas-5 up to 9ce08b7 2014-09-08 16:54:10 +02:00
Fabien Meghazi c981d068ab [FIX] Restore /login redirection on SessionExpired
The feature was broken due to an incompatibility
when forward porting 624f256 and a78e27f
2014-09-05 16:24:59 +02:00
Christophe Simonis 31bf30d2d0 [MERGE] forward port of branch 8.0 up to ed1c173 2014-09-05 15:28:22 +02:00
Fabien Meghazi f2583323a9 [FIX] language and model converter redirections should use code=301 2014-08-27 14:05:09 +02:00
Jeremy Kersten 20d366595c [IMP] website: Redirect user in the language of the browser 2014-08-26 11:54:07 +02:00
Fabien Meghazi 709dc659b2 [IMP] Allow to specify http code for request.redirect() 2014-08-26 11:50:13 +02:00
Mohammed Shekha 997320e8ce [IMP] website: when no timezone in context, guess it from the
geoip data. This is used to find a timezone for public user.
2014-08-26 09:49:25 +02:00
Fabien Meghazi af3f56684f [FIX] Do not assume all exceptions with a code attribute to be HTTPExceptions 2014-08-20 15:24:34 +02:00
Denis Ledoux 7c647ec876 [MERGE] forward port of branch saas-4 up to 0a1e4a0 2014-08-08 17:27:29 +02:00