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
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Lukas Niegsch
erp5
Commits
d7d81c20
Commit
d7d81c20
authored
Jul 29, 2015
by
wenjie.zheng
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into erp5_workflow
parents
f6d59571
9d08cb2c
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
62 additions
and
32 deletions
+62
-32
bt5/erp5_upgrader/PortalTypePropertySheetTemplateItem/property_sheet_list.xml
...rtalTypePropertySheetTemplateItem/property_sheet_list.xml
+1
-1
bt5/erp5_upgrader/PropertySheetTemplateItem/portal_property_sheets/TemplateToolTableConsistencyConstraint.xml
...roperty_sheets/TemplateToolTableConsistencyConstraint.xml
+1
-1
bt5/erp5_upgrader/PropertySheetTemplateItem/portal_property_sheets/TemplateToolTableConsistencyConstraint/table_consistency_constraint.xml
...bleConsistencyConstraint/table_consistency_constraint.xml
+2
-2
bt5/erp5_upgrader/SkinTemplateItem/portal_skins/erp5_upgrader/Base_getUpgradeBusinessTemplateList.xml
...ins/erp5_upgrader/Base_getUpgradeBusinessTemplateList.xml
+1
-1
bt5/erp5_upgrader/SkinTemplateItem/portal_skins/erp5_upgrader/TemplateTool_checkBusinessTemplateInstallation.xml
...grader/TemplateTool_checkBusinessTemplateInstallation.xml
+1
-0
bt5/erp5_upgrader/SkinTemplateItem/portal_skins/erp5_upgrader/TemplateTool_checkTableConsistency.xml
...kins/erp5_upgrader/TemplateTool_checkTableConsistency.xml
+10
-19
bt5/erp5_upgrader/bt/template_portal_type_property_sheet_list
...erp5_upgrader/bt/template_portal_type_property_sheet_list
+1
-1
bt5/erp5_upgrader/bt/template_property_sheet_id_list
bt5/erp5_upgrader/bt/template_property_sheet_id_list
+1
-1
bt5/erp5_upgrader_test/SkinTemplateItem/portal_skins/erp5_upgrader_test/Base_getUpgradeBusinessTemplateList.xml
...rp5_upgrader_test/Base_getUpgradeBusinessTemplateList.xml
+1
-1
product/ERP5/tests/testXHTML.py
product/ERP5/tests/testXHTML.py
+1
-1
product/ERP5Type/tests/testConstraint.py
product/ERP5Type/tests/testConstraint.py
+42
-4
No files found.
bt5/erp5_upgrader/PortalTypePropertySheetTemplateItem/property_sheet_list.xml
View file @
d7d81c20
<property_sheet_list>
<property_sheet_list>
<portal_type
id=
"Template Tool"
>
<portal_type
id=
"Template Tool"
>
<item>
TemplateToolBusinessTemplateInstallationConstraint
</item>
<item>
TemplateToolBusinessTemplateInstallationConstraint
</item>
<item>
TemplateToolTable
Existence
Constraint
</item>
<item>
TemplateToolTable
Consistency
Constraint
</item>
<item>
TemplateToolWorkflowChainConsistencyConstraint
</item>
<item>
TemplateToolWorkflowChainConsistencyConstraint
</item>
</portal_type>
</portal_type>
</property_sheet_list>
</property_sheet_list>
\ No newline at end of file
bt5/erp5_upgrader/PropertySheetTemplateItem/portal_property_sheets/TemplateToolTable
Existence
Constraint.xml
→
bt5/erp5_upgrader/PropertySheetTemplateItem/portal_property_sheets/TemplateToolTable
Consistency
Constraint.xml
View file @
d7d81c20
...
@@ -32,7 +32,7 @@
...
@@ -32,7 +32,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
TemplateToolTable
Existence
Constraint
</string>
</value>
<value>
<string>
TemplateToolTable
Consistency
Constraint
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
portal_type
</string>
</key>
<key>
<string>
portal_type
</string>
</key>
...
...
bt5/erp5_upgrader/PropertySheetTemplateItem/portal_property_sheets/TemplateToolTable
ExistenceConstraint/table_existence
_constraint.xml
→
bt5/erp5_upgrader/PropertySheetTemplateItem/portal_property_sheets/TemplateToolTable
ConsistencyConstraint/table_consistency
_constraint.xml
View file @
d7d81c20
...
@@ -34,7 +34,7 @@
...
@@ -34,7 +34,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
table_
existence
_constraint
</string>
</value>
<value>
<string>
table_
consistency
_constraint
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
portal_type
</string>
</key>
<key>
<string>
portal_type
</string>
</key>
...
@@ -42,7 +42,7 @@
...
@@ -42,7 +42,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
script_id
</string>
</key>
<key>
<string>
script_id
</string>
</key>
<value>
<string>
TemplateTool_checkTable
Existence
</string>
</value>
<value>
<string>
TemplateTool_checkTable
Consistency
</string>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
...
...
bt5/erp5_upgrader/SkinTemplateItem/portal_skins/erp5_upgrader/Base_getUpgradeBusinessTemplateList.xml
View file @
d7d81c20
...
@@ -57,7 +57,7 @@
...
@@ -57,7 +57,7 @@
a old business template without updating it and without removing it\n
a old business template without updating it and without removing it\n
"""\n
"""\n
\n
\n
return (\'erp5_base\',), []\n
return (\'erp5_base\',), [
"erp5_upgrader"
]\n
</string>
</value>
</string>
</value>
</item>
</item>
<item>
<item>
...
...
bt5/erp5_upgrader/SkinTemplateItem/portal_skins/erp5_upgrader/TemplateTool_checkBusinessTemplateInstallation.xml
View file @
d7d81c20
...
@@ -54,6 +54,7 @@
...
@@ -54,6 +54,7 @@
\n
\n
template_tool = context.getPortalObject().portal_templates\n
template_tool = context.getPortalObject().portal_templates\n
return template_tool.upgradeSite(bt5_list,\n
return template_tool.upgradeSite(bt5_list,\n
delete_orphaned=True,\n
keep_bt5_id_set=keep_bt5_id_set,\n
keep_bt5_id_set=keep_bt5_id_set,\n
dry_run=(not fixit))\n
dry_run=(not fixit))\n
</string>
</value>
</string>
</value>
...
...
bt5/erp5_upgrader/SkinTemplateItem/portal_skins/erp5_upgrader/TemplateTool_checkTable
Existence
.xml
→
bt5/erp5_upgrader/SkinTemplateItem/portal_skins/erp5_upgrader/TemplateTool_checkTable
Consistency
.xml
View file @
d7d81c20
...
@@ -51,25 +51,16 @@
...
@@ -51,25 +51,16 @@
<item>
<item>
<key>
<string>
_body
</string>
</key>
<key>
<string>
_body
</string>
</key>
<value>
<string>
"""\n
<value>
<string>
"""\n
Check for some table
existence
according to the create table list.\n
Check for some table
consistency
according to the create table list.\n
If `fixit` is True, then it
uses the associated sql_method to create it.
\n
If `fixit` is True, then it
will create/drop table or alter existing tables
\n
"""\n
"""\n
create_table_list = [\n
portal = context.getPortalObject()\n
# ("category", "z_create_category"), # example\n
show_source = not(fixit)\n
("catalog_full_text", "z_create_catalog_fulltext"),\n
sql_src = portal.portal_catalog.upgradeSchema(src__=show_source)\n
]\n
result = []\n
sql_catalog = context.portal_catalog.getSQLCatalog()\n
if sql_src:\n
table_list = [r[0] for r in sql_catalog.z_show_tables(table="not needed so far")]\n
result.append(sql_src)\n
report_list = []\n
return result\n
for create_table_information in create_table_list:\n
if not callable(getattr(sql_catalog, create_table_information[1], None)):\n
continue\n
if create_table_information[0] not in table_list:\n
if fixit:\n
getattr(sql_catalog, create_table_information[1], None)()\n
else:\n
report_list.append("Table `%s` not created (%s)" % create_table_information)\n
return report_list\n
</string>
</value>
</string>
</value>
</item>
</item>
<item>
<item>
...
@@ -78,7 +69,7 @@ return report_list\n
...
@@ -78,7 +69,7 @@ return report_list\n
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
TemplateTool_checkTable
Existence
</string>
</value>
<value>
<string>
TemplateTool_checkTable
Consistency
</string>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
...
...
bt5/erp5_upgrader/bt/template_portal_type_property_sheet_list
View file @
d7d81c20
Template Tool | TemplateToolBusinessTemplateInstallationConstraint
Template Tool | TemplateToolBusinessTemplateInstallationConstraint
Template Tool | TemplateToolTable
Existence
Constraint
Template Tool | TemplateToolTable
Consistency
Constraint
Template Tool | TemplateToolWorkflowChainConsistencyConstraint
Template Tool | TemplateToolWorkflowChainConsistencyConstraint
\ No newline at end of file
bt5/erp5_upgrader/bt/template_property_sheet_id_list
View file @
d7d81c20
TemplateToolBusinessTemplateInstallationConstraint
TemplateToolBusinessTemplateInstallationConstraint
TemplateToolWorkflowChainConsistencyConstraint
TemplateToolWorkflowChainConsistencyConstraint
TemplateToolTableExistenceConstraint
TemplateToolTableConsistencyConstraint
\ No newline at end of file
\ No newline at end of file
bt5/erp5_upgrader_test/SkinTemplateItem/portal_skins/erp5_upgrader_test/Base_getUpgradeBusinessTemplateList.xml
View file @
d7d81c20
...
@@ -50,7 +50,7 @@
...
@@ -50,7 +50,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
_body
</string>
</key>
<key>
<string>
_body
</string>
</key>
<value>
<string>
return (\'erp5_web\',), []\n
<value>
<string>
return (\'erp5_web\',), [
"erp5_upgrader", "erp5_upgrader_test"
]\n
</string>
</value>
</string>
</value>
</item>
</item>
<item>
<item>
...
...
product/ERP5/tests/testXHTML.py
View file @
d7d81c20
...
@@ -170,7 +170,7 @@ class TestXHTMLMixin(ERP5TypeTestCase):
...
@@ -170,7 +170,7 @@ class TestXHTMLMixin(ERP5TypeTestCase):
skins_tool
,
obj_metatypes
=
[
'File'
,
'DTML Method'
,
'DTML Document'
],
search_sub
=
1
):
skins_tool
,
obj_metatypes
=
[
'File'
,
'DTML Method'
,
'DTML Document'
],
search_sub
=
1
):
is_required_check_path
=
True
is_required_check_path
=
True
ignore_bts
=
[
'erp5_jquery'
,
'erp5_fckeditor'
,
'erp5_xinha_editor'
,
ignore_bts
=
[
'erp5_jquery'
,
'erp5_fckeditor'
,
'erp5_xinha_editor'
,
'erp5_jquery_ui'
,
'erp5_ace_editor'
]
'erp5_jquery_ui'
,
'erp5_ace_editor'
,
'erp5_code_mirror'
]
if
script_path
.
endswith
(
'.js'
):
if
script_path
.
endswith
(
'.js'
):
for
ignore_bt_name
in
ignore_bts
:
for
ignore_bt_name
in
ignore_bts
:
if
script_path
.
startswith
(
ignore_bt_name
):
if
script_path
.
startswith
(
ignore_bt_name
):
...
...
product/ERP5Type/tests/testConstraint.py
View file @
d7d81c20
...
@@ -28,6 +28,7 @@
...
@@ -28,6 +28,7 @@
##############################################################################
##############################################################################
import
unittest
import
unittest
from
unittest
import
expectedFailure
from
Products.ERP5Type.tests.testERP5Type
import
PropertySheetTestCase
from
Products.ERP5Type.tests.testERP5Type
import
PropertySheetTestCase
from
AccessControl.SecurityManagement
import
newSecurityManager
from
AccessControl.SecurityManagement
import
newSecurityManager
...
@@ -65,6 +66,9 @@ class TestConstraint(PropertySheetTestCase):
...
@@ -65,6 +66,9 @@ class TestConstraint(PropertySheetTestCase):
self
.
portal
=
self
.
getPortal
()
self
.
portal
=
self
.
getPortal
()
self
.
category_tool
=
self
.
getCategoryTool
()
self
.
category_tool
=
self
.
getCategoryTool
()
self
.
createCategories
()
self
.
createCategories
()
portal_property_sheets
=
self
.
portal
.
portal_property_sheets
if
getattr
(
portal_property_sheets
,
"test_constraint"
,
None
)
!=
None
:
portal_property_sheets
.
manage_delObjects
(
ids
=
[
"test_constraint"
])
def
beforeTearDown
(
self
):
def
beforeTearDown
(
self
):
self
.
login
()
self
.
login
()
...
@@ -72,6 +76,11 @@ class TestConstraint(PropertySheetTestCase):
...
@@ -72,6 +76,11 @@ class TestConstraint(PropertySheetTestCase):
module
=
self
.
portal
.
organisation_module
module
=
self
.
portal
.
organisation_module
module
.
manage_delObjects
(
list
(
module
.
objectIds
()))
module
.
manage_delObjects
(
list
(
module
.
objectIds
()))
super
(
TestConstraint
,
self
).
beforeTearDown
()
super
(
TestConstraint
,
self
).
beforeTearDown
()
portal_type
=
self
.
portal
.
portal_types
[
self
.
object_portal_type
]
if
"TestConstraint"
in
portal_type
.
getTypePropertySheetList
():
portal_type
.
setTypePropertySheetList
(
[
x
for
x
in
portal_type
.
getTypePropertySheetList
()
\
if
x
!=
"TestConstraint"
])
def
createCategories
(
self
):
def
createCategories
(
self
):
"""
"""
...
@@ -110,10 +119,12 @@ class TestConstraint(PropertySheetTestCase):
...
@@ -110,10 +119,12 @@ class TestConstraint(PropertySheetTestCase):
module
=
portal
.
getDefaultModule
(
self
.
object_portal_type
)
module
=
portal
.
getDefaultModule
(
self
.
object_portal_type
)
object
=
module
.
newContent
(
portal_type
=
self
.
object_portal_type
)
object
=
module
.
newContent
(
portal_type
=
self
.
object_portal_type
)
group1
=
object
.
portal_categories
.
restrictedTraverse
(
'group/testGroup1'
)
group1
=
object
.
portal_categories
.
restrictedTraverse
(
'group/testGroup1'
)
sequence
.
edit
(
if
sequence
:
object
=
object
,
sequence
.
edit
(
group
=
group1
,
object
=
object
,
)
group
=
group1
,
)
return
object
def
stepSetObjectGroup
(
self
,
sequence
=
None
,
def
stepSetObjectGroup
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
sequence_list
=
None
,
**
kw
):
...
@@ -1581,6 +1592,33 @@ class TestConstraint(PropertySheetTestCase):
...
@@ -1581,6 +1592,33 @@ class TestConstraint(PropertySheetTestCase):
sequence_list
.
play
(
self
)
sequence_list
.
play
(
self
)
def
createConstraintThatMustBeCalledOnce
(
self
):
"""
Create a default allowing the check if they are called once
"""
property_sheet
=
self
.
portal
.
portal_property_sheets
.
newContent
(
id
=
"TestConstraint"
,
title
=
"Test Constraint"
)
constraint
=
property_sheet
.
newContent
(
portal_type
=
"TALES Constraint"
,
id
=
"check_title_constraint"
,
expression
=
"python: object.setTitle(object.getTitle() + 'a')"
)
portal_type
=
self
.
portal
.
portal_types
[
self
.
object_portal_type
]
if
"TestConstraint"
not
in
portal_type
.
getTypePropertySheetList
():
portal_type
.
setTypePropertySheetList
(
portal_type
.
getTypePropertySheetList
()
+
[
"TestConstraint"
])
# Expected failure until checkConsistency is reviewed to not execute
# twice constraints
@
expectedFailure
def
test_09_CheckConstraintAreCalledOnce
(
self
):
"""
Make sure we call only one time a constraint in a particular object
"""
self
.
createConstraintThatMustBeCalledOnce
()
document
=
self
.
stepCreateObject
()
document
.
setTitle
(
"Foo"
)
document
.
checkConsistency
()
self
.
assertEqual
(
"Fooa"
,
document
.
getTitle
())
def
test_suite
():
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
TestConstraint
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestConstraint
))
...
...
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