Commit Graph

30 Commits

Author SHA1 Message Date
Christophe Simonis 0161666e8b [MERGE] forward port of branch saas-3 up to revid 5112 chs@openerp.com-20140407144238-3s38zadkh7yxpdy7
bzr revid: chs@openerp.com-20140407160548-ttuc877kknuycoqw
2014-04-07 18:05:48 +02:00
Olivier Dony 8809c77f60 [FIX] http,ir.http: refactor exception handling to allow request-specific handling
Typically an exception during a JSON-RPC request must be
handled specifically and return a JSON-RPC error in all
cases. Previously the _authenticate() step could fail
during ir_http.dispatch() and bubble up to werkzeug,
yielding a dumb "Internal Server Error 500" even for
a JSON-RPC request.

bzr revid: odo@openerp.com-20140328142748-00haplmkc3fv6f9y
2014-03-28 15:27:48 +01:00
Christophe Simonis 96f744b271 [MERGE] forward port of branch saas-3 up to revid 5088 chs@openerp.com-20140311095550-lg3nvvjyojvgp2po
bzr revid: chs@openerp.com-20140311133850-11bw9vv90e40clw1
2014-03-11 14:38:50 +01:00
Fabien Meghazi 35d87dd19b [IMP] ir.http: provide current rule to argument postprocessing
bzr revid: fme@openerp.com-20140310130349-x4qxpcmyrcejywlz
2014-03-10 14:03:49 +01:00
Olivier Dony 55270edc3c [FIX] ir.http.authenticate: avoid discarding sessions when authentication status is unknown
In some cases the authentication check can fail
for an unknown reason (e.g. connection pool is
temporarily full). This should not be treated
as an authentication failure, as the status is
really unknown. Let those exceptions bubble up
instead.

bzr revid: odo@openerp.com-20140228170712-l8smq6u3cmvjtd5e
2014-02-28 18:07:12 +01:00
Antony Lesuisse 91b1c8472f [FIX] ir.http testing generate a router including the current module
this fix is a dirty hack, the proper fix could be a new 'installing' state in
modules, or an improved registry object.

bzr revid: al@openerp.com-20140217005137-mhrzc4znr8rqe9yu
2014-02-17 01:51:37 +01:00
Christophe Simonis 7a0262a4d5 [FIX] allow "none" route to be accessible when logged in
bzr revid: chs@openerp.com-20140130162626-z83x9e6ekdfqku0a
2014-01-30 17:26:26 +01:00
Fabien Meghazi 1daa7db8b0 [REM] Removed disabled_db=True from ir_http's auth="none"
[MOV] ensure_db() helper from http module to web module

Since we removed auth="admin" in favor of auth="none" with explicit superuser id usage,
the disable_db clause in auth_none() has only sense for the /web and /web/login routes.
The web module is an exception because it's routes are registered for the nodb dispatching.
This is why the ensure_db() helper is moved to web client and will take care of the
web's auth="none" routes that needs a db to work with

bzr revid: fme@openerp.com-20140130092152-h6elwf2yerhd9xey
2014-01-30 10:21:52 +01:00
Fabien Meghazi 04a52645c0 [REM] auth="admin" removed
bzr revid: fme@openerp.com-20140129171933-e61qp9p5xfdwyw89
2014-01-29 18:19:33 +01:00
jke-openerp 9a8a6a5484 [REF] Add public_user into module server/addons/base (removed from addons/website/website_data.xml)
[REF]Add _auth_method_public  into server/addons/base/ir/ir_http (removed from website/ir_http)

Related commit for Addons : Committed revision 10689.

bzr revid: jke@openerp.com-20140128145510-3byhdmwftloeod6s
2014-01-28 15:55:10 +01:00
Fabien Meghazi bfeec4808b [REM] Removed todo, slug feature supported in addons.website.ir_http
bzr revid: fme@openerp.com-20140127132752-par38qbtnf21yzfs
2014-01-27 14:27:52 +01:00
Fabien Meghazi a969be4c38 [IMP] _handle_exception can also return a response
bzr revid: fme@openerp.com-20140127131333-pl0cminocjfopxaa
2014-01-27 14:13:33 +01:00
Fabien Meghazi 2b6ac77f11 [IMP] move dispatch()'s post processing code into a method
bzr revid: fme@openerp.com-20140124103546-h8an7dehqdc412cn
2014-01-24 11:35:46 +01:00
Fabien Meghazi 35050c4ba0 IMP] Launch a 404 when ModelConverter's browse records can't resolve _rec_name. Also serves as automatic preload
bzr revid: fme@openerp.com-20140123151207-3wp77801g44b2822
2014-01-23 16:12:07 +01:00
Fabien Meghazi 8702ef5d3b [CHG] Allow @http.route() to use additional parameters and inherits them properly
bzr revid: fme@openerp.com-20140120153614-t8l7tfit686ehfn0
2014-01-20 16:36:14 +01:00
Fabien Meghazi cee6749395 [IMP] ir_http._handle_exception() raises last exception in order to keep original traceback
bzr revid: fme@openerp.com-20140116135426-x7q8l6ph2m1ln8ry
2014-01-16 14:54:26 +01:00
Xavier Morel 0546993327 [FIX] merge from trunk and fix handling of view inheritance
main problem, view inheritance model field would use model from the
root view (after following inherit_id links) rather than the base view
(the requested one) -> with divergent models, it was possible for the
requested view itself to never be returned.

bzr revid: xmo@openerp.com-20131212134422-uxg6h21w1jhth9ow
2013-12-12 14:44:22 +01:00
Fabien Meghazi 72e67607f1 [REM] Removed exception handling in the wrong place. Will move 403 check on website addon
bzr revid: fme@openerp.com-20131205150504-x33i83gxt10w9hkm
2013-12-05 16:05:04 +01:00
Christophe Simonis 51e05e068b [FIX] ir.http: catch all authentification errors
bzr revid: chs@openerp.com-20131204102430-qxqk8qtze5n5rqe8
2013-12-04 11:24:30 +01:00
Antony Lesuisse 43979cfd8f [IMP] http improvement
- context manager request object (removes some ugly hacks)
- improve http error handling
- add lazyresponses

bzr revid: al@openerp.com-20131203190639-e8r1qm9wc82t8g4k
2013-12-03 20:06:39 +01:00
Christophe Simonis 28581cc734 [MERGE] manual forward port of changes made in http dispatching in saas-2 branch since last web revid 3865 dle@openerp.com-20131023113414-mlwppd4d7vyh1tyj
bzr revid: chs@openerp.com-20131125165804-0d25q1vn5z0y9nv8
2013-11-25 17:58:04 +01:00
Xavier Morel 0ece469392 [FIX] bunch of broken stuff over http requests in new routing thing
* make ModelConverter use its regex for data extraction so
  replacements can just fixup the request and don't have to mess with
  _uid

* replace routing_map property by method, for unknown reasons the
  property does not work at least overridden (it's not found) and I
  don't care enough to wonder why

* arguments result from MapAdapter.match() is a mapping, not a
  sequence. Iterate through values()/itervalues() otherwise we'll
  never get a browse_record to do the uid substitution on, only
  strings (params names)

* inject arguments from URL map/match into the function before
  executing it, this was apparently lost during the transition

* reintroduce get_db_router for third-party code needing to generate
  URLs

bzr revid: xmo@openerp.com-20131115124819-bp4gjpfdlda2qyf5
2013-11-15 13:48:19 +01:00
Xavier Morel 321d4681e1 [IMP] new routing thing
* fix nameerror on SessionExpired exception not being imported
* remove pointless RequestUID instantiation by single placeholder object
  - may be replaceable with a LocalProxy or something along those lines?
* rename default/nodb routing map
* make better use of werkzeug API
* move lazy routing_map instantiation to property in ir_http.find_handler
  - do we have some sort of lazy_property?

bzr revid: xmo@openerp.com-20131115100901-s3skmwv9d1jgk9y0
2013-11-15 11:09:01 +01:00
Antony Lesuisse ee4c1f702e [IMP] http move db dispatching to AbstractModel ir.http
Allow module to override the http dispatching process:
- The default implementation uses werkzeug.routing but any other method could
  be used, it'a also possible to pre/postprocess (i.e. url aliases)
- Authentication (auth param on route) is plugggable by defining now
  _auth_method_<methodname>
- Error handler are overridable, any module can define a new exception and
  handle it by orverriding the _handle_<error_code> method.
- Add model converters for routes, to directly get the browse record example
  @route(['/job/detail/<model("hr.job"):job>'], type='http', auth="user")

This is done by splitting dispatching, when the db is unknown low level http.py
dispatching is used, it's only used by a few controller in base and web. When
the db is known, ir_http is used because it's a regular Model it is fully
overridable by openerp modules.

bzr revid: al@openerp.com-20131110142731-qi9910fkty25cdtd
2013-11-10 15:27:31 +01:00
Antony Lesuisse 5f9ef80d70 [FIX] make routing converters modular
bzr revid: al@openerp.com-20131110141250-myreqy8ofvpj2r0u
2013-11-10 15:12:50 +01:00
Antony Lesuisse 575376ef29 [FIX] http.py use checked_call for concurrency retry and exception handling
bzr revid: al@openerp.com-20131110140757-tbe8yondadokd4ke
2013-11-10 15:07:57 +01:00
Antony Lesuisse 7f3133e423 [IMP] ir_http better exception handling for http errors
bzr revid: al@openerp.com-20131110135739-2tmr6iynil16ooi1
2013-11-10 14:57:39 +01:00
Antony Lesuisse c396149f4f [FIX] use AbstractModel, use session.db to ir_http dispatch for none controllers
bzr revid: al@openerp.com-20131110135406-r0cyxhnve3jl8r2i
2013-11-10 14:54:06 +01:00
Antony Lesuisse afbec17f77 [IMP] model converters for routes, to directly get the browse record
example @route(['/job/detail/<model("hr.job"):job>'], type='http', auth="user")

bzr revid: al@openerp.com-20131110123707-yb3hbdqlo063dj64
2013-11-10 13:37:07 +01:00
Antony Lesuisse d50577b69d [IMP] http move db dispatching on the orm level
Split low level dispatching and high level dispatching.
Low level dispatching is used when the db is unknown it's only used by a few
controller in base and web.
High level dispatching is used when the db is known, it is used by most
controllers and it handles authentication and errors. Because it's a regular
osv object all it is fully overridable by openerp modules.

bzr revid: al@openerp.com-20131110014609-io03vspj2q1wtqa0
2013-11-10 02:46:09 +01:00