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
Paul Graydon
erp5
Commits
3b3d2a84
Commit
3b3d2a84
authored
May 01, 2022
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP: zope4py3 TODO.
parent
e3af970e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
76 additions
and
85 deletions
+76
-85
product/ERP5Type/XMLExportImport/__init__.py
product/ERP5Type/XMLExportImport/__init__.py
+3
-1
product/ERP5Type/XMLExportImport/ppml.py
product/ERP5Type/XMLExportImport/ppml.py
+3
-2
product/PortalTransforms/libtransforms/utils.py
product/PortalTransforms/libtransforms/utils.py
+70
-68
product/TimerService/timerserver/component.xml
product/TimerService/timerserver/component.xml
+0
-14
No files found.
product/ERP5Type/XMLExportImport/__init__.py
View file @
3b3d2a84
...
...
@@ -40,7 +40,9 @@
from
Acquisition
import
aq_base
,
aq_inner
from
collections
import
OrderedDict
from
io
import
BytesIO
from
zodbpickle.pickle
import
Pickler
# XXX-zope4py3: Python3 C implementation does not have Unpickler.dispatch
# attribute. dispatch_table should be used instead.
from
zodbpickle.slowpickle
import
Pickler
from
xml.sax.saxutils
import
escape
,
unescape
from
lxml
import
etree
from
lxml.etree
import
Element
,
SubElement
...
...
product/ERP5Type/XMLExportImport/ppml.py
View file @
3b3d2a84
...
...
@@ -15,8 +15,9 @@
"""Provide conversion between Python pickles and XML
"""
# Python3 C implementation does not have Unpickler.dispatch attribute
from
zodbpickle.pickle
import
*
# XXX-zope4py3: Python3 C implementation does not have Unpickler.dispatch
# attribute. dispatch_table should be used instead.
from
zodbpickle.slowpickle
import
*
import
struct
import
base64
...
...
product/PortalTransforms/libtransforms/utils.py
View file @
3b3d2a84
import
re
import
os
import
sys
from
sgmllib
import
SGMLParser
,
SGMLParseError
# XXX-zope4py3: sgmllib removed from standard library in favor of
# html.parser.HTMLParser
#from sgmllib import SGMLParser, SGMLParseError
try
:
# Need to be imported before win32api to avoid dll loading
...
...
@@ -142,95 +144,95 @@ NASTY_TAGS = { 'script' : 1
class
IllegalHTML
(
ValueError
):
pass
class
StrippingParser
(
SGMLParser
):
""" Pass only allowed tags; raise exception for known-bad. """
#
class StrippingParser( SGMLParser ):
#
""" Pass only allowed tags; raise exception for known-bad. """
from
htmlentitydef
s
import
entitydefs
# replace entitydefs from sgmllib
# from html.entitie
s import entitydefs # replace entitydefs from sgmllib
def
__init__
(
self
):
#
def __init__( self ):
SGMLParser
.
__init__
(
self
)
self
.
result
=
""
#
SGMLParser.__init__( self )
#
self.result = ""
def
handle_data
(
self
,
data
):
#
def handle_data( self, data ):
if
data
:
self
.
result
=
self
.
result
+
data
#
if data:
#
self.result = self.result + data
def
handle_charref
(
self
,
name
):
#
def handle_charref( self, name ):
self
.
result
=
"%s&#%s;"
%
(
self
.
result
,
name
)
#
self.result = "%s&#%s;" % ( self.result, name )
def
handle_entityref
(
self
,
name
):
#
def handle_entityref(self, name):
if
name
in
self
.
entitydefs
:
x
=
';'
else
:
# this breaks unstandard entities that end with ';'
x
=
''
#
if name in self.entitydefs:
#
x = ';'
#
else:
#
# this breaks unstandard entities that end with ';'
#
x = ''
self
.
result
=
"%s&%s%s"
%
(
self
.
result
,
name
,
x
)
#
self.result = "%s&%s%s" % (self.result, name, x)
def
unknown_starttag
(
self
,
tag
,
attrs
):
#
def unknown_starttag(self, tag, attrs):
""" Delete all tags except for legal ones.
"""
if
tag
in
VALID_TAGS
:
#
""" Delete all tags except for legal ones.
#
"""
#
if tag in VALID_TAGS:
self
.
result
=
self
.
result
+
'<'
+
tag
#
self.result = self.result + '<' + tag
for
k
,
v
in
attrs
:
#
for k, v in attrs:
if
k
.
lower
().
startswith
(
'on'
):
raise
IllegalHTML
(
'Javascipt event "%s" not allowed.'
%
k
)
#
if k.lower().startswith( 'on' ):
#
raise IllegalHTML('Javascipt event "%s" not allowed.' % k)
if
v
.
lower
().
startswith
(
'javascript:'
):
raise
IllegalHTML
(
'Javascipt URI "%s" not allowed.'
%
v
)
#
if v.lower().startswith( 'javascript:' ):
#
raise IllegalHTML('Javascipt URI "%s" not allowed.' % v)
self
.
result
=
'%s %s="%s"'
%
(
self
.
result
,
k
,
v
)
#
self.result = '%s %s="%s"' % (self.result, k, v)
endTag
=
'</%s>'
%
tag
if
VALID_TAGS
.
get
(
tag
):
self
.
result
=
self
.
result
+
'>'
else
:
self
.
result
=
self
.
result
+
' />'
#
endTag = '</%s>' % tag
#
if VALID_TAGS.get(tag):
#
self.result = self.result + '>'
#
else:
#
self.result = self.result + ' />'
elif
NASTY_TAGS
.
get
(
tag
):
raise
IllegalHTML
(
'Dynamic tag "%s" not allowed.'
%
tag
)
#
elif NASTY_TAGS.get( tag ):
#
raise IllegalHTML('Dynamic tag "%s" not allowed.' % tag)
else
:
pass
# omit tag
#
else:
#
pass # omit tag
def
unknown_endtag
(
self
,
tag
):
#
def unknown_endtag(self, tag):
if
VALID_TAGS
.
get
(
tag
):
#
if VALID_TAGS.get( tag ):
self
.
result
=
"%s</%s>"
%
(
self
.
result
,
tag
)
remTag
=
'</%s>'
%
tag
#
self.result = "%s</%s>" % (self.result, tag)
#
remTag = '</%s>' % tag
def
parse_declaration
(
self
,
i
):
"""Fix handling of CDATA sections. Code borrowed from BeautifulSoup.
"""
j
=
None
if
self
.
rawdata
[
i
:
i
+
9
]
==
'<![CDATA['
:
k
=
self
.
rawdata
.
find
(
']]>'
,
i
)
if
k
==
-
1
:
k
=
len
(
self
.
rawdata
)
data
=
self
.
rawdata
[
i
+
9
:
k
]
j
=
k
+
3
self
.
result
.
append
(
"<![CDATA[%s]]>"
%
data
)
else
:
try
:
j
=
SGMLParser
.
parse_declaration
(
self
,
i
)
except
SGMLParseError
:
toHandle
=
self
.
rawdata
[
i
:]
self
.
result
.
append
(
toHandle
)
j
=
i
+
len
(
toHandle
)
return
j
#
def parse_declaration(self, i):
#
"""Fix handling of CDATA sections. Code borrowed from BeautifulSoup.
#
"""
#
j = None
#
if self.rawdata[i:i+9] == '<![CDATA[':
#
k = self.rawdata.find(']]>', i)
#
if k == -1:
#
k = len(self.rawdata)
#
data = self.rawdata[i+9:k]
#
j = k+3
#
self.result.append("<![CDATA[%s]]>" % data)
#
else:
#
try:
#
j = SGMLParser.parse_declaration(self, i)
#
except SGMLParseError:
#
toHandle = self.rawdata[i:]
#
self.result.append(toHandle)
#
j = i + len(toHandle)
#
return j
def
scrubHTML
(
html
):
""" Strip illegal HTML tags from string text. """
parser
=
StrippingParser
()
parser
.
feed
(
html
)
parser
.
close
()
return
parser
.
result
#
def scrubHTML( html ):
#
""" Strip illegal HTML tags from string text. """
#
parser = StrippingParser()
#
parser.feed( html )
#
parser.close()
#
return parser.result
product/TimerService/timerserver/component.xml
deleted
100644 → 0
View file @
e3af970e
<component>
<import
package=
"ZServer"
/>
<sectiontype
name=
"timer-server"
datatype=
"Products.TimerService.timerserver.TimerServerFactory"
implements=
"ZServer.server"
>
<key
name=
"interval"
datatype=
"float"
default=
"600"
>
<description>
Interval in seconds. Supports fractions of a second.
</description>
</key>
</sectiontype>
</component>
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