Commit Graph

108 Commits

Author SHA1 Message Date
Olivier Dony 8d745f9f50 [FIX] account, mail, etc.: uniformize evaluated expressions
opw-626694
2015-05-21 15:26:35 +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
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
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
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
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
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
Denis Ledoux 7c647ec876 [MERGE] forward port of branch saas-4 up to 0a1e4a0 2014-08-08 17:27:29 +02:00
Jeremy Kersten 05f9b45ef1 [FIX] slug: fallback to positive ID when slug appears to contain a missing negative ID
Cherry-pick from dcac4cc0df
2014-08-05 10:26:03 +02:00
Olivier Dony dcac4cc0df [FIX] website: slug: fallback to positive ID when slug appears to contain a missing negative ID
In some rare cases database records have negative IDs,
so the slug URL could look like /foo--20. This could
be mistaken for a slug ending with a `-` and a positive ID.
The latter is not supposed to happned as final hyphens
are stripped by slugify, but has been used in the past
and may be used in old links.
2014-08-01 15:08:33 +02:00
Christophe Simonis fd4fd35e32 [MERGE] forward port of branch saas-5 up to e4cb520 2014-07-30 20:52:14 +02:00
Christophe Simonis e4cb5202a0 [MERGE] forward port of branch saas-4 up to fa07bc8 2014-07-30 20:30:14 +02:00
Christophe Simonis fa07bc8532 [MERGE] forward port of branch saas-3 up to 310d3fe 2014-07-30 19:09:33 +02:00
Christophe Simonis c6f91facbb [FIX] website: do not restore page views 2014-07-30 15:10:22 +02:00
Jeremy Kersten faba7cd5aa [IMP] Crm: Add tracking mixin to manage utm campaign and add this mixin to mass_mailing, crm_lead and sale_order 2014-07-08 17:33:00 +02:00
Raphael Collet cbe2dbb672 [MERGE] new v8 api by rco
A squashed merge is required as the conversion of the apiculture branch from
bzr to git was not correctly done. The git history contains irrelevant blobs
and commits. This branch brings a lot of changes and fixes, too many to list
exhaustively.

- New orm api, objects are now used instead of ids
- Environements to encapsulates cr uid context while maintaining backward compatibility
- Field compute attribute is a new object oriented way to define function fields
- Shared browse record cache
- New onchange protocol
- Optional copy flag on fields
- Documentation update
- Dead code cleanup
- Lots of fixes
2014-07-06 17:05:41 +02:00
Olivier Dony d9cda97cf4 [MERGE] Forward-port saas-4 up to 5ceded9 2014-07-05 01:28:19 +02:00
Jeremy Kersten e77594c3c3 [IMP] website: backport 5112421a (unslug)
Update the regexp to be not case sensitive
2014-06-30 18:29:20 +02:00
Christophe Simonis 1f57528bc6 [MERGE] forward port of branch saas-5 up to 8dfd5ea 2014-06-27 16:14:40 +02:00
Christophe Simonis 8dfd5eab01 [MERGE] forward port of branch saas-4 up to a4bc65c 2014-06-27 16:08:09 +02:00
Christophe Simonis a4bc65cdba [MERGE] forward port of branch saas-3 up to bdc4dd4 2014-06-27 16:06:37 +02:00
Olivier Dony a7aa853737 [FIX] website: exception handling: let redirects pass untouched
The website module normally tries to render user-friendly
error pages for any error occurring during the processing
of a website-enabled request.
This happens even for werkzeug's HTTPExceptions that have
their own response, because we want the website layout to
be applied on top of the error page.

