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
Xavier Thompson
erp5
Commits
ca4129ba
Commit
ca4129ba
authored
Dec 21, 2012
by
Pere Cortes
Committed by
Sebastien Robin
Jan 24, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_safeimage: External Functions added
parent
20492ea5
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
630 additions
and
1 deletion
+630
-1
bt5/erp5_safeimage/ExtensionTemplateItem/ERP5SafeImage_Selenium.py
...safeimage/ExtensionTemplateItem/ERP5SafeImage_Selenium.py
+51
-0
bt5/erp5_safeimage/ExtensionTemplateItem/ERP5ZoomifyImage.py
bt5/erp5_safeimage/ExtensionTemplateItem/ERP5ZoomifyImage.py
+576
-0
bt5/erp5_safeimage/bt/revision
bt5/erp5_safeimage/bt/revision
+1
-1
bt5/erp5_safeimage/bt/template_extension_id_list
bt5/erp5_safeimage/bt/template_extension_id_list
+2
-0
No files found.
bt5/erp5_safeimage/ExtensionTemplateItem/ERP5SafeImage_Selenium.py
0 → 100644
View file @
ca4129ba
import
Image
as
PIL_Image
import
os
import
transaction
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
class
FileUpload
(
file
):
"""Act as an uploaded file.
"""
__allow_access_to_unprotected_subobjects__
=
1
def
__init__
(
self
,
path
,
name
):
self
.
filename
=
name
file
.
__init__
(
self
,
path
)
self
.
headers
=
{}
def
makeFilePath
(
name
):
# return os.path.join(os.path.dirname(__file__), 'tmp', name)
return
name
def
makeFileUpload
(
name
,
as_name
=
None
):
if
as_name
is
None
:
as_name
=
name
path
=
makeFilePath
(
name
)
return
FileUpload
(
path
,
as_name
)
def
uploadImage
(
self
):
portal
=
self
.
getPortalObject
()
image
=
portal
.
restrictedTraverse
(
'portal_skins/erp5_safeimage/img/image_test.jpg'
)
path_image
=
"tmp/selenium_image_test.jpg"
fd
=
os
.
open
(
path_image
,
os
.
O_CREAT
|
os
.
O_RDWR
)
os
.
write
(
fd
,
str
(
image
.
data
))
os
.
close
(
fd
)
tile_image_transformed
=
makeFileUpload
(
path_image
)
tile_transformed
=
self
.
image_module
.
newContent
(
portal_type
=
'Image Tile Transformed'
,
title
=
'testTileTransformed'
,
id
=
'testTileTransformed'
,
file
=
tile_image_transformed
,
filename
=
'testTileTransformed'
)
if
tile_transformed
:
return
True
else
:
return
False
def
cleanUp
(
self
):
portal
=
self
.
getPortalObject
()
print
"exists path: %r"
%
os
.
path
.
exists
(
"tmp/selenium_image_test.jpg"
)
if
os
.
path
.
exists
(
"tmp/selenium_image_test.jpg"
):
print
"REMOVE IMAGE: %s"
%
(
os
.
remove
(
"tmp/selenium_image_test.jpg"
))
portal
.
image_module
.
manage_delObjects
(
ids
=
[
'testTileTransformed'
])
return
True
else
:
return
False
bt5/erp5_safeimage/ExtensionTemplateItem/ERP5ZoomifyImage.py
0 → 100644
View file @
ca4129ba
This diff is collapsed.
Click to expand it.
bt5/erp5_safeimage/bt/revision
View file @
ca4129ba
10
\ No newline at end of file
11
\ No newline at end of file
bt5/erp5_safeimage/bt/template_extension_id_list
0 → 100644
View file @
ca4129ba
ERP5SafeImage_Selenium
ERP5ZoomifyImage
\ No newline at end of file
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