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
Frederic Thoma
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>
<portal_type
id=
"Template Tool"
>
<item>
TemplateToolBusinessTemplateInstallationConstraint
</item>
<item>
TemplateToolTable
Existence
Constraint
</item>
<item>
TemplateToolTable
Consistency
Constraint
</item>
<item>
TemplateToolWorkflowChainConsistencyConstraint
</item>
</portal_type>
</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 @@
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
TemplateToolTable
Existence
Constraint
</string>
</value>
<value>
<string>
TemplateToolTable
Consistency
Constraint
</string>
</value>
</item>
<item>
<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 @@
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
table_
existence
_constraint
</string>
</value>
<value>
<string>
table_
consistency
_constraint
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
...
...
@@ -42,7 +42,7 @@
</item>
<item>
<key>
<string>
script_id
</string>
</key>
<value>
<string>
TemplateTool_checkTable
Existence
</string>
</value>
<value>
<string>
TemplateTool_checkTable
Consistency
</string>
</value>
</item>
</dictionary>
</pickle>
...
...
bt5/erp5_upgrader/SkinTemplateItem/portal_skins/erp5_upgrader/Base_getUpgradeBusinessTemplateList.xml
View file @
d7d81c20
...
...
@@ -57,7 +57,7 @@
a old business template without updating it and without removing it\n
"""\n
\n
return (\'erp5_base\',), []\n
return (\'erp5_base\',), [
"erp5_upgrader"
]\n
</string>
</value>
</item>
<item>
...
...
bt5/erp5_upgrader/SkinTemplateItem/portal_skins/erp5_upgrader/TemplateTool_checkBusinessTemplateInstallation.xml
View file @
d7d81c20
...
...
@@ -54,6 +54,7 @@
\n
template_tool = context.getPortalObject().portal_templates\n
return template_tool.upgradeSite(bt5_list,\n
delete_orphaned=True,\n
keep_bt5_id_set=keep_bt5_id_set,\n
dry_run=(not fixit))\n
</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 @@
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
"""\n
Check for some table
existence
according to the create table list.\n
If `fixit` is True, then it
uses the associated sql_method to create it.
\n
Check for some table
consistency
according to the create table list.\n
If `fixit` is True, then it
will create/drop table or alter existing tables
\n
"""\n
create_table_list = [\n
# ("category", "z_create_category"), # example\n
("catalog_full_text", "z_create_catalog_fulltext"),\n
]\n
sql_catalog = context.portal_catalog.getSQLCatalog()\n
table_list = [r[0] for r in sql_catalog.z_show_tables(table="not needed so far")]\n
report_list = []\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
portal = context.getPortalObject()\n
show_source = not(fixit)\n
sql_src = portal.portal_catalog.upgradeSchema(src__=show_source)\n
result = []\n
if sql_src:\n
result.append(sql_src)\n
return result\n
</string>
</value>
</item>
<item>
...
...
@@ -78,7 +69,7 @@ return report_list\n
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
TemplateTool_checkTable
Existence
</string>
</value>
<value>
<string>
TemplateTool_checkTable
Consistency
</string>
</value>
</item>
</dictionary>
</pickle>
...
...
bt5/erp5_upgrader/bt/template_portal_type_property_sheet_list
View file @
d7d81c20
Template Tool | TemplateToolBusinessTemplateInstallationConstraint
Template Tool | TemplateToolTable
Existence
Constraint
Template Tool | TemplateToolTable
Consistency
Constraint
Template Tool | TemplateToolWorkflowChainConsistencyConstraint
\ No newline at end of file
bt5/erp5_upgrader/bt/template_property_sheet_id_list
View file @
d7d81c20
TemplateToolBusinessTemplateInstallationConstraint
TemplateToolWorkflowChainConsistencyConstraint
TemplateToolTableExistenceConstraint
\ No newline at end of file
TemplateToolTableConsistencyConstraint
\ 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 @@
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
return (\'erp5_web\',), []\n
<value>
<string>
return (\'erp5_web\',), [
"erp5_upgrader", "erp5_upgrader_test"
]\n
</string>
</value>
</item>
<item>
...
...
product/ERP5/tests/testXHTML.py
View file @
d7d81c20
...
...
@@ -170,7 +170,7 @@ class TestXHTMLMixin(ERP5TypeTestCase):
skins_tool
,
obj_metatypes
=
[
'File'
,
'DTML Method'
,
'DTML Document'
],
search_sub
=
1
):
is_required_check_path
=
True
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'
):
for
ignore_bt_name
in
ignore_bts
:
if
script_path
.
startswith
(
ignore_bt_name
):
...
...
product/ERP5Type/tests/testConstraint.py
View file @
d7d81c20
...
...
@@ -28,6 +28,7 @@
##############################################################################
import
unittest
from
unittest
import
expectedFailure
from
Products.ERP5Type.tests.testERP5Type
import
PropertySheetTestCase
from
AccessControl.SecurityManagement
import
newSecurityManager
...
...
@@ -65,6 +66,9 @@ class TestConstraint(PropertySheetTestCase):
self
.
portal
=
self
.
getPortal
()
self
.
category_tool
=
self
.
getCategoryTool
()
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
):
self
.
login
()
...
...
@@ -72,6 +76,11 @@ class TestConstraint(PropertySheetTestCase):
module
=
self
.
portal
.
organisation_module
module
.
manage_delObjects
(
list
(
module
.
objectIds
()))
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
):
"""
...
...
@@ -110,10 +119,12 @@ class TestConstraint(PropertySheetTestCase):
module
=
portal
.
getDefaultModule
(
self
.
object_portal_type
)
object
=
module
.
newContent
(
portal_type
=
self
.
object_portal_type
)
group1
=
object
.
portal_categories
.
restrictedTraverse
(
'group/testGroup1'
)
sequence
.
edit
(
object
=
object
,
group
=
group1
,
)
if
sequence
:
sequence
.
edit
(
object
=
object
,
group
=
group1
,
)
return
object
def
stepSetObjectGroup
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
...
...
@@ -1581,6 +1592,33 @@ class TestConstraint(PropertySheetTestCase):
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
():
suite
=
unittest
.
TestSuite
()
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