Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Lu Xu
erp5
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
Show 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):
from
App.config
import
getConfiguration
return
os
.
path
.
join
(
getConfiguration
().
instancehome
,
"PropertySheet"
,
"%s.py"
%
class_id
)
class_id
+
".py"
)
@
staticmethod
def
_migrateFromFilesystem
(
tool
,
...
...
@@ -3799,14 +3799,14 @@ class DocumentTemplateItem(FilesystemToZodbTemplateItem):
@
staticmethod
def
_getZodbObjectId
(
id
):
return
'erp5.component.document.
%s'
%
id
return
'erp5.component.document.
'
+
id
@
staticmethod
def
_getFilesystemPath
(
class_id
):
from
App.config
import
getConfiguration
return
os
.
path
.
join
(
getConfiguration
().
instancehome
,
"Document"
,
"%s.py"
%
class_id
)
class_id
+
".py"
)
def
_importFile
(
self
,
file_name
,
file_obj
):
if
file_name
.
endswith
(
'.py'
):
...
...
@@ -3820,7 +3820,7 @@ class DocumentTemplateItem(FilesystemToZodbTemplateItem):
name
=
file_name
[:
-
4
]
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
()
# When importing a Business Template, there is no way to determine if it
...
...
@@ -3912,7 +3912,7 @@ class ExtensionTemplateItem(DocumentTemplateItem):
@
staticmethod
def
_getZodbObjectId
(
id
):
return
'erp5.component.extension.
%s'
%
id
return
'erp5.component.extension.
'
+
id
def
getTemplateIdList
(
self
):
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
for name, error in failed_import_dict.iteritems():\n
failed_import_formatted_list.append("%s (%s)" % (name, error))\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
message = "All components were successfully imported from filesystem to ZODB."\n
\n
...
...
product/ERP5/bootstrap/erp5_core/bt/revision
View file @
b692b36c
41019
\ No newline at end of file
41020
\ No newline at end of file
product/ERP5/tests/testBusinessTemplate.py
View file @
b692b36c
...
...
@@ -6890,7 +6890,7 @@ class TestDocumentTemplateItem(BusinessTemplateMixin):
return
super
(
TestDocumentTemplateItem
,
self
).
login
(
user_name
,
quiet
)
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
(
id
=
document_id
,
version
=
'erp5'
,
...
...
@@ -6933,8 +6933,7 @@ class TestDocumentTemplateItem(BusinessTemplateMixin):
self
.
assertTrue
(
os
.
path
.
exists
(
component_bt_tool_path
))
component_id
=
'%s.erp5.%s'
%
(
self
.
component_module
,
sequence
[
'document_title'
])
component_id
=
self
.
component_module
+
'.erp5.'
+
sequence
[
'document_title'
]
base_path
=
os
.
path
.
join
(
component_bt_tool_path
,
component_id
)
python_source_code_path
=
base_path
+
'.py'
...
...
product/ERP5Type/dynamic/component_package.py
View file @
b692b36c
...
...
@@ -161,7 +161,7 @@ class ComponentDynamicPackage(ModuleType):
version
+=
'_version'
version_package
=
getattr
(
self
,
version
,
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
)
sys
.
modules
[
version_package_name
]
=
version_package
...
...
@@ -225,7 +225,7 @@ class ComponentDynamicPackage(ModuleType):
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_name
)
...
...
@@ -240,7 +240,7 @@ class ComponentDynamicPackage(ModuleType):
sys
.
modules
[
component_id_alias
]
=
new_module
# This must be set for imports at least (see PEP 302)
new_module
.
__file__
=
"<%s>"
%
component_name
new_module
.
__file__
=
'<'
+
component_name
+
'>'
try
:
component
.
load
(
new_module
.
__dict__
,
validated_only
=
True
)
...
...
@@ -282,7 +282,7 @@ class ComponentDynamicPackage(ModuleType):
elif
isinstance
(
module
,
ComponentVersionPackage
):
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
)
# 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):
return
klass
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
# for Cache Factory, itself defined with Standard Property thus
...
...
@@ -179,8 +179,8 @@ def generatePortalTypeClass(site, portal_type_name):
interface_list
=
[]
if
type_class
is
None
:
raise
AttributeError
(
'Document class is not defined on Portal Type
%s'
\
%
portal_type_name
)
raise
AttributeError
(
'Document class is not defined on Portal Type
'
+
\
portal_type_name
)
klass
=
None
if
'.'
in
type_class
:
...
...
@@ -194,7 +194,7 @@ def generatePortalTypeClass(site, portal_type_name):
if
not
(
type_class_namespace
.
startswith
(
'Products.ERP5Type'
)
or
portal_type_name
in
core_portal_type_class_dict
):
try
:
klass
=
getattr
(
__import__
(
'erp5.component.document.
%s'
%
type_class
,
klass
=
getattr
(
__import__
(
'erp5.component.document.
'
+
type_class
,
fromlist
=
[
'erp5.component.document'
],
level
=
0
),
type_class
)
...
...
@@ -277,7 +277,7 @@ def loadTempPortalTypeClass(portal_type_name):
import
erp5.portal_type
klass
=
getattr
(
erp5
.
portal_type
,
portal_type_name
)
return
type
(
"Temporary
%s"
%
portal_type_name
,
return
type
(
"Temporary
"
+
portal_type_name
,
(
TemporaryDocumentMixin
,
klass
),
{})
last_sync
=
-
1
...
...
product/ERP5Type/tests/testDynamicClassGeneration.py
View file @
b692b36c
...
...
@@ -1265,7 +1265,7 @@ class _TestZodbComponent(SecurityTestCase):
pass
def
_getComponentFullModuleName
(
self
,
module_name
):
return
"%s.%s"
%
(
self
.
_getComponentModuleName
(),
module_name
)
return
self
.
_getComponentModuleName
()
+
'.'
+
module_name
def
failIfModuleImportable
(
self
,
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