Cédric Krier pushed to branch branch/6.0 at Tryton / Tryton
Commits:
f2ab7fdb by Sergi Almacellas Abellana at 2023-05-25T15:55:40+02:00
Manage empty stock end date values on location quantities
Closes #12289
(grafted from 7909707c00f7eaf784ff64243b38b007532655d0)
- - - - -
1554d10f by Maxime Richez at 2023-06-01T08:48:45+02:00
Use selection widget for weekday on currency cron form
Closes #12292
(grafted from af1cbfe620461274b7a692a8f443f3ead8189222)
- - - - -
fffca9a2 by Cédric Krier at 2023-05-08T13:21:10+02:00
Parse authorization header for session scheme without token
Since Werkzeug >= 2.3, it always tries to parse the Authorization header as a
digest. If the session value which is encoded in base64 needs padding, the
trailing `=` are interpreted as header values and the token attribute is not
filled.
In this case we must parse ourself the Authorization header to decode the
base64 value as session.
Closes #12259
(grafted from 0bd0b8a0e20ad8d2f3d13cc8d879c78717817b7a)
- - - - -
0a48d203 by Cédric Krier at 2023-06-09T08:17:20+02:00
Do not try to login if Authorization has no username
User application request has an Authorization header so an Authorization
instance is returned but it can not be used for login.
Closes #12312
(grafted from 0a4e13728c0a9bb24536cb1033d95ca6749a2b9d)
- - - - -
3 changed files:
- modules/currency/view/cron_form.xml
- modules/stock/location.py
- trytond/trytond/protocols/wrappers.py
Changes:
=====================================
modules/currency/view/cron_form.xml
=====================================
@@ -8,7 +8,7 @@
<group id="frequency" col="-1">
<field name="frequency"/>
<label name="weekday"/>
- <field name="weekday"/>
+ <field name="weekday" widget="selection"/>
<label name="day"/>
<field name="day"/>
</group>
=====================================
modules/stock/location.py
=====================================
@@ -407,7 +407,7 @@
context = {}
if (name == 'quantity'
- and (trans_context.get('stock_date_end', datetime.date.max)
+ and ((trans_context.get('stock_date_end') or datetime.date.max)
> Date_.today())):
context['stock_date_end'] = Date_.today()
@@ -495,7 +495,7 @@
return Template(trans_context['product_template'])
context = {}
- if 'stock_date_end' in trans_context:
+ if trans_context.get('stock_date_end') is not None:
# Use the last cost_price of the day
context['_datetime'] = datetime.datetime.combine(
trans_context['stock_date_end'], datetime.time.max)
=====================================
trytond/trytond/protocols/wrappers.py
=====================================
@@ -77,7 +77,13 @@
header = self.headers.get('Authorization')
return parse_authorization_header(header)
elif authorization.type == 'session':
- return parse_session(authorization.token)
+ # Werkzeug may parse the session as parameters
+ # if the base64 uses the padding sign '='
+ if authorization.token is None:
+ header = self.headers.get('Authorization')
+ return parse_authorization_header(header)
+ else:
+ return parse_session(authorization.token)
return authorization
@cached_property
@@ -95,7 +101,7 @@
user_id = security.check(
database_name, auth.get('userid'), auth.get('session'),
context=context)
- else:
+ elif auth.username:
parameters = getattr(auth, 'parameters', auth)
try:
user_id = security.login(
@@ -103,6 +109,8 @@
context=context)
except RateLimitException:
abort(HTTPStatus.TOO_MANY_REQUESTS)
+ else:
+ user_id = None
return user_id
@cached_property
View it on Heptapod:
https://foss.heptapod.net/tryton/tryton/-/compare/b3c8d1ed90e4f3ce85a4ba05d21a0c5fff5e164c...0a48d203dc53b998676b2ce3855b4f4380a74f1a
--
View it on Heptapod:
https://foss.heptapod.net/tryton/tryton/-/compare/b3c8d1ed90e4f3ce85a4ba05d21a0c5fff5e164c...0a48d203dc53b998676b2ce3855b4f4380a74f1a
You're receiving this email because of your account on foss.heptapod.net.