Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
erp5_workflow
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wenjie.zheng
erp5_workflow
Commits
b692b36c
Commit
b692b36c
authored
Mar 01, 2012
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid formatting strings whenever relevant.
parent
c8d3714f
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
19 additions
and
20 deletions
+19
-20
product/ERP5/Document/BusinessTemplate.py
product/ERP5/Document/BusinessTemplate.py
+5
-5
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_migrateSourceCodeFromFilesystem.xml
...core/BusinessTemplate_migrateSourceCodeFromFilesystem.xml
+1
-1
product/ERP5/bootstrap/erp5_core/bt/revision
product/ERP5/bootstrap/erp5_core/bt/revision
+1
-1
product/ERP5/tests/testBusinessTemplate.py
product/ERP5/tests/testBusinessTemplate.py
+2
-3
product/ERP5Type/dynamic/component_package.py
product/ERP5Type/dynamic/component_package.py
+4
-4
product/ERP5Type/dynamic/portal_type_class.py
product/ERP5Type/dynamic/portal_type_class.py
+5
-5
product/ERP5Type/tests/testDynamicClassGeneration.py
product/ERP5Type/tests/testDynamicClassGeneration.py
+1
-1
No files found.
product/ERP5/Document/BusinessTemplate.py
View file @
b692b36c
...
@@ -3743,7 +3743,7 @@ class PropertySheetTemplateItem(FilesystemToZodbTemplateItem):
...
@@ -3743,7 +3743,7 @@ class PropertySheetTemplateItem(FilesystemToZodbTemplateItem):
from
App.config
import
getConfiguration
from
App.config
import
getConfiguration
return
os
.
path
.
join
(
getConfiguration
().
instancehome
,
return
os
.
path
.
join
(
getConfiguration
().
instancehome
,
"PropertySheet"
,
"PropertySheet"
,
"%s.py"
%
class_id
)
class_id
+
".py"
)
@
staticmethod
@
staticmethod
def
_migrateFromFilesystem
(
tool
,
def
_migrateFromFilesystem
(
tool
,
...
@@ -3799,14 +3799,14 @@ class DocumentTemplateItem(FilesystemToZodbTemplateItem):
...
@@ -3799,14 +3799,14 @@ class DocumentTemplateItem(FilesystemToZodbTemplateItem):
@
staticmethod
@
staticmethod
def
_getZodbObjectId
(
id
):
def
_getZodbObjectId
(
id
):
return
'erp5.component.document.
%s'
%
id
return
'erp5.component.document.
'
+
id
@
staticmethod
@
staticmethod
def
_getFilesystemPath
(
class_id
):
def
_getFilesystemPath
(
class_id
):
from
App.config
import
getConfiguration
from
App.config
import
getConfiguration
return
os
.
path
.
join
(
getConfiguration
().
instancehome
,
return
os
.
path
.
join
(
getConfiguration
().
instancehome
,
"Document"
,
"Document"
,
"%s.py"
%
class_id
)
class_id
+
".py"
)
def
_importFile
(
self
,
file_name
,
file_obj
):
def
_importFile
(
self
,
file_name
,
file_obj
):
if
file_name
.
endswith
(
'.py'
):
if
file_name
.
endswith
(
'.py'
):
...
@@ -3820,7 +3820,7 @@ class DocumentTemplateItem(FilesystemToZodbTemplateItem):
...
@@ -3820,7 +3820,7 @@ class DocumentTemplateItem(FilesystemToZodbTemplateItem):
name
=
file_name
[:
-
4
]
name
=
file_name
[:
-
4
]
obj
=
self
.
_objects
[
name
]
obj
=
self
.
_objects
[
name
]
with
open
(
"%s.py"
%
file_obj
.
name
[:
-
4
]
)
as
f
:
with
open
(
file_obj
.
name
[:
-
4
]
+
".py"
)
as
f
:
obj
.
text_content
=
f
.
read
()
obj
.
text_content
=
f
.
read
()
# When importing a Business Template, there is no way to determine if it
# When importing a Business Template, there is no way to determine if it
...
@@ -3912,7 +3912,7 @@ class ExtensionTemplateItem(DocumentTemplateItem):
...
@@ -3912,7 +3912,7 @@ class ExtensionTemplateItem(DocumentTemplateItem):
@
staticmethod
@
staticmethod
def
_getZodbObjectId
(
id
):
def
_getZodbObjectId
(
id
):
return
'erp5.component.extension.
%s'
%
id
return
'erp5.component.extension.
'
+
id
def
getTemplateIdList
(
self
):
def
getTemplateIdList
(
self
):
return
self
.
getTemplateExtensionIdList
()
return
self
.
getTemplateExtensionIdList
()
...
...
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_migrateSourceCodeFromFilesystem.xml
View file @
b692b36c
...
@@ -57,7 +57,7 @@ if failed_import_dict:\n
...
@@ -57,7 +57,7 @@ if failed_import_dict:\n
for name, error in failed_import_dict.iteritems():\n
for name, error in failed_import_dict.iteritems():\n
failed_import_formatted_list.append("%s (%s)" % (name, error))\n
failed_import_formatted_list.append("%s (%s)" % (name, error))\n
\n
\n
message = "The following component could not be imported:
%s" %
\', \'.join(failed_import_formatted_list)\n
message = "The following component could not be imported:
" +
\', \'.join(failed_import_formatted_list)\n
else:\n
else:\n
message = "All components were successfully imported from filesystem to ZODB."\n
message = "All components were successfully imported from filesystem to ZODB."\n
\n
\n
...
...
product/ERP5/bootstrap/erp5_core/bt/revision
View file @
b692b36c
41019
41020
\ No newline at end of file
\ No newline at end of file
product/ERP5/tests/testBusinessTemplate.py
View file @
b692b36c
...
@@ -6890,7 +6890,7 @@ class TestDocumentTemplateItem(BusinessTemplateMixin):
...
@@ -6890,7 +6890,7 @@ class TestDocumentTemplateItem(BusinessTemplateMixin):
return
super
(
TestDocumentTemplateItem
,
self
).
login
(
user_name
,
quiet
)
return
super
(
TestDocumentTemplateItem
,
self
).
login
(
user_name
,
quiet
)
def
stepCreateZodbDocument
(
self
,
sequence
=
None
,
**
kw
):
def
stepCreateZodbDocument
(
self
,
sequence
=
None
,
**
kw
):
document_id
=
'%s.erp5.%s'
%
(
self
.
component_module
,
self
.
document_title
)
document_id
=
self
.
component_module
+
'.erp5.'
+
self
.
document_title
self
.
getPortalObject
().
portal_components
.
newContent
(
self
.
getPortalObject
().
portal_components
.
newContent
(
id
=
document_id
,
id
=
document_id
,
version
=
'erp5'
,
version
=
'erp5'
,
...
@@ -6933,8 +6933,7 @@ class TestDocumentTemplateItem(BusinessTemplateMixin):
...
@@ -6933,8 +6933,7 @@ class TestDocumentTemplateItem(BusinessTemplateMixin):
self
.
assertTrue
(
os
.
path
.
exists
(
component_bt_tool_path
))
self
.
assertTrue
(
os
.
path
.
exists
(
component_bt_tool_path
))
component_id
=
'%s.erp5.%s'
%
(
self
.
component_module
,
component_id
=
self
.
component_module
+
'.erp5.'
+
sequence
[
'document_title'
]
sequence
[
'document_title'
])
base_path
=
os
.
path
.
join
(
component_bt_tool_path
,
component_id
)
base_path
=
os
.
path
.
join
(
component_bt_tool_path
,
component_id
)
python_source_code_path
=
base_path
+
'.py'
python_source_code_path
=
base_path
+
'.py'
...
...
product/ERP5Type/dynamic/component_package.py
View file @
b692b36c
...
@@ -161,7 +161,7 @@ class ComponentDynamicPackage(ModuleType):
...
@@ -161,7 +161,7 @@ class ComponentDynamicPackage(ModuleType):
version
+=
'_version'
version
+=
'_version'
version_package
=
getattr
(
self
,
version
,
None
)
version_package
=
getattr
(
self
,
version
,
None
)
if
version_package
is
None
:
if
version_package
is
None
:
version_package_name
=
'%s.%s'
%
(
self
.
_namespace
,
version
)
version_package_name
=
self
.
_namespace
+
'.'
+
version
version_package
=
ComponentVersionPackage
(
version_package_name
)
version_package
=
ComponentVersionPackage
(
version_package_name
)
sys
.
modules
[
version_package_name
]
=
version_package
sys
.
modules
[
version_package_name
]
=
version_package
...
@@ -225,7 +225,7 @@ class ComponentDynamicPackage(ModuleType):
...
@@ -225,7 +225,7 @@ class ComponentDynamicPackage(ModuleType):
return
module
return
module
component_id_alias
=
'%s.%s'
%
(
self
.
_namespace
,
component_name
)
component_id_alias
=
self
.
_namespace
+
'.'
+
component_name
component_id
=
'%s.%s_version.%s'
%
(
self
.
_namespace
,
version
,
component_id
=
'%s.%s_version.%s'
%
(
self
.
_namespace
,
version
,
component_name
)
component_name
)
...
@@ -240,7 +240,7 @@ class ComponentDynamicPackage(ModuleType):
...
@@ -240,7 +240,7 @@ class ComponentDynamicPackage(ModuleType):
sys
.
modules
[
component_id_alias
]
=
new_module
sys
.
modules
[
component_id_alias
]
=
new_module
# This must be set for imports at least (see PEP 302)
# This must be set for imports at least (see PEP 302)
new_module
.
__file__
=
"<%s>"
%
component_name
new_module
.
__file__
=
'<'
+
component_name
+
'>'
try
:
try
:
component
.
load
(
new_module
.
__dict__
,
validated_only
=
True
)
component
.
load
(
new_module
.
__dict__
,
validated_only
=
True
)
...
@@ -282,7 +282,7 @@ class ComponentDynamicPackage(ModuleType):
...
@@ -282,7 +282,7 @@ class ComponentDynamicPackage(ModuleType):
elif
isinstance
(
module
,
ComponentVersionPackage
):
elif
isinstance
(
module
,
ComponentVersionPackage
):
self
.
reset
(
sub_package
=
module
)
self
.
reset
(
sub_package
=
module
)
module_name
=
"%s.%s"
%
(
package
.
__name__
,
name
)
module_name
=
package
.
__name__
+
'.'
+
name
LOG
(
"ERP5Type.Tool.ComponentTool"
,
BLATHER
,
"Resetting "
+
module_name
)
LOG
(
"ERP5Type.Tool.ComponentTool"
,
BLATHER
,
"Resetting "
+
module_name
)
# The module must be deleted first from sys.modules to avoid imports in
# The module must be deleted first from sys.modules to avoid imports in
...
...
product/ERP5Type/dynamic/portal_type_class.py
View file @
b692b36c
...
@@ -54,7 +54,7 @@ def _importClass(classpath):
...
@@ -54,7 +54,7 @@ def _importClass(classpath):
return
klass
return
klass
except
StandardError
:
except
StandardError
:
raise
ImportError
(
'Could not import document class
%s'
%
classpath
)
raise
ImportError
(
'Could not import document class
'
+
classpath
)
# Loading Cache Factory portal type would generate the accessor holder
# Loading Cache Factory portal type would generate the accessor holder
# for Cache Factory, itself defined with Standard Property thus
# for Cache Factory, itself defined with Standard Property thus
...
@@ -179,8 +179,8 @@ def generatePortalTypeClass(site, portal_type_name):
...
@@ -179,8 +179,8 @@ def generatePortalTypeClass(site, portal_type_name):
interface_list
=
[]
interface_list
=
[]
if
type_class
is
None
:
if
type_class
is
None
:
raise
AttributeError
(
'Document class is not defined on Portal Type
%s'
\
raise
AttributeError
(
'Document class is not defined on Portal Type
'
+
\
%
portal_type_name
)
portal_type_name
)
klass
=
None
klass
=
None
if
'.'
in
type_class
:
if
'.'
in
type_class
:
...
@@ -194,7 +194,7 @@ def generatePortalTypeClass(site, portal_type_name):
...
@@ -194,7 +194,7 @@ def generatePortalTypeClass(site, portal_type_name):
if
not
(
type_class_namespace
.
startswith
(
'Products.ERP5Type'
)
or
if
not
(
type_class_namespace
.
startswith
(
'Products.ERP5Type'
)
or
portal_type_name
in
core_portal_type_class_dict
):
portal_type_name
in
core_portal_type_class_dict
):
try
:
try
:
klass
=
getattr
(
__import__
(
'erp5.component.document.
%s'
%
type_class
,
klass
=
getattr
(
__import__
(
'erp5.component.document.
'
+
type_class
,
fromlist
=
[
'erp5.component.document'
],
fromlist
=
[
'erp5.component.document'
],
level
=
0
),
level
=
0
),
type_class
)
type_class
)
...
@@ -277,7 +277,7 @@ def loadTempPortalTypeClass(portal_type_name):
...
@@ -277,7 +277,7 @@ def loadTempPortalTypeClass(portal_type_name):
import
erp5.portal_type
import
erp5.portal_type
klass
=
getattr
(
erp5
.
portal_type
,
portal_type_name
)
klass
=
getattr
(
erp5
.
portal_type
,
portal_type_name
)
return
type
(
"Temporary
%s"
%
portal_type_name
,
return
type
(
"Temporary
"
+
portal_type_name
,
(
TemporaryDocumentMixin
,
klass
),
{})
(
TemporaryDocumentMixin
,
klass
),
{})
last_sync
=
-
1
last_sync
=
-
1
...
...
product/ERP5Type/tests/testDynamicClassGeneration.py
View file @
b692b36c
...
@@ -1265,7 +1265,7 @@ class _TestZodbComponent(SecurityTestCase):
...
@@ -1265,7 +1265,7 @@ class _TestZodbComponent(SecurityTestCase):
pass
pass
def
_getComponentFullModuleName
(
self
,
module_name
):
def
_getComponentFullModuleName
(
self
,
module_name
):
return
"%s.%s"
%
(
self
.
_getComponentModuleName
(),
module_name
)
return
self
.
_getComponentModuleName
()
+
'.'
+
module_name
def
failIfModuleImportable
(
self
,
module_name
):
def
failIfModuleImportable
(
self
,
module_name
):
full_module_name
=
self
.
_getComponentFullModuleName
(
module_name
)
full_module_name
=
self
.
_getComponentFullModuleName
(
module_name
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment