Commit Graph

361 Commits

Author SHA1 Message Date
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 bad13f0234 merge upstream 2014-06-23 10:07:56 +02:00
Franck Bret b4afff3618 Unify website slugify method behavior with or without python-slugify, and add some unit tests 2014-06-20 11:25:44 +02:00
Xavier Morel 56009e8804 [FIX] website: missing timezone conversion back to UTC
In t-field, datetime fields (formatted and not formatted versions) are
converted to the context/user's timezone (through
fields.datetime.context_timestamp) when displayed, but were saved without
converting back so the next display would go forward (or back) of the user's
tzoffset.

Fix that by applying context_timestamp's conversion backwards, from the
context/user's timezone back to UTC, before saving the field's value.
2014-06-18 16:09:02 +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 f15cbd6520 [MERGE] Forward-port saas-4 bugfixes up to ad4c6ca 2014-06-12 18:54:36 +02:00
Olivier Dony 6b85d80f23 [FIX] Wrap werkzeug.utils.escape() to accomodate signature change in 0.9
We always want to escape quotes (") as part of the process of
generating HTML output. This option (quote=True) turned into
an implicit flag with a DeprecationWarning in werkzeug 0.9.0
It is likely to disappear in a future release of werkzeug too.
A wrapper avoids this warning without loss of compatibility
2014-06-10 18:46:40 +02:00
Xavier Morel 46712acaec [FIX] bunch of changes lost in incorrect merge f4d78ae738 2014-05-30 17:00:52 +02:00
Xavier Morel d325c0caef [REV] attempt to revert incorrect removals in f4d78ae738 2014-05-30 16:00:28 +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
Xavier Morel e06f5b414b [IMP] inherit_option_id -> application 2014-05-27 12:13:51 +02:00
Xavier Morel d67161b649 [IMP] renamed some stuff for clarity 2014-05-27 11:57:06 +02:00
Xavier Morel da4441246e [IMP] use set to collect inherit_id and inherit_option_id
Also add a few comments to note understanding of code
2014-05-27 11:57:05 +02:00
Xavier Morel 4e3864c1fb [IMP] no need to ensure an actual context if the method does not use it
just forwarding the context object does not count as using it, if callees want
a context they can ensure they've got one on their own
2014-05-27 11:57:04 +02:00
Xavier Morel 85c466611a [IMP] don't pointlessly recreate view_obj every time _views_get is called, better use of pool & data APIs 2014-05-27 11:57:04 +02:00
Xavier Morel ad33728043 [IMP] use sorted + key instead of sort + cmp 2014-05-27 11:57:03 +02:00
Xavier Morel 3d91b2dfa2 [REM] unused stack_result parameter 2014-05-27 11:57:03 +02:00
Xavier Morel 327dda0bde [FIX] correctly handle invalid max_width/max_height passed to website._image 2014-05-23 15:11:13 +02:00
Xavier Morel 4362c6127f [IMP] use url_encode when building url query string
I have no idea why I originall implemented that crap via string munging.
2014-05-23 15:03:23 +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
Richard Mathot 1d70ecd80d [IMP] website: add max_height and max_width options to image Qweb widget 2014-05-23 11:55:48 +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
Christophe Simonis a756b82372 [MERGE] forward port of branch saas-4 up to revid bb26dea 2014-05-20 20:19:55 +02:00
Christophe Simonis 040c93026a [MERGE] merge bzr trunk addons branch 2014-05-20 18:10:36 +02:00
Fabien Meghazi 59bfda8efd Slug redirects loses query_string 2014-05-20 10:25:39 +02:00
Fabien Meghazi 2df2da6514 [FIX] properly set website_multilang attribute 2014-05-19 12:33:47 +02:00
Olivier Dony 6130ed3ce0 [IMP] website: refactor website_image controller (and placeholder), move to model to make it reusable
It is "almost" reusable because it still depends on the global `request` variable,
this could be solved by making it an explicit parameter.
2014-05-14 16:32:36 +02:00
Xavier Morel f4d78ae738 Merge branch 'server-trunk'
Conflicts:
	addons/mass_mailing/controllers/main.py
2014-05-14 15:13:04 +02:00
Fabien Meghazi c3cfc4bc32 [MERGE] sitemap backport, merge trunk from 9438 til 9440
merge from 9438 revid:fp@tinyerp.com-20140511115231-g8ke14r9iepyypv4 til 9440 revid:fp@tinyerp.com-20140511143314-nzn1239l00arbxjq
2014-05-13 16:38:31 +02:00
Fabien Meghazi 119823ab84 [IMP] Redirect to language-less url on default language 2014-05-13 12:07:29 +02:00
Fabien Meghazi c73a2f1c57 [FIX] restore request.website_multilang for templates 2014-05-13 12:07:20 +02:00
Fabien Meghazi 8eed143112 [IMP] Invert multilang logic in route decorator. True by default, can be set to False explicitlty 2014-05-13 11:35:45 +02:00
Fabien Meghazi 1d08697bc1 [FIX] Do not display language choice if multilang=False 2014-05-12 17:42:01 +02:00
Martin Trigaux 555d4879c8 Forward-port of latest saas-4, up to revision 9416 (rev-id fme@openerp.com-20140509164338-gnz7p3qxt8etrh5w)
bzr revid: mat@openerp.com-20140512072331-0lidgqb6x7fregdj
2014-05-12 09:23:31 +02:00
Fabien Pinckaers 105618443f [IMP] Sitemap
bzr revid: fp@tinyerp.com-20140511134037-84vnn1b4zfzk8som
2014-05-11 15:40:37 +02:00
Fabien Pinckaers 54d30d5194 [IMP] clean sitemap, enumerate pages + fixes
bzr revid: fp@tinyerp.com-20140511115231-g8ke14r9iepyypv4
2014-05-11 13:52:31 +02:00
Fabien Meghazi 501ad7abeb [IMP] dumb code
bzr revid: fme@openerp.com-20140509151855-7v4hp08qvmac1u2d
2014-05-09 17:18:55 +02:00
Fabien Meghazi 69a93b07c7 [MOV] ir.ui.view#write() forced noupdate moved in `website` (RTE only)
bzr revid: fme@openerp.com-20140509141024-xa9mawoye3o8e6c1
2014-05-09 16:10:24 +02:00
Fabien Meghazi f652660cb6 [FIX] is_multilang_url by checking against werkzeug's routing map using query string too
bzr revid: fme@openerp.com-20140509122323-2ext0livjgr5njb0
2014-05-09 14:23:23 +02:00
Fabien Meghazi 95e1bd0612 [REM] completetly removed website#preprocess_request()
bzr revid: fme@openerp.com-20140507170816-rrnh1nlqf97pfy3k
2014-05-07 19:08:16 +02:00
Antony Lesuisse 56eeefdfda [MERGE] trunk-websit-al-refactor by chm
- allow fiscal position change on sale orders
- public user on website
- simplify website_sale sale.order and shopping cart code
- remove preprocess_request

bzr revid: al@openerp.com-20140507153223-q73u5lhyrfw98o3a
2014-05-07 17:32:23 +02:00
Fabien Meghazi cf8cf4f255 [REM] preprocess_request from website
The method is still there with only a pass statement
Will completetly remove once chm merges his branch

bzr revid: fme@openerp.com-20140505163841-lstk3r37sf23ngrg
2014-05-05 18:38:41 +02:00
chm@openerp.com ee16b014b1 [MERGE] from trunk
bzr revid: chm@openerp.com-20140502095132-kfx40xou73mukr2y
2014-05-02 11:51:32 +02:00
Antony Lesuisse 7e25b9ae55 [MERGE] saas-4 report_webkit missing dependency on report
bzr revid: al@openerp.com-20140501152604-4cobh5ui47dt4pem
bzr revid: al@openerp.com-20140501155633-gefnc3zqcsr2rhaz
bzr revid: al@openerp.com-20140501161156-4wbsvhh8gz4r22h3
2014-05-01 18:11:56 +02:00
Fabien Pinckaers 1dd63bce78 [IMP] website images: allow no max_width (default), faster loading if no resize
bzr revid: fp@tinyerp.com-20140501114003-5xs31o0lzpp8ru2s
2014-05-01 13:40:03 +02:00
Fabien Meghazi 048c4c284b [FIX] Url mismatch redirection should only be done for GET and HEAD http verbs
bzr revid: fme@openerp.com-20140429095643-hmq1t45tgv3opyh8
2014-04-29 11:56:43 +02:00
Fabien Meghazi fdaa70f319 [REM] language passed as query param for bundles controllers
'translatable' has been removed from assets templates, no need for this anymore

bzr revid: fme@openerp.com-20140428124513-vlbm1hjsv9989den
2014-04-28 14:45:13 +02:00
chm@openerp.com 13469c23d8 [MERGE] from trunk
bzr revid: chm@openerp.com-20140424135841-akc01inl26fcirwy
2014-04-24 15:58:41 +02:00
Olivier Dony 3ad6d69b21 [FIX] website: avoid using werkzeug API only present in 0.9+
bzr revid: odo@openerp.com-20140424131415-ot0r5062wndvuicr
2014-04-24 15:14:15 +02:00
Fabien Meghazi 1d8400418e [MERGE] upstream
bzr revid: fme@openerp.com-20140423123744-zfz7k8drn2t624zu
2014-04-23 14:37:44 +02:00
Fabien Meghazi 7f29d7e371 [FIX] website: pass `lang` to js and css bundle controllers
bzr revid: fme@openerp.com-20140422135022-u9p7zofv5sbeqo30
2014-04-22 15:50:22 +02:00
Fabien Meghazi c117c3e10f [MOV] website: translatable context var from website#preprocess_request to ir.ui.view#render
bzr revid: fme@openerp.com-20140422134748-9niep8iyzx9ldq1l
2014-04-22 15:47:48 +02:00
chm@openerp.com aaa3265f47 [MERGE] from trunk
bzr revid: chm@openerp.com-20140411081401-0ybuuboo6f3b58kv
2014-04-11 10:14:01 +02:00
chm@openerp.com 7298130f31 [MERGE] from trunk
bzr revid: chm@openerp.com-20140410152925-ndajhnyh4rt8pkgu
2014-04-10 17:29:25 +02:00
chm@openerp.com 4dc3b139f3 [IMP] ir_qweb, ir_ui_view: can use id insead of xml_id; can render ir.ui.view many2one with widget='qweb' in template
bzr revid: chm@openerp.com-20140409104427-ut3r5acavyjsp6bj
2014-04-09 12:44:27 +02:00
chm@openerp.com d2407ec8c4 [MERGE] from trunk
bzr revid: chm@openerp.com-20140408154556-e4ud0kzyfcm13iui
2014-04-08 17:45:56 +02:00
chm@openerp.com 673dc5b1d7 [MERGE] from trunk
bzr revid: chm@openerp.com-20140408132412-7ofhd87laj3uoazj
2014-04-08 15:24:12 +02:00
Simon Lejeune 4983f86d81 [MERGE] trunk
bzr revid: sle@openerp.com-20140407174534-pk6b5lozvik78fom
2014-04-07 19:45:34 +02:00
Christophe Simonis 0fad8159f3 [MERGE] forward port of branch saas-3 up to revid 9380 chs@openerp.com-20140407144439-10n8fs6zovodwwtx
bzr revid: chs@openerp.com-20140407163318-hh3jwfkj3o2c83lk
2014-04-07 18:33:18 +02:00
chm@openerp.com ee4b879536 [IMP] website: media editor: insert add button for image loader and fix try_remove don't remove image
bzr revid: chm@openerp.com-20140407074922-zri6j4u9sw52nkkw
2014-04-07 09:49:22 +02:00
Simon Lejeune 8bf8e8a01c [FIX] website ir_qweb: do not crash if request is not bound when rendering a template
bzr revid: sle@openerp.com-20140402161349-ecm6pit20j44taf1
2014-04-02 18:13:49 +02:00
Olivier Dony f120d6ffb7 [FIX] ir.qweb: avoid errors with function fields of type datetime
bzr revid: odo@openerp.com-20140401160623-loj5nsph7tfnn1us
2014-04-01 18:06:23 +02:00
Fabien Meghazi b7fbef1241 [FIX] Serve ir.attachment with SUPERUSER_ID
We are not supposed to have a user id here

bzr revid: fme@openerp.com-20140326184022-1hulv7t5y6vuvr9y
2014-03-26 19:40:22 +01:00
Fabien Meghazi eb5cbea318 [MERGE] upstream
bzr revid: fme@openerp.com-20140326152433-vegu5tuvr8vc1s8v
2014-03-26 16:24:33 +01:00
Fabien Meghazi 0fe55dddc1 [IMP] Added a mimetype field in ir.attachment
bzr revid: fme@openerp.com-20140325160413-jvxjii6rbqcrjxor
2014-03-25 17:04:13 +01:00
chm@openerp.com 0d4d9af5f4 [FIX] website: fix and activate frontend test
bzr revid: chm@openerp.com-20140325140328-3f5is66d0petqrl6
2014-03-25 15:03:28 +01:00
Fabien Meghazi 329c19f94e [FIX] Fix url slug check bug in multilang=True
bzr revid: fme@openerp.com-20140325140026-0qdx9zl21za8gto9
2014-03-25 15:00:26 +01:00
Fabien Meghazi 8435da41bc [MERGE] upstream
bzr revid: fme@openerp.com-20140325103928-ja3bqy6xmyp91gva
2014-03-25 11:39:28 +01:00
Fabien Meghazi 27f38edb25 [FIX] dirty saas-3 fix for url lang switching with model converters
bzr revid: fme@openerp.com-20140325100722-temaci88fowcr2m5
2014-03-25 11:07:22 +01:00
chm@openerp.com 13d7cfe86c [MERGE] from trunk
bzr revid: chm@openerp.com-20140324082341-d6gqyloc7822aen2
bzr revid: chm@openerp.com-20140325084852-i1yomuyhyen4ss95
2014-03-25 09:48:52 +01:00
Simon Lejeune 9556cadbff [MERGE] trunk
bzr revid: sle@openerp.com-20140324162043-dzdwcxdt32sfjy57
2014-03-24 17:20:43 +01:00
Fabien Meghazi bb8b7ea2d9 [ADD] website ir_http: serve binary ir.attchments with urls
bzr revid: fme@openerp.com-20140324151728-hpegewvf3b38ndyi
2014-03-24 16:17:28 +01:00
Fabien Meghazi 9285813da9 [IMP] website images: only checksum ir.attachment for empty urls
bzr revid: fme@openerp.com-20140324151447-a3mkncjh0b7k16hg
2014-03-24 16:14:47 +01:00
Simon Lejeune 50fda546e2 [REF] Moved qweb contact from website to base and removed the from_html method (it never worked)
bzr revid: sle@openerp.com-20140324135933-f21heo0sz0tzjbv3
2014-03-24 14:59:33 +01:00
Christophe Simonis d93b79e6f4 [MERGE] forward port of branch saas-3 up to revid 9345 dle@openerp.com-20140324110349-e82t1bmmtjqbl85k
bzr revid: chs@openerp.com-20140324133811-4az1kvbznd26seow
2014-03-24 14:38:11 +01:00
Simon Lejeune 6b5986e34d [FIX] ir_http website postprocess args: do not redirect if the only difference between the url and the post-processed url is the url-enconding of some characters
bzr revid: sle@openerp.com-20140321120133-0k1zjsrtgwrw6oon
2014-03-21 13:01:33 +01:00
Xavier Morel a56dc53bea [REM] 4-spaces indent for web view pretty-print-before-save routine
Didn't quite work right: on the layout, it would exponentially increase
leading spaces in text nodes. Combined with a bug injecting snippets marks in
the footer (and thus invalidating and re-saving the layout at each snippet
addition) this could blow up the layout template and rendered page to >20MB.

Just keep lxml's standard 2-spaces indent.

LXML is unable to pretty print the layout anyway.

bzr revid: xmo@openerp.com-20140321075419-9w88h232r928xv5f
2014-03-21 08:54:19 +01:00
chm@openerp.com abe8e7208e [MERGE] from trunk
bzr revid: chm@openerp.com-20140318102102-ug0ny6q360i4o1e6
2014-03-18 11:21:02 +01:00
Xavier Morel 8ffc4d0a5a [ADD] support for presized fields in website/image
also add presized field to attachments (automatically computed from datas)

bzr revid: xmo@openerp.com-20140317104251-ddsa9cfpq1vkk2k1
2014-03-17 11:42:51 +01:00
Fabien Pinckaers d5c63e3205 [MERGE] trunk
bzr revid: fp@tinyerp.com-20140316122101-angijeo5fmr5j8v7
2014-03-16 13:21:01 +01:00
Fabien Pinckaers 675a71b2b8 [IMP] attachments on messages
bzr revid: fp@tinyerp.com-20140316113742-odae0ph3a1qrqn12
2014-03-16 12:37:42 +01:00
chm@openerp.com 353bbdc2c3 [FIX] website: route and redirect: remove all backslash from url
bzr revid: chm@openerp.com-20140314162346-25vohj6ayp65tgiy
2014-03-14 17:23:46 +01:00
chm@openerp.com 0bae967baa [MERGE] from trunk
bzr revid: chm@openerp.com-20140312154854-gtq7v1dxfnunkcz6
2014-03-12 16:48:54 +01:00
Fabien Meghazi b4ffbb4b35 [FIX] website#ir.http: do not postprocess arguments on non `website_enabled` endpoints
bzr revid: fme@openerp.com-20140312143539-bzf54zlzeawqkfuo
2014-03-12 15:35:39 +01:00
Christophe Simonis d504764eff [MERGE] forward port of branch saas-3 up to revid 9298 chm@openerp.com-20140311130852-3ft0v1mc9ht1any6
bzr revid: chs@openerp.com-20140311145205-s56fj113fsrnisc3
2014-03-11 15:52:05 +01:00
Fabien Meghazi 5e036bbf7c [FIX] Properly redirect in case of invalid url slugs
Use werkzeug's api instead of doing hackish url replacement

bzr revid: fme@openerp.com-20140310130530-e86cdwhdca9cs9g3
2014-03-10 14:05:30 +01:00
Xavier Morel 8ab5f3979b [ADD] deduplication of website images being uploaded
There is a deduplication in ir.attachment, but it's only for FS-stored content
*and* it only deduplicates storage not models (as there are access rights
issues involved).
  
The goal here is to always return the same attachment when a user uploads the
exact same image multiple times (because it's simpler or whatever).
  
Initially tried to use a binary field & digest(), but search() blows up
because it tries to utf-8 encode raw binary data. So use char & hexdigest
instead.
  
_compute_checksum returns None if the provided attachment data does not look
like a website image attachment.
  
Unhandled: multiple existing matches, maybe a UNIQUE constraint on the
checksum field would be a good idea just in case.

cherrypicked from saas-3's xmo@openerp.com-20140303153855-5f2l8v0jq2mgb26f
which had to be backed out (as the patch adds a new stored field)

bzr revid: xmo@openerp.com-20140304133117-r88p9zl2tc9tsh75
2014-03-04 14:31:17 +01:00
Xavier Morel a0feb7c3c9 [REV] backout xmo@openerp.com-20140303153855-5f2l8v0jq2mgb26f, schemas should not be altered in saas-3
bzr revid: xmo@openerp.com-20140304132101-qysq310wp1oo859n
2014-03-04 14:21:01 +01:00
Xavier Morel e78a3b18cc [ADD] tentative removal of attachments
Attachments ought be removed only if they are not used in an existing page/web
view.

Theoretically this could be set directly in unlink(), but:
* that would make a nice error message significantly harder
* the expenses of performing a text search in all view archs would be a bit expensive

Notes:
* the views set could be reduced to only "web" views
* the search is likely sensible to false negatives e.g. different order of
  query parameters. It *will* remove images still being used.

bzr revid: xmo@openerp.com-20140304110716-u14w6uo8fbkfa42i
2014-03-04 12:07:16 +01:00
Xavier Morel a99a15c960 [ADD] deduplication of website images being uploaded
There is a deduplication in ir.attachment, but it's only for FS-stored content
*and* it only deduplicates storage not models (as there are access rights
issues involved).

The goal here is to always return the same attachment when a user uploads the
exact same image multiple times (because it's simpler or whatever).

Initially tried to use a binary field & digest(), but search() blows up
because it tries to utf-8 encode raw binary data. So use char & hexdigest
instead.

_compute_checksum returns None if the provided attachment data does not look
like a website image attachment.

Unhandled: multiple existing matches, maybe a UNIQUE constraint on the
checksum field would be a good idea just in case.

bzr revid: xmo@openerp.com-20140303153855-5f2l8v0jq2mgb26f
2014-03-03 16:38:55 +01:00