Commit a7b5c18e authored by Jérome Perrin's avatar Jérome Perrin

credential: fix pylint messages and enable coding style test

parent 37039ff5
......@@ -30,11 +30,6 @@ from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet
from Products.ERP5.Document.Ticket import Ticket
from erp5.component.mixin.EncryptedPasswordMixin import EncryptedPasswordMixin
try:
from Products import PluggableAuthService
from Products.ERP5Security.ERP5UserManager import ERP5UserManager
except ImportError:
PluggableAuthService = None
class CredentialRecovery(Ticket, EncryptedPasswordMixin):
......
......@@ -6,10 +6,22 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>CredentialRecovery</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>document.erp5.CredentialRecovery</string> </value>
......@@ -24,6 +36,18 @@
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
......@@ -31,13 +55,28 @@
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
......@@ -50,7 +89,7 @@
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -59,13 +98,15 @@
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<tuple>
<none/>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
......@@ -78,7 +119,9 @@
</item>
</dictionary>
</list>
</tuple>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -31,6 +31,7 @@ from Products.ERP5Type import Permissions, PropertySheet
from Products.ERP5.Document.Ticket import Ticket
from erp5.component.mixin.EncryptedPasswordMixin import EncryptedPasswordMixin
class CredentialRequest(Ticket, EncryptedPasswordMixin):
"""
"""
......
......@@ -6,10 +6,22 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>CredentialRequest</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>document.erp5.CredentialRequest</string> </value>
......@@ -24,6 +36,18 @@
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
......@@ -31,13 +55,28 @@
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
......@@ -50,7 +89,7 @@
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -59,13 +98,15 @@
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<tuple>
<none/>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
......@@ -78,7 +119,9 @@
</item>
</dictionary>
</list>
</tuple>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -71,9 +71,9 @@ def isSingleSignOnEnable(self):
if isinstance(acl_users,PluggableAuthServiceTool):
#List plugin which make authentication
plugin_list = acl_users.plugins.listPlugins(IAuthenticationPlugin)
for plugin_name, plugin_value in plugin_list:
for _, plugin_value in plugin_list:
#Try to find an ERP5RemoteUserManager
if isinstance(plugin_value,ERP5RemoteUserManager):
if isinstance(plugin_value, ERP5RemoteUserManager):
#SSO is enable
return True
return False
......@@ -6,10 +6,22 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>Credential</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>extension.erp5.Credential</string> </value>
......@@ -24,6 +36,18 @@
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
......@@ -31,13 +55,28 @@
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
......@@ -50,7 +89,7 @@
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -59,13 +98,15 @@
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<tuple>
<none/>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
......@@ -78,7 +119,9 @@
</item>
</dictionary>
</list>
</tuple>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
if context.getParentValue().portal_type == 'Credential Request':
return {'Address':dict(organisation_default_address='Organisation Default Address')}
return {'Address': dict(organisation_default_address='Organisation Default Address')}
return {}
......@@ -3,7 +3,6 @@ send the password reset link by mail
"""
portal = context.getPortalObject()
person = context.getDestinationDecisionValue(portal_type="Person")
reference = context.getReference()
if context.hasDocumentReference():
message_reference = context.getDocumentReference()
......
......@@ -2,6 +2,7 @@
Parameters:
value -- field value (string)
REQUEST -- standard REQUEST variable"""
portal = context.getPortalObject()
if value:
# Same tag is used as in ERP5 Login _setReference, in order to protect against
......@@ -13,7 +14,6 @@ def getRealContext():
if not REQUEST:
return context
object_path = REQUEST.get("object_path")
portal = context.getPortalObject()
return portal.restrictedTraverse(object_path)
#Allow user to create a request with it's username
......@@ -29,7 +29,7 @@ if context.getPortalType() == "Credential Request":
related_person = context.getDestinationDecisionValue(portal_type="Person")
if related_person is not None:
for erp5_login_value in related_person.objectValues(
portal_type=self.getPortalObject().getPortalLoginTypeList(),
portal_type=portal.getPortalLoginTypeList(),
):
if erp5_login_value.getValidationState() == 'validated' and erp5_login_value.getReference() == value:
return True
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>role=[],comment=""</string> </value>
<value> <string>role=(), comment=""</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -9,8 +9,6 @@
if REQUEST is not None:
return None
portal = context.getPortalObject()
portal_preferences = context.portal_preferences
# XXX by default we don't want to automatically create/update organisation
# Someone should confirm this informations before creating the organisation
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>related_portal_type = [\'Person\'], REQUEST=None</string> </value>
<value> <string>related_portal_type=(\'Person\', ), REQUEST=None</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>create_portal_type=["Person"], REQUEST=None</string> </value>
<value> <string>create_portal_type=("Person",), REQUEST=None</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
from Products.ERP5Type.Errors import UnsupportedWorkflowMethod
"""Copy subscription information to the related organisation"""
context.Credential_checkConsistency(['Organisation'])
......@@ -19,5 +20,5 @@ context.Credential_copyRegistredInformation(organisation, organisation_mapping)
#Try to validate
try:
organisation.validate()
except:
except UnsupportedWorkflowMethod:
pass
......@@ -7,7 +7,6 @@ if REQUEST is not None:
return None
from Products.ERP5Type.Errors import UnsupportedWorkflowMethod
from Products.ERP5Type.Utils import sleep
context.Credential_checkConsistency(['Person'])
person = context.getDestinationDecisionValue(portal_type="Person")
......
......@@ -8,7 +8,6 @@ if REQUEST is not None:
person = context.getDestinationDecisionValue(portal_type="Person")
organisation = context.getDestinationDecisionValue(portal_type="Organisation")
assignment_configuration = {}
#Look on current assignment
old_role_list = context.portal_categories.role.getCategoryChildLogicalPathItemList()[1:]
#old_role_list look like [['title','logical_path'],]
......
......@@ -5,8 +5,8 @@ Manager -- allow to update all image property"""
if REQUEST is not None:
raise ValueError, "This script can not be call from url"
def getAccessor(property):
return "".join([x.capitalize() for x in property.split('_')])
def getAccessor(prop):
return "".join([x.capitalize() for x in prop.split('_')])
def copyValue(source_document, source_accessor,
destination_document, destination_accessor):
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>destination_decision_type=[\'Person\']</string> </value>
<value> <string>destination_decision_type=(\'Person\', )</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
......
......@@ -4,8 +4,8 @@ destination -- Object where copy property value
mapping -- Define property mapping (List of tuple of 2 property)
copy_none_value -- Copy or not None value of context to destination
erase_empty_value -- Erase or not empty value of destination"""
def getAccessor(property):
return "".join([x.capitalize() for x in property.split('_')])
def getAccessor(prop):
return "".join([x.capitalize() for x in prop.split('_')])
def copyValue(source_document, source_accessor,
destination_document, destination_accessor):
......
object = state_change['object']
object.Base_checkConsistency()
state_change['object'].Base_checkConsistency()
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