Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
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
Zope
Commits
b3fa9c1b
Commit
b3fa9c1b
authored
Jul 18, 2011
by
Nikolay Kim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
micro optimization
parent
cea3fed4
Changes
15
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
27 additions
and
27 deletions
+27
-27
src/App/ApplicationManager.py
src/App/ApplicationManager.py
+1
-1
src/App/ImageFile.py
src/App/ImageFile.py
+1
-1
src/App/special_dtml.py
src/App/special_dtml.py
+1
-1
src/OFS/Application.py
src/OFS/Application.py
+1
-1
src/OFS/CopySupport.py
src/OFS/CopySupport.py
+2
-2
src/OFS/DTMLDocument.py
src/OFS/DTMLDocument.py
+3
-3
src/OFS/DTMLMethod.py
src/OFS/DTMLMethod.py
+3
-3
src/OFS/ObjectManager.py
src/OFS/ObjectManager.py
+3
-3
src/OFS/PropertyManager.py
src/OFS/PropertyManager.py
+1
-1
src/OFS/PropertySheets.py
src/OFS/PropertySheets.py
+1
-1
src/OFS/SimpleItem.py
src/OFS/SimpleItem.py
+2
-2
src/Products/Sessions/BrowserIdManager.py
src/Products/Sessions/BrowserIdManager.py
+3
-3
src/Products/Sessions/SessionDataManager.py
src/Products/Sessions/SessionDataManager.py
+1
-1
src/ZPublisher/HTTPRequest.py
src/ZPublisher/HTTPRequest.py
+2
-2
src/ZServer/HTTPResponse.py
src/ZServer/HTTPResponse.py
+2
-2
No files found.
src/App/ApplicationManager.py
View file @
b3fa9c1b
...
...
@@ -346,7 +346,7 @@ class ApplicationManager(Folder,CacheManager):
def
db_size
(
self
):
s
=
self
.
_p_jar
.
db
().
getSize
()
if
type
(
s
)
is
type
(
''
)
:
if
type
(
s
)
is
str
:
return
s
if
s
>=
1048576.0
:
...
...
src/App/ImageFile.py
View file @
b3fa9c1b
...
...
@@ -52,7 +52,7 @@ class ImageFile(Explicit):
_prefix
=
getattr
(
getConfiguration
(),
'softwarehome'
,
None
)
or
PREFIX
if
not
os
.
path
.
isabs
(
path
):
warnings
.
warn
(
NON_PREFIX_WARNING
,
UserWarning
,
2
)
elif
type
(
_prefix
)
is
not
type
(
''
)
:
elif
type
(
_prefix
)
is
not
str
:
_prefix
=
package_home
(
_prefix
)
# _prefix is ignored if path is absolute
path
=
os
.
path
.
join
(
_prefix
,
path
)
...
...
src/App/special_dtml.py
View file @
b3fa9c1b
...
...
@@ -41,7 +41,7 @@ class ClassicHTMLFile(DocumentTemplate.HTMLFile,MethodObject.Method,):
def
__init__
(
self
,
name
,
_prefix
=
None
,
**
kw
):
if
_prefix
is
None
:
_prefix
=
getattr
(
getConfiguration
(),
'softwarehome'
,
PREFIX
)
elif
type
(
_prefix
)
is
not
type
(
''
)
:
elif
type
(
_prefix
)
is
not
str
:
_prefix
=
Common
.
package_home
(
_prefix
)
args
=
(
self
,
os
.
path
.
join
(
_prefix
,
name
+
'.dtml'
))
if
'__name__'
not
in
kw
:
...
...
src/OFS/Application.py
View file @
b3fa9c1b
...
...
@@ -587,7 +587,7 @@ def import_product(product_dir, product_name, raise_exc=0, log_exc=1):
path_join
=
os
.
path
.
join
isdir
=
os
.
path
.
isdir
exists
=
os
.
path
.
exists
_st
=
type
(
''
)
_st
=
str
global_dict
=
globals
()
silly
=
(
'__doc__'
,)
modules
=
sys
.
modules
...
...
src/OFS/CopySupport.py
View file @
b3fa9c1b
...
...
@@ -102,7 +102,7 @@ class CopyContainer(Base):
elif
ids
is
None
:
raise
ValueError
(
'ids must be specified'
)
if
type
(
ids
)
is
type
(
''
)
:
if
type
(
ids
)
is
str
:
ids
=
[
ids
]
oblist
=
[]
for
id
in
ids
:
...
...
@@ -133,7 +133,7 @@ class CopyContainer(Base):
elif
ids
is
None
:
raise
ValueError
(
'ids must be specified'
)
if
type
(
ids
)
is
type
(
''
)
:
if
type
(
ids
)
is
str
:
ids
=
[
ids
]
oblist
=
[]
for
id
in
ids
:
...
...
src/OFS/DTMLDocument.py
View file @
b3fa9c1b
...
...
@@ -59,7 +59,7 @@ class DTMLDocument(PropertyManager, DTMLMethod):
raise
ResourceLockedError
(
'This document has been locked via WebDAV.'
)
if
type
(
file
)
is
not
type
(
''
)
:
if
type
(
file
)
is
not
str
:
if
REQUEST
and
not
file
:
raise
ValueError
,
'No file specified'
file
=
file
.
read
()
...
...
@@ -103,7 +103,7 @@ class DTMLDocument(PropertyManager, DTMLMethod):
return
result
r
=
apply
(
HTML
.
__call__
,
(
self
,
(
client
,
bself
),
REQUEST
),
kw
)
if
type
(
r
)
is
not
type
(
''
)
or
RESPONSE
is
None
:
if
type
(
r
)
is
not
str
or
RESPONSE
is
None
:
if
not
self
.
_cache_namespace_keys
:
self
.
ZCacheable_set
(
r
)
return
r
...
...
@@ -143,7 +143,7 @@ def addDTMLDocument(self, id, title='', file='', REQUEST=None, submit=None):
"""Add a DTML Document object with the contents of file. If
'file' is empty, default document text is used.
"""
if
type
(
file
)
is
not
type
(
''
)
:
if
type
(
file
)
is
not
str
:
file
=
file
.
read
()
if
not
file
:
file
=
default_dd_html
...
...
src/OFS/DTMLMethod.py
View file @
b3fa9c1b
...
...
@@ -144,7 +144,7 @@ class DTMLMethod(RestrictedDTML,
return
result
r
=
apply
(
HTML
.
__call__
,
(
self
,
client
,
REQUEST
),
kw
)
if
type
(
r
)
is
not
type
(
''
)
or
RESPONSE
is
None
:
if
type
(
r
)
is
not
str
or
RESPONSE
is
None
:
if
not
self
.
_cache_namespace_keys
:
self
.
ZCacheable_set
(
r
)
return
r
...
...
@@ -305,7 +305,7 @@ class DTMLMethod(RestrictedDTML,
if
self
.
wl_isLocked
():
raise
ResourceLockedError
(
'This DTML Method is locked via WebDAV'
)
if
type
(
file
)
is
not
type
(
''
)
:
if
type
(
file
)
is
not
str
:
if
REQUEST
and
not
file
:
raise
ValueError
(
'No file specified'
)
file
=
file
.
read
()
...
...
@@ -459,7 +459,7 @@ def addDTMLMethod(self, id, title='', file='', REQUEST=None, submit=None):
"""
Add
a
DTML
Method
object
with
the
contents
of
file
.
If
'file'
is
empty
,
default
document
text
is
used
.
"""
if type(file) is not
type('')
:
if type(file) is not
str
:
file = file.read()
if not file:
file = default_dm_html
...
...
src/OFS/ObjectManager.py
View file @
b3fa9c1b
...
...
@@ -411,7 +411,7 @@ class ObjectManager(CopyContainer,
# If 'spec' is specified, returns objects whose meta_type
# matches 'spec'.
if
spec
is
not
None
:
if
type
(
spec
)
==
type
(
's'
)
:
if
type
(
spec
)
is
str
:
spec
=
[
spec
]
set
=
[]
for
ob
in
self
.
_objects
:
...
...
@@ -471,7 +471,7 @@ class ObjectManager(CopyContainer,
def
superValues
(
self
,
t
):
# Return all of the objects of a given type located in
# this object and containing objects.
if
type
(
t
)
==
type
(
's'
)
:
t
=
(
t
,)
if
type
(
t
)
is
str
:
t
=
(
t
,)
obj
=
self
seen
=
{}
vals
=
[]
...
...
@@ -507,7 +507,7 @@ class ObjectManager(CopyContainer,
The objects specified in 'ids' get deleted.
"""
if
type
(
ids
)
is
type
(
''
)
:
ids
=
[
ids
]
if
type
(
ids
)
is
str
:
ids
=
[
ids
]
if
not
ids
:
return
MessageDialog
(
title
=
'No items specified'
,
message
=
'No items were specified!'
,
...
...
src/OFS/PropertyManager.py
View file @
b3fa9c1b
...
...
@@ -202,7 +202,7 @@ class PropertyManager(Base, ElementWithAttributes):
self
.
_wrapperCheck
(
value
)
if
not
self
.
hasProperty
(
id
):
raise
BadRequest
,
'The property %s does not exist'
%
escape
(
id
)
if
type
(
value
)
==
type
(
''
)
:
if
type
(
value
)
is
str
:
proptype
=
self
.
getPropertyType
(
id
)
or
'string'
if
proptype
in
type_converters
:
value
=
type_converters
[
proptype
](
value
)
...
...
src/OFS/PropertySheets.py
View file @
b3fa9c1b
...
...
@@ -231,7 +231,7 @@ class PropertySheet(Traversable, Persistent, Implicit):
propinfo
=
self
.
propertyInfo
(
id
)
if
not
'w'
in
propinfo
.
get
(
'mode'
,
'wd'
):
raise
BadRequest
,
'%s cannot be changed.'
%
escape
(
id
)
if
type
(
value
)
==
type
(
''
)
:
if
type
(
value
)
is
str
:
proptype
=
propinfo
.
get
(
'type'
,
'string'
)
if
proptype
in
type_converters
:
value
=
type_converters
[
proptype
](
value
)
...
...
src/OFS/SimpleItem.py
View file @
b3fa9c1b
...
...
@@ -189,9 +189,9 @@ class Item(Base,
# allow for a few different traceback options
if
tb
is
None
and
error_tb
is
None
:
tb
=
sys
.
exc_info
()[
2
]
if
type
(
tb
)
is
not
type
(
''
)
and
(
error_tb
is
None
):
if
type
(
tb
)
is
not
str
and
(
error_tb
is
None
):
error_tb
=
pretty_tb
(
error_type
,
error_value
,
tb
)
elif
type
(
tb
)
is
type
(
''
)
and
not
error_tb
:
elif
type
(
tb
)
is
str
and
not
error_tb
:
error_tb
=
tb
if
hasattr
(
self
,
'_v_eek'
):
...
...
src/Products/Sessions/BrowserIdManager.py
View file @
b3fa9c1b
...
...
@@ -264,7 +264,7 @@ class BrowserIdManager(Item, Persistent, Implicit, RoleManager, Owned, Tabs):
o Enforce "valid" values.
"""
if
not
(
type
(
k
)
is
type
(
''
)
and
k
and
not
badidnamecharsin
(
k
)):
if
not
(
type
(
k
)
is
str
and
k
and
not
badidnamecharsin
(
k
)):
raise
BrowserIdManagerErr
(
'Bad id name string %s'
%
escape
(
repr
(
k
)))
self
.
browserid_name
=
k
...
...
@@ -288,7 +288,7 @@ class BrowserIdManager(Item, Persistent, Implicit, RoleManager, Owned, Tabs):
security
.
declareProtected
(
CHANGE_IDMGR_PERM
,
'setCookiePath'
)
def
setCookiePath
(
self
,
path
=
''
):
""" sets cookie 'path' element for id cookie """
if
not
(
type
(
path
)
is
type
(
''
)
and
not
badcookiecharsin
(
path
)):
if
not
(
type
(
path
)
is
str
and
not
badcookiecharsin
(
path
)):
raise
BrowserIdManagerErr
(
'Bad cookie path %s'
%
escape
(
repr
(
path
)))
self
.
cookie_path
=
path
...
...
@@ -315,7 +315,7 @@ class BrowserIdManager(Item, Persistent, Implicit, RoleManager, Owned, Tabs):
security
.
declareProtected
(
CHANGE_IDMGR_PERM
,
'setCookieDomain'
)
def
setCookieDomain
(
self
,
domain
):
""" sets cookie 'domain' element for id cookie """
if
type
(
domain
)
is
not
type
(
''
)
:
if
type
(
domain
)
is
not
str
:
raise
BrowserIdManagerErr
(
'Cookie domain must be string: %s'
%
escape
(
repr
(
domain
)))
...
...
src/Products/Sessions/SessionDataManager.py
View file @
b3fa9c1b
...
...
@@ -158,7 +158,7 @@ class SessionDataManager(Item, Implicit, Persistent, RoleManager, Owned, Tabs):
""" """
if not path:
self.obpath = None # undefined state
elif type(path) is
type('')
:
elif type(path) is
str
:
if bad_path_chars_in(path):
raise SessionDataManagerErr(
'
Container
path
contains
characters
invalid
in
a
Zope
'
...
...
src/ZPublisher/HTTPRequest.py
View file @
b3fa9c1b
...
...
@@ -222,7 +222,7 @@ class HTTPRequest(BaseRequest):
def
setVirtualRoot
(
self
,
path
,
hard
=
0
):
""" Treat the current publishing object as a VirtualRoot """
other
=
self
.
other
if
isinstance
(
path
,
str
)
or
isinstance
(
path
,
unicode
):
if
isinstance
(
path
,
basestring
):
path
=
path
.
split
(
'/'
)
self
.
_script
[:]
=
map
(
quote
,
filter
(
None
,
path
))
del
self
.
_steps
[:]
...
...
@@ -241,7 +241,7 @@ class HTTPRequest(BaseRequest):
def
physicalPathToVirtualPath
(
self
,
path
):
""" Remove the path to the VirtualRoot from a physical path """
if
type
(
path
)
is
type
(
''
):
if
isinstance
(
path
,
basestring
):
path
=
path
.
split
(
'/'
)
rpp
=
self
.
other
.
get
(
'VirtualRootPhysicalPath'
,
(
''
,))
i
=
0
...
...
src/ZServer/HTTPResponse.py
View file @
b3fa9c1b
...
...
@@ -163,7 +163,7 @@ class ZServerHTTPResponse(HTTPResponse):
"""
if
type
(
data
)
!=
type
(
''
)
:
if
type
(
data
)
is
not
str
:
raise
TypeError
(
'Value must be a string'
)
stdout
=
self
.
stdout
...
...
@@ -174,7 +174,7 @@ class ZServerHTTPResponse(HTTPResponse):
l
=
self
.
headers
.
get
(
'content-length'
,
None
)
if
l
is
not
None
:
try
:
if
type
(
l
)
is
type
(
''
)
:
l
=
int
(
l
)
if
type
(
l
)
is
str
:
l
=
int
(
l
)
if
l
>
128000
:
self
.
_tempfile
=
tempfile
.
TemporaryFile
()
self
.
_templock
=
thread
.
allocate_lock
()
...
...
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