Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Products.DCWorkflow
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Products.DCWorkflow
Commits
d620d4e1
Commit
d620d4e1
authored
May 03, 2011
by
rico Andrei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix an issue with Generic Setup and non-ascii chars in workflow definition
parent
1881ce5d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
2 deletions
+52
-2
Products/DCWorkflow/CHANGES.txt
Products/DCWorkflow/CHANGES.txt
+2
-0
Products/DCWorkflow/exportimport.py
Products/DCWorkflow/exportimport.py
+3
-1
Products/DCWorkflow/tests/test_exportimport.py
Products/DCWorkflow/tests/test_exportimport.py
+47
-1
No files found.
Products/DCWorkflow/CHANGES.txt
View file @
d620d4e1
...
...
@@ -4,6 +4,8 @@ Products.DCWorkflow Changelog
2.2.4 (unreleased)
------------------
- Fixed issue with non-ascii chars in workflow definitions
- Don't crash worklist's ``manage_main`` if variables are Expression objects.
(https://bugs.launchpad.net/zope-cmf/+bug/731394)
...
...
Products/DCWorkflow/exportimport.py
View file @
d620d4e1
...
...
@@ -49,7 +49,9 @@ class DCWorkflowDefinitionBodyAdapter(BodyAdapterBase):
"""Export the object as a file body.
"""
wfdc
=
WorkflowDefinitionConfigurator
(
self
.
context
)
return
wfdc
.
__of__
(
self
.
context
).
generateWorkflowXML
()
body
=
wfdc
.
__of__
(
self
.
context
).
generateWorkflowXML
()
body
=
body
.
encode
(
'utf-8'
)
return
body
def
_importBody
(
self
,
body
):
"""Import the object from the file body.
...
...
Products/DCWorkflow/tests/test_exportimport.py
View file @
d620d4e1
##############################################################################
# -*- coding:utf-8 -*-
###############################################################################
#
# Copyright (c) 2004 Zope Foundation and Contributors.
#
...
...
@@ -16,6 +17,8 @@
import
unittest
import
Testing
from
StringIO
import
StringIO
from
Products.PythonScripts.PythonScript
import
PythonScript
from
Products.ExternalMethod.ExternalMethod
import
ExternalMethod
...
...
@@ -33,6 +36,7 @@ from Products.DCWorkflow.Transitions import TRIGGER_USER_ACTION
from
Products.DCWorkflow.Transitions
import
TRIGGER_AUTOMATIC
from
Products.GenericSetup.tests.common
import
DummyExportContext
from
Products.GenericSetup.tests.common
import
DummyImportContext
from
Products.GenericSetup.tests.common
import
TarballTester
class
_GuardChecker
:
...
...
@@ -1978,6 +1982,47 @@ class Test_exportWorkflow(_WorkflowSetup, _GuardChecker):
self
.
assertEqual
(
text
,
_AFTER_CLOSE_SCRIPT
)
self
.
assertEqual
(
content_type
,
'text/plain'
)
class
Test_exportUTFWorkflow
(
Test_exportWorkflow
,
TarballTester
):
layer
=
ExportImportZCMLLayer
def
test_utf_strings
(
self
):
from
Products.CMFCore.exportimport.workflow
import
exportWorkflowTool
from
Products.GenericSetup.context
import
TarballExportContext
WF_ID_DC
=
'workflow'
WF_TITLE_DC
=
u'A workflow with special chars like è é'
WF_DESCRIPTION_DC
=
u'A workflow with lots of special chars ç'
WF_INITIAL_STATE
=
'closed'
site
=
self
.
_initSite
()
dcworkflow
=
self
.
_initDCWorkflow
(
WF_ID_DC
)
dcworkflow
.
title
=
WF_TITLE_DC
dcworkflow
.
description
=
WF_DESCRIPTION_DC
dcworkflow
.
initial_state
=
WF_INITIAL_STATE
dcworkflow
.
permissions
=
_WF_PERMISSIONS
self
.
_initVariables
(
dcworkflow
)
self
.
_initStates
(
dcworkflow
)
self
.
_initTransitions
(
dcworkflow
)
self
.
_initWorklists
(
dcworkflow
)
ctx
=
TarballExportContext
(
site
)
context
=
DummyExportContext
(
site
)
exportWorkflowTool
(
context
)
self
.
assertEqual
(
len
(
context
.
_wrote
),
2
)
for
filename
,
text
,
content_type
in
context
.
_wrote
:
ctx
.
writeDataFile
(
filename
,
text
,
content_type
)
fileish
=
StringIO
(
ctx
.
getArchive
()
)
self
.
_verifyTarballContents
(
fileish
,
[
'workflows/workflow'
,
'workflows'
,
'workflows.xml'
,
'workflows/workflow/definition.xml'
])
self
.
_verifyTarballEntry
(
fileish
,
'workflows.xml'
,
context
.
_wrote
[
0
][
1
]
)
self
.
_verifyTarballEntry
(
fileish
,
'workflows/workflow/definition.xml'
,
context
.
_wrote
[
1
][
1
]
)
class
Test_importWorkflow
(
_WorkflowSetup
,
_GuardChecker
):
...
...
@@ -2552,5 +2597,6 @@ def test_suite():
return
unittest
.
TestSuite
((
unittest
.
makeSuite
(
WorkflowDefinitionConfiguratorTests
),
unittest
.
makeSuite
(
Test_exportWorkflow
),
unittest
.
makeSuite
(
Test_exportUTFWorkflow
),
unittest
.
makeSuite
(
Test_importWorkflow
),
))
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