Commit 41b6d94e authored by Jérome Perrin's avatar Jérome Perrin

Merge remote-tracking branch 'origin/master' into zope4py2

parents 4cc80b95 143321c2
portal_components/document.erp5.RoundingModel portal_components/document.erp5.RoundingModel
portal_components/document.erp5.RoundingTool portal_components/tool.erp5.RoundingTool
portal_components/interface.erp5.IRoundingTool portal_components/interface.erp5.IRoundingTool
portal_introspections portal_introspections
portal_memcached/persistent_memcached_plugin portal_memcached/persistent_memcached_plugin
......
...@@ -555,6 +555,11 @@ def renderField(traversed_document, field, form, value=MARKER, meta_type=None, ...@@ -555,6 +555,11 @@ def renderField(traversed_document, field, form, value=MARKER, meta_type=None,
result.update({ result.update({
"maxlength": field.get_value("display_maxwidth"), "maxlength": field.get_value("display_maxwidth"),
}) })
if meta_type == "IntegerField":
result.update({
"min": field.get_value("start"),
"max": field.get_value("end"),
})
if meta_type == "FloatField": if meta_type == "FloatField":
result.update({ result.update({
"precision": field.get_value("precision"), "precision": field.get_value("precision"),
...@@ -2107,7 +2112,7 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None, ...@@ -2107,7 +2112,7 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
# Include cell error text in case of form validation # Include cell error text in case of form validation
if field_errors.has_key('%s_%s' % (editable_field.id, brain_uid)): if field_errors.has_key('%s_%s' % (editable_field.id, brain_uid)):
contents_item[select]['field_gadget_param']["error_text"] = \ contents_item[select]['field_gadget_param']["error_text"] = \
field_errors['%s_%s' % (editable_field.id, brain_uid)].error_text Base_translateString(field_errors['%s_%s' % (editable_field.id, brain_uid)].error_text)
# Do not generate link for empty value, as it will not be clickable in UI # Do not generate link for empty value, as it will not be clickable in UI
......
...@@ -130,7 +130,7 @@ Selenium.prototype.assertFloatValue = function(locator, text) { ...@@ -130,7 +130,7 @@ Selenium.prototype.assertFloatValue = function(locator, text) {
* Checks the portal status message. * Checks the portal status message.
*/ */
Selenium.prototype.assertPortalStatusMessage = function(text) { Selenium.prototype.assertPortalStatusMessage = function(text) {
var psm_locator = "//div[@id='transition_message']"; var psm_locator = "css=div.transition_message";
var actualValue = getText(this.page().findElement(psm_locator)); var actualValue = getText(this.page().findElement(psm_locator));
Assert.matches(text, actualValue); Assert.matches(text, actualValue);
}; };
......
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
name: field_json.key, name: field_json.key,
title: field_json.description, title: field_json.description,
hidden: field_json.hidden, hidden: field_json.hidden,
min: field_json.min,
max: field_json.max,
// Force calling subfield render // Force calling subfield render
// as user may have modified the input value // as user may have modified the input value
render_timestamp: new Date().getTime() render_timestamp: new Date().getTime()
......
...@@ -220,7 +220,7 @@ ...@@ -220,7 +220,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>zope</string> </value> <value> <string>valentin</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -234,7 +234,7 @@ ...@@ -234,7 +234,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>988.26496.42040.8686</string> </value> <value> <string>990.12355.17861.39304</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -252,7 +252,7 @@ ...@@ -252,7 +252,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1609253348.53</float> <float>1651759968.58</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -34,6 +34,8 @@ ...@@ -34,6 +34,8 @@
hidden: options.hidden, hidden: options.hidden,
trim: options.trim || false, trim: options.trim || false,
maxlength: options.maxlength, maxlength: options.maxlength,
min: options.min,
max: options.max,
multiple: options.multiple, multiple: options.multiple,
accept: options.accept, accept: options.accept,
capture: options.capture, capture: options.capture,
...@@ -93,6 +95,12 @@ ...@@ -93,6 +95,12 @@
if (this.state.maxlength) { if (this.state.maxlength) {
textarea.setAttribute('maxlength', this.state.maxlength); textarea.setAttribute('maxlength', this.state.maxlength);
} }
if (this.state.min !== "") {
textarea.setAttribute('min', this.state.min);
}
if (this.state.max !== "") {
textarea.setAttribute('max', this.state.max);
}
if (this.state.multiple) { if (this.state.multiple) {
textarea.multiple = true; textarea.multiple = true;
......
...@@ -220,7 +220,7 @@ ...@@ -220,7 +220,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>zope</string> </value> <value> <string>valentin</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -234,7 +234,7 @@ ...@@ -234,7 +234,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>990.28219.58167.35225</string> </value> <value> <string>1000.3604.26762.29934</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -252,7 +252,7 @@ ...@@ -252,7 +252,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1614695141.57</float> <float>1651848322.15</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
import re
from ZTUtils import make_query
portal = context.getPortalObject()
# XXX Hardcoded behaviour for JS app.
# Expect came_from to be an URL template
person = portal.portal_membership.getAuthenticatedMember().getUserValue()
url_parameter = "n.me"
pattern = '{[&|?]%s}' % url_parameter
if (person is None or not portal.portal_membership.checkPermission('View', person)):
came_from = re.sub(pattern, '', came_from)
else:
prefix = "&" if "&%s" % url_parameter in came_from else "?"
came_from = re.sub(pattern, '%s%s' % (prefix, make_query({url_parameter: person.getRelativeUrl()})), came_from)
return came_from
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>came_from</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>WebSection_renderCameFromURITemplate</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
import re
REQUEST = context.REQUEST REQUEST = context.REQUEST
RESPONSE = REQUEST.RESPONSE RESPONSE = REQUEST.RESPONSE
from ZTUtils import make_query
portal = context.getPortalObject() portal = context.getPortalObject()
...@@ -35,16 +33,7 @@ else: ...@@ -35,16 +33,7 @@ else:
# XXX How to warn user that password will expire? # XXX How to warn user that password will expire?
# is_user_account_password_expired_expire_date = REQUEST.get('is_user_account_password_expired_expire_date', 0) # is_user_account_password_expired_expire_date = REQUEST.get('is_user_account_password_expired_expire_date', 0)
# XXX Hardcoded behaviour for JS app. came_from = context.WebSection_renderCameFromURITemplate(came_from)
# Expect came_from to be an URL template
person = portal.portal_membership.getAuthenticatedMember().getUserValue()
url_parameter = "n.me"
pattern = '{[&|?]%s}' % url_parameter
if (person is None or not portal.portal_membership.checkPermission('View', person)):
came_from = re.sub(pattern, '', came_from)
else:
prefix = "&" if "&%s" % url_parameter in came_from else "?"
came_from = re.sub(pattern, '%s%s' % (prefix, make_query({url_parameter: person.getRelativeUrl()})), came_from)
# RESPONSE.redirect(came_from or context.getPermanentURL(context)); # RESPONSE.redirect(came_from or context.getPermanentURL(context));
RESPONSE.setHeader('Location', came_from or context.getPermanentURL(context)) RESPONSE.setHeader('Location', came_from or context.getPermanentURL(context))
RESPONSE.setStatus(303) RESPONSE.setStatus(303)
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
<section tal:condition="not: portal/portal_membership/isAnonymousUser"> <section tal:condition="not: portal/portal_membership/isAnonymousUser">
<p i18n:domain="ui" i18n:translate="" >It seems you're already authenticated.</p> <p i18n:domain="ui" i18n:translate="" >It seems you're already authenticated.</p>
<p><a tal:condition="exists: request/came_from" <p><a tal:condition="exists: request/came_from"
tal:attributes="href request/came_from" >Go back</a></p> tal:attributes="href python:context.WebSection_renderCameFromURITemplate(request.came_from)" >Go back</a></p>
</section> </section>
<section tal:condition="portal/portal_membership/isAnonymousUser"> <section tal:condition="portal/portal_membership/isAnonymousUser">
...@@ -81,6 +81,8 @@ ...@@ -81,6 +81,8 @@
<a tal:attributes="href string:${current_url}/ERP5Site_redirectToFacebookLoginPage" <a tal:attributes="href string:${current_url}/ERP5Site_redirectToFacebookLoginPage"
i18n:translate="" i18n:translate=""
i18n:domain="ui" i18n:domain="ui"
class="sign_in_with_facebook"
> >
<img alt="Login with Facebook" src="facebook_login_button.png"> <img alt="Login with Facebook" src="facebook_login_button.png">
</a> </a>
...@@ -90,6 +92,8 @@ ...@@ -90,6 +92,8 @@
<a tal:attributes="href string:${current_url}/ERP5Site_redirectToOpenIdLoginPage" <a tal:attributes="href string:${current_url}/ERP5Site_redirectToOpenIdLoginPage"
i18n:translate="" i18n:translate=""
i18n:domain="ui" i18n:domain="ui"
class="sign_in_with_openid"
> >
<img alt="Sign in with OpenID Connect" src="openid_login_button.png"/> <img alt="Sign in with OpenID Connect" src="openid_login_button.png"/>
......
...@@ -76,4 +76,4 @@ class ActivityBuffer(TM): ...@@ -76,4 +76,4 @@ class ActivityBuffer(TM):
def sortKey(self, *ignored): def sortKey(self, *ignored):
"""Activities must be finished before databases commit transactions.""" """Activities must be finished before databases commit transactions."""
return '-1' return -1
...@@ -34,7 +34,7 @@ from Acquisition import aq_parent ...@@ -34,7 +34,7 @@ from Acquisition import aq_parent
# If the sort order below doesn't work, we cannot guarantee the sort key # If the sort order below doesn't work, we cannot guarantee the sort key
# used below will actually result in the activity connection being committed # used below will actually result in the activity connection being committed
# after the ZODB and Catalog data. # after the ZODB and Catalog data.
assert '\x00' < '-1' < '0' < '1' < '\xff', "Cannot guarantee commit of activities comes after the appropriate data" assert None < 0 < '' < (), "Cannot guarantee commit of activities comes after the appropriate data"
manage_addActivityConnectionForm = HTMLFile('dtml/connectionAdd', globals()) manage_addActivityConnectionForm = HTMLFile('dtml/connectionAdd', globals())
...@@ -66,4 +66,4 @@ InitializeClass(ActivityConnection) ...@@ -66,4 +66,4 @@ InitializeClass(ActivityConnection)
class ActivityDB(DB): class ActivityDB(DB):
_sort_key = '\xff' _sort_key = (0,)
...@@ -23,7 +23,7 @@ ZServer hook to dump a traceback of the running python threads. ...@@ -23,7 +23,7 @@ ZServer hook to dump a traceback of the running python threads.
""" """
import six import six
import _thread from six.moves import _thread
from sys import _current_frames from sys import _current_frames
from six.moves import cStringIO as StringIO from six.moves import cStringIO as StringIO
import traceback import traceback
...@@ -37,7 +37,7 @@ def dump_threads(): ...@@ -37,7 +37,7 @@ def dump_threads():
Returns a string with the tracebacks. Returns a string with the tracebacks.
""" """
this_thread_id = thread.get_ident() this_thread_id = _thread.get_ident()
now = time.strftime("%Y-%m-%d %H:%M:%S") now = time.strftime("%Y-%m-%d %H:%M:%S")
res = ["Threads traceback dump at %s\n" % now] res = ["Threads traceback dump at %s\n" % now]
for thread_id, frame in six.iteritems(_current_frames()): for thread_id, frame in six.iteritems(_current_frames()):
...@@ -114,7 +114,7 @@ def match(self, request): ...@@ -114,7 +114,7 @@ def match(self, request):
return 1 return 1
else: else:
return 0 return 0
import six
if six.PY2: if six.PY2:
from ZServer.HTTPServer import zhttp_handler from ZServer.HTTPServer import zhttp_handler
zhttp_handler.match = match zhttp_handler.match = match
...@@ -655,7 +655,7 @@ class ContributionTool(BaseTool): ...@@ -655,7 +655,7 @@ class ContributionTool(BaseTool):
# Create a file name based on the URL and quote it # Create a file name based on the URL and quote it
filename = urllib.parse.urlsplit(url)[-3] filename = urllib.parse.urlsplit(url)[-3]
filename = os.path.basename(filename) filename = os.path.basename(filename)
filename = urllib.parse.quote(filename, safe='') filename = urllib.parse.quote(filename, safe='') # pylint:disable=redundant-keyword-arg
filename = filename.replace('%', '') filename = filename.replace('%', '')
content_type = header_info.gettype() content_type = header_info.gettype()
return file_object, filename, content_type return file_object, filename, content_type
......
...@@ -39,7 +39,6 @@ from AccessControl.SecurityManagement import getSecurityManager, \ ...@@ -39,7 +39,6 @@ from AccessControl.SecurityManagement import getSecurityManager, \
setSecurityManager, newSecurityManager setSecurityManager, newSecurityManager
from Products.ERP5Type.Cache import DEFAULT_CACHE_SCOPE from Products.ERP5Type.Cache import DEFAULT_CACHE_SCOPE
import time import time
import socket
from six.moves import urllib from six.moves import urllib
import json import json
from zLOG import LOG, ERROR, INFO from zLOG import LOG, ERROR, INFO
...@@ -234,14 +233,8 @@ def getFacebookUserEntry(token): ...@@ -234,14 +233,8 @@ def getFacebookUserEntry(token):
'No facebook module, install facebook-sdk package. ' 'No facebook module, install facebook-sdk package. '
'Authentication disabled.') 'Authentication disabled.')
return None return None
timeout = socket.getdefaulttimeout()
args = {'fields' : 'id,name,email', } args = {'fields' : 'id,name,email', }
try: facebook_entry = facebook.GraphAPI(token, timeout=5).get_object("me", **args)
# require really fast interaction
socket.setdefaulttimeout(5)
facebook_entry = facebook.GraphAPI(token).get_object("me", **args)
finally:
socket.setdefaulttimeout(timeout)
user_entry = {} user_entry = {}
if facebook_entry is not None: if facebook_entry is not None:
......
...@@ -70,7 +70,7 @@ class TransactionalVariable(dict): ...@@ -70,7 +70,7 @@ class TransactionalVariable(dict):
_unregistered = True _unregistered = True
def sortKey(self): def sortKey(self):
return '\x00' return None
commit = tpc_vote = tpc_begin = tpc_abort = lambda self, transaction: None commit = tpc_vote = tpc_begin = tpc_abort = lambda self, transaction: None
...@@ -127,7 +127,7 @@ class TransactionalResource(object): ...@@ -127,7 +127,7 @@ class TransactionalResource(object):
return not (args in tv or tv.add(args)) return not (args in tv or tv.add(args))
def sortKey(self): def sortKey(self):
return '1' return 1
abort = commit = tpc_vote = tpc_begin = tpc_finish = tpc_abort = \ abort = commit = tpc_vote = tpc_begin = tpc_finish = tpc_abort = \
lambda self, transaction: None lambda self, transaction: None
...@@ -125,6 +125,9 @@ class TimerResponse(BaseResponse): ...@@ -125,6 +125,9 @@ class TimerResponse(BaseResponse):
def _finish(self): def _finish(self):
pass pass
def redirect(self, *args, **kw):
pass
def unauthorized(self): def unauthorized(self):
pass pass
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment