Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ayush Tiwari
erp5
Commits
62261452
Commit
62261452
authored
Sep 26, 2017
by
Ayush Tiwari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bt5_config: Move interfaces and mixins for patchable and json_representable to ERP5Type
parent
2e6fe715
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
11 deletions
+7
-11
product/ERP5Type/interfaces/json_representable.py
product/ERP5Type/interfaces/json_representable.py
+0
-0
product/ERP5Type/interfaces/patchable.py
product/ERP5Type/interfaces/patchable.py
+0
-0
product/ERP5Type/mixin/json_representable.py
product/ERP5Type/mixin/json_representable.py
+6
-10
product/ERP5Type/mixin/patchable.py
product/ERP5Type/mixin/patchable.py
+1
-1
No files found.
product/ERP5/interfaces/json_representable.py
→
product/ERP5
Type
/interfaces/json_representable.py
View file @
62261452
File moved
product/ERP5/interfaces/patchable.py
→
product/ERP5
Type
/interfaces/patchable.py
View file @
62261452
File moved
product/ERP5/mixin/json_representable.py
→
product/ERP5
Type
/mixin/json_representable.py
View file @
62261452
...
...
@@ -28,12 +28,12 @@
##############################################################################
import
json
import
xmldict
import
xml
to
dict
import
zope.interface
from
OFS
import
XMLExportImport
from
StringIO
import
StringIO
from
AccessControl
import
ClassSecurityInfo
from
Products.ERP5.interfaces.json_representable
import
IJSONRepresentable
from
Products.ERP5
Type
.interfaces.json_representable
import
IJSONRepresentable
from
Products.ERP5Type
import
Permissions
from
Products.ERP5Type.Globals
import
InitializeClass
...
...
@@ -42,18 +42,18 @@ class JSONRepresentableMixin:
An implementation for IJSONRepresentable
"""
zope
.
interface
.
implements
(
IJSONRepresentable
)
# Declarative Security
security
=
ClassSecurityInfo
()
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
zope
.
interface
.
implements
(
IJSONRepresentable
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'asJSON'
)
def
asJSON
(
self
):
"""
Generate a JSON representable content for ERP5 object
Currently we use `
asXML
` to first convert the object to its XML
Currently we use `
XMLExportImport
` to first convert the object to its XML
respresentation and then use xmltodict to convert it to dict and JSON
format finally
"""
...
...
@@ -65,10 +65,6 @@ class JSONRepresentableMixin:
xml_value
=
f
.
getvalue
()
# Convert the XML to json representation
return
json
.
dumps
(
xmldict
.
xml_to_dict
(
xml_value
))
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'fromJSON'
)
def
fromJSON
(
self
):
pass
return
json
.
dumps
(
xmltodict
.
parse
(
xml_value
))
InitializeClass
(
JSONRepresentableMixin
)
product/ERP5/mixin/patchable.py
→
product/ERP5
Type
/mixin/patchable.py
View file @
62261452
...
...
@@ -29,7 +29,7 @@
import
zope.interface
from
Products.ERP5.interfaces.patchable
import
IPatchable
from
Products.ERP5
Type
.interfaces.patchable
import
IPatchable
from
AccessControl
import
ClassSecurityInfo
from
Products.ERP5Type
import
Permissions
from
Products.ERP5Type.Globals
import
InitializeClass
...
...
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