One special sort of HTTPException should be preserved
without rewriting: the manually-crafted ones generated
with abort(), and usually wrapping a redirect response,
which bears no alteration.
2014-06-27 13:04:31 +02:00
Christophe Simonis 3db44722d4 [FIX] website: correct geoip resolver
- "`record_by_addr()` method require the city database.
- The loaded geoip database can be specified via config file
2014-06-27 12:46:56 +02:00
Antony Lesuisse 893aace122 [MERGE] website_sale optional-products 2014-06-26 12:31:15 +02:00
Olivier Dony 668b8c2b2d [FIX] Forward-port of saas-5 up to 0d330ca 2014-06-25 18:58:19 +02:00
Olivier Dony 0d330ca25c [MERGE] Forward-port of saas-4 up to fa739ac 2014-06-25 18:44:51 +02:00
Olivier Dony fa739ac8de [FIX] website: default mimetype for web-published attachments, avoids crash 2014-06-25 18:37:03 +02:00
Olivier Dony 4d488408b2 [MERGE] Forward-port of saas-3 up to 141e1b2 2014-06-25 18:34:03 +02:00
Fabien Meghazi f988d75035 [FIX] check after openerp's AccessErrors in website's _handle_exception 2014-06-25 12:20:40 +02:00
Christophe Matthieu f0ca6fbf75 merge upstream 2014-06-25 12:02:10 +02:00
Fabien Meghazi 4e0799e163 [FIX] _handle_exception() logic amongst requests and ir_http objects
Changes in website's ir_http#_handle_exception():

- exception is mandatory, can't be None anymore
- we don't touch non website_enabled requests
- we don't touch explicits plain responses from parent
- logic flow is now easier to read (I hope so)

Change in website's ir_http#_dispatch():

- In case of real 404, instead of returning self._handle_exception(),
  just let parent do the job (so we call super())
2014-06-25 11:47:44 +02:00
Christophe Simonis 5112421a93 [FIX] website: correct slug parsing 2014-06-25 11:08:51 +02:00
Christophe Matthieu 204a62499a [IMP] website_sale_options 2014-06-24 15:11:53 +02:00
Christophe Matthieu 6ba14b38cb [FIX] website: geoip can't be none 2014-06-18 15:43:28 +02:00
Christophe Matthieu 890a9ac652 [IMP] website: set geoip in user session 2014-06-18 14:50:24 +02:00
Xavier Morel 1587663fd2 [FIX] postprocessing of request arguments in website
If website is installed but not used/enabled for the current controller,
overridden methods like _get_converters will *still run* for the controller's
dispatch.

This means a ModelConverter used in a controller with website installed but
not enabled will use website.models.ir_http.ModelConverter, not
base.ir.ir_http.ModelConverter, and base's args postprocessing will *not* be
able to convert the placeholder object to a real UID, only website's
postprocessing can do so.

And as far as I can see there's no reason to skip the URL building validation
either, only the multilang stuff relies on and requires that the controller be
website enabled (and in fact that it be multilang enabled), so only *that*
should be gated behind a flag.

Also always call super(), there's no reason not to and others might add args
to postprocess on base rather than website, ending up after website in the
MRO.
2014-06-13 16:11:56 +02:00
Olivier Dony 04211015fc [MERGE] Forward-port of latest saas-4 fixes, up to 0452851 2014-05-27 20:49:49 +02:00
Christophe Simonis 045285123f [FIX] website: correct bad code indentation introduced during previous commit 2014-05-27 18:46:18 +02:00
Olivier Dony fd21abd847 [MERGE] Forward-port latest saas-3 bugfixes, up to 30f43da 2014-05-27 17:18:43 +02:00
Denis Ledoux 51c7b55da0 [FIX] request.handle_exception: cleanup override logic, fixed chain broken by commit a096ae0
handle_exception() is supposed to try handling an exception and if it cannot,
re-raise it. Overridden methods must therefore call super() within a try/except
block, and only attempt to handle the exception if super() raised.
2014-05-23 13:15:52 +02:00
--global 62c0f6bf11 [FIX] website: ir_http: when rerouting url containing default language -> url without language, the ? was missing, leading to wrong urls. 2014-05-23 10:39:26 +02:00
Denis Ledoux c0e9a15960 [MERGE] Forward-port of latest saas-3 bugfixes, up to rev. a096ae0080 2014-05-22 09:35:26 +02:00
Martin Trigaux a096ae0080 [FIX] http: force rolleback for failed http request
1st issue:
When an exception was raised, it was badly handled by the website in case of
website_enabled key. The response page was generated without calling super.
The WebRequest object being responsible to rollback the transaction in case
of errors.

2sd issue:
The _failed attribute is required to rollback the transaction in an WebRequest
object. Previously it was only set in the JsonRequest object (which inherit
from WebRequest), replace by call to super. The attribute _failed is now set
in the WebRequest object.
2014-05-21 19:12:37 +02:00