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
c244e98a
Commit
c244e98a
authored
Jul 12, 2011
by
Nikolay Kim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replace has_key with in operator
parent
05f73bda
Changes
19
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
89 additions
and
91 deletions
+89
-91
src/App/ApplicationManager.py
src/App/ApplicationManager.py
+1
-1
src/App/ProductContext.py
src/App/ProductContext.py
+2
-2
src/App/ProductRegistry.py
src/App/ProductRegistry.py
+2
-2
src/App/special_dtml.py
src/App/special_dtml.py
+1
-1
src/OFS/Image.py
src/OFS/Image.py
+1
-1
src/OFS/ObjectManager.py
src/OFS/ObjectManager.py
+2
-3
src/OFS/PropertyManager.py
src/OFS/PropertyManager.py
+2
-2
src/OFS/PropertySheets.py
src/OFS/PropertySheets.py
+4
-4
src/Products/Five/browser/decode.py
src/Products/Five/browser/decode.py
+2
-2
src/Products/PageTemplates/PageTemplateFile.py
src/Products/PageTemplates/PageTemplateFile.py
+1
-1
src/Products/PageTemplates/ZopePageTemplate.py
src/Products/PageTemplates/ZopePageTemplate.py
+1
-1
src/Products/SiteAccess/VirtualHostMonster.py
src/Products/SiteAccess/VirtualHostMonster.py
+1
-1
src/Shared/DC/Scripts/Bindings.py
src/Shared/DC/Scripts/Bindings.py
+5
-5
src/ZPublisher/BaseRequest.py
src/ZPublisher/BaseRequest.py
+3
-3
src/ZPublisher/BaseResponse.py
src/ZPublisher/BaseResponse.py
+1
-1
src/ZPublisher/HTTPRequest.py
src/ZPublisher/HTTPRequest.py
+50
-50
src/ZPublisher/HTTPResponse.py
src/ZPublisher/HTTPResponse.py
+6
-6
src/ZPublisher/Publish.py
src/ZPublisher/Publish.py
+1
-1
src/ZTUtils/Zope.py
src/ZTUtils/Zope.py
+3
-4
No files found.
src/App/ApplicationManager.py
View file @
c244e98a
...
@@ -353,7 +353,7 @@ class ApplicationManager(Folder,CacheManager):
...
@@ -353,7 +353,7 @@ class ApplicationManager(Folder,CacheManager):
return
'%.1fM'
%
(
s
/
1048576.0
)
return
'%.1fM'
%
(
s
/
1048576.0
)
return
'%.1fK'
%
(
s
/
1024.0
)
return
'%.1fK'
%
(
s
/
1024.0
)
if
os
.
environ
.
has_key
(
'ZMANAGED'
)
:
if
'ZMANAGED'
in
os
.
environ
:
manage_restartable
=
1
manage_restartable
=
1
@
requestmethod
(
'POST'
)
@
requestmethod
(
'POST'
)
def
manage_restart
(
self
,
URL1
,
REQUEST
=
None
):
def
manage_restart
(
self
,
URL1
,
REQUEST
=
None
):
...
...
src/App/ProductContext.py
View file @
c244e98a
...
@@ -151,7 +151,7 @@ class ProductContext:
...
@@ -151,7 +151,7 @@ class ProductContext:
else
:
else
:
name
=
method
.
__name__
name
=
method
.
__name__
aliased
=
0
aliased
=
0
if
n
ot
OM
.
__dict__
.
has_key
(
name
)
:
if
n
ame
not
in
OM
.
__dict__
:
setattr
(
OM
,
name
,
method
)
setattr
(
OM
,
name
,
method
)
setattr
(
OM
,
name
+
'__roles__'
,
pr
)
setattr
(
OM
,
name
+
'__roles__'
,
pr
)
if
aliased
:
if
aliased
:
...
@@ -213,7 +213,7 @@ class ProductContext:
...
@@ -213,7 +213,7 @@ class ProductContext:
name
,
method
=
method
name
,
method
=
method
else
:
else
:
name
=
os
.
path
.
split
(
method
.
__name__
)[
-
1
]
name
=
os
.
path
.
split
(
method
.
__name__
)[
-
1
]
if
n
ot
productObject
.
__dict__
.
has_key
(
name
)
:
if
n
ame
not
in
productObject
.
__dict__
:
m
[
name
]
=
method
m
[
name
]
=
method
m
[
name
+
'__roles__'
]
=
pr
m
[
name
+
'__roles__'
]
=
pr
...
...
src/App/ProductRegistry.py
View file @
c244e98a
...
@@ -32,7 +32,7 @@ class ProductRegistryMixin:
...
@@ -32,7 +32,7 @@ class ProductRegistryMixin:
r
=
[]
r
=
[]
pid
=
product
.
id
pid
=
product
.
id
for
mt
in
self
.
_getProductRegistryMetaTypes
():
for
mt
in
self
.
_getProductRegistryMetaTypes
():
if
mt
.
has_key
(
'product'
)
:
if
'product'
in
mt
:
if
mt
[
'product'
]
==
pid
and
(
if
mt
[
'product'
]
==
pid
and
(
meta_type
is
None
or
meta_type
==
mt
[
'name'
]):
meta_type
is
None
or
meta_type
==
mt
[
'name'
]):
continue
continue
...
@@ -52,7 +52,7 @@ class ProductRegistryMixin:
...
@@ -52,7 +52,7 @@ class ProductRegistryMixin:
for
mt
in
meta_types
:
for
mt
in
meta_types
:
if
mt
[
'name'
]
==
meta_type
:
if
mt
[
'name'
]
==
meta_type
:
if
not
mt
.
has_key
(
'product'
)
:
mt
[
'product'
]
=
pid
if
'product'
not
in
mt
:
mt
[
'product'
]
=
pid
if
mt
[
'product'
]
!=
pid
:
if
mt
[
'product'
]
!=
pid
:
raise
ValueError
,
(
raise
ValueError
,
(
'The type <em>%s</em> is already defined.'
%
meta_type
)
'The type <em>%s</em> is already defined.'
%
meta_type
)
...
...
src/App/special_dtml.py
View file @
c244e98a
...
@@ -44,7 +44,7 @@ class ClassicHTMLFile(DocumentTemplate.HTMLFile,MethodObject.Method,):
...
@@ -44,7 +44,7 @@ class ClassicHTMLFile(DocumentTemplate.HTMLFile,MethodObject.Method,):
elif
type
(
_prefix
)
is
not
type
(
''
):
elif
type
(
_prefix
)
is
not
type
(
''
):
_prefix
=
Common
.
package_home
(
_prefix
)
_prefix
=
Common
.
package_home
(
_prefix
)
args
=
(
self
,
os
.
path
.
join
(
_prefix
,
name
+
'.dtml'
))
args
=
(
self
,
os
.
path
.
join
(
_prefix
,
name
+
'.dtml'
))
if
not
kw
.
has_key
(
'__name__'
)
:
if
'__name__'
not
in
kw
:
kw
[
'__name__'
]
=
os
.
path
.
split
(
name
)[
-
1
]
kw
[
'__name__'
]
=
os
.
path
.
split
(
name
)[
-
1
]
apply
(
ClassicHTMLFile
.
inheritedAttribute
(
'__init__'
),
args
,
kw
)
apply
(
ClassicHTMLFile
.
inheritedAttribute
(
'__init__'
),
args
,
kw
)
...
...
src/OFS/Image.py
View file @
c244e98a
...
@@ -504,7 +504,7 @@ class File(Persistent, Implicit, PropertyManager,
...
@@ -504,7 +504,7 @@ class File(Persistent, Implicit, PropertyManager,
def
_get_content_type
(
self
,
file
,
body
,
id
,
content_type
=
None
):
def
_get_content_type
(
self
,
file
,
body
,
id
,
content_type
=
None
):
headers
=
getattr
(
file
,
'headers'
,
None
)
headers
=
getattr
(
file
,
'headers'
,
None
)
if
headers
and
headers
.
has_key
(
'content-type'
)
:
if
headers
and
'content-type'
in
headers
:
content_type
=
headers
[
'content-type'
]
content_type
=
headers
[
'content-type'
]
else
:
else
:
if
not
isinstance
(
body
,
str
):
body
=
body
.
data
if
not
isinstance
(
body
,
str
):
body
=
body
.
data
...
...
src/OFS/ObjectManager.py
View file @
c244e98a
...
@@ -273,7 +273,7 @@ class ObjectManager(CopyContainer,
...
@@ -273,7 +273,7 @@ class ObjectManager(CopyContainer,
else
:
else
:
all
=
self
.
all_meta_types
all
=
self
.
all_meta_types
for
meta_type
in
all
:
for
meta_type
in
all
:
if
meta_type
.
has_key
(
'permission'
)
:
if
'permission'
in
meta_type
:
if
sm
.
checkPermission
(
meta_type
[
'permission'
],
self
):
if
sm
.
checkPermission
(
meta_type
[
'permission'
],
self
):
meta_types
.
append
(
meta_type
)
meta_types
.
append
(
meta_type
)
else
:
else
:
...
@@ -476,7 +476,6 @@ class ObjectManager(CopyContainer,
...
@@ -476,7 +476,6 @@ class ObjectManager(CopyContainer,
seen
=
{}
seen
=
{}
vals
=
[]
vals
=
[]
relativePhysicalPath
=
()
relativePhysicalPath
=
()
have
=
seen
.
has_key
x
=
0
x
=
0
while
x
<
100
:
while
x
<
100
:
if
not
hasattr
(
obj
,
'_getOb'
):
break
if
not
hasattr
(
obj
,
'_getOb'
):
break
...
@@ -486,7 +485,7 @@ class ObjectManager(CopyContainer,
...
@@ -486,7 +485,7 @@ class ObjectManager(CopyContainer,
try
:
try
:
id
=
i
[
'id'
]
id
=
i
[
'id'
]
physicalPath
=
relativePhysicalPath
+
(
id
,)
physicalPath
=
relativePhysicalPath
+
(
id
,)
if
(
not
have
(
physicalPath
)
)
and
(
i
[
'meta_type'
]
in
t
):
if
(
physicalPath
not
in
seen
)
and
(
i
[
'meta_type'
]
in
t
):
vals
.
append
(
get
(
id
))
vals
.
append
(
get
(
id
))
seen
[
physicalPath
]
=
1
seen
[
physicalPath
]
=
1
except
:
pass
except
:
pass
...
...
src/OFS/PropertyManager.py
View file @
c244e98a
...
@@ -204,7 +204,7 @@ class PropertyManager(Base, ElementWithAttributes):
...
@@ -204,7 +204,7 @@ class PropertyManager(Base, ElementWithAttributes):
raise
BadRequest
,
'The property %s does not exist'
%
escape
(
id
)
raise
BadRequest
,
'The property %s does not exist'
%
escape
(
id
)
if
type
(
value
)
==
type
(
''
):
if
type
(
value
)
==
type
(
''
):
proptype
=
self
.
getPropertyType
(
id
)
or
'string'
proptype
=
self
.
getPropertyType
(
id
)
or
'string'
if
type_converters
.
has_key
(
proptype
)
:
if
proptype
in
type_converters
:
value
=
type_converters
[
proptype
](
value
)
value
=
type_converters
[
proptype
](
value
)
self
.
_setPropValue
(
id
,
value
)
self
.
_setPropValue
(
id
,
value
)
...
@@ -281,7 +281,7 @@ class PropertyManager(Base, ElementWithAttributes):
...
@@ -281,7 +281,7 @@ class PropertyManager(Base, ElementWithAttributes):
Sets a new property with the given id, type, and value.
Sets a new property with the given id, type, and value.
"""
"""
if
type
_converters
.
has_key
(
type
)
:
if
type
in
type_converters
:
value
=
type_converters
[
type
](
value
)
value
=
type_converters
[
type
](
value
)
self
.
_setProperty
(
id
.
strip
(),
value
,
type
)
self
.
_setProperty
(
id
.
strip
(),
value
,
type
)
if
REQUEST
is
not
None
:
if
REQUEST
is
not
None
:
...
...
src/OFS/PropertySheets.py
View file @
c244e98a
...
@@ -199,7 +199,7 @@ class PropertySheet(Traversable, Persistent, Implicit):
...
@@ -199,7 +199,7 @@ class PropertySheet(Traversable, Persistent, Implicit):
pself
=
self
.
p_self
()
pself
=
self
.
p_self
()
self
=
self
.
v_self
()
self
=
self
.
v_self
()
if
hasattr
(
aq_base
(
self
),
id
):
if
hasattr
(
aq_base
(
self
),
id
):
if
not
(
id
==
'title'
and
not
self
.
__dict__
.
has_key
(
id
)
):
if
not
(
id
==
'title'
and
not
id
in
self
.
__dict__
):
raise
BadRequest
,
(
raise
BadRequest
,
(
'Invalid property id, <em>%s</em>. It is in use.'
%
'Invalid property id, <em>%s</em>. It is in use.'
%
escape
(
id
))
escape
(
id
))
...
@@ -233,7 +233,7 @@ class PropertySheet(Traversable, Persistent, Implicit):
...
@@ -233,7 +233,7 @@ class PropertySheet(Traversable, Persistent, Implicit):
raise
BadRequest
,
'%s cannot be changed.'
%
escape
(
id
)
raise
BadRequest
,
'%s cannot be changed.'
%
escape
(
id
)
if
type
(
value
)
==
type
(
''
):
if
type
(
value
)
==
type
(
''
):
proptype
=
propinfo
.
get
(
'type'
,
'string'
)
proptype
=
propinfo
.
get
(
'type'
,
'string'
)
if
type_converters
.
has_key
(
proptype
)
:
if
proptype
in
type_converters
:
value
=
type_converters
[
proptype
](
value
)
value
=
type_converters
[
proptype
](
value
)
if
meta
is
not
None
:
if
meta
is
not
None
:
props
=
[]
props
=
[]
...
@@ -361,7 +361,7 @@ class PropertySheet(Traversable, Persistent, Implicit):
...
@@ -361,7 +361,7 @@ class PropertySheet(Traversable, Persistent, Implicit):
# property name and value for the requested property.
# property name and value for the requested property.
xml_id
=
self
.
xml_namespace
()
xml_id
=
self
.
xml_namespace
()
propdict
=
self
.
_propdict
()
propdict
=
self
.
_propdict
()
if
n
ot
propdict
.
has_key
(
name
)
:
if
n
ame
not
in
propdict
:
if
xml_id
:
if
xml_id
:
prop
=
'<n:%s xmlns:n="%s"/>
\
n
'
%
(
name
,
xml_id
)
prop
=
'<n:%s xmlns:n="%s"/>
\
n
'
%
(
name
,
xml_id
)
else
:
else
:
...
@@ -419,7 +419,7 @@ class PropertySheet(Traversable, Persistent, Implicit):
...
@@ -419,7 +419,7 @@ class PropertySheet(Traversable, Persistent, Implicit):
def
manage_addProperty
(
self
,
id
,
value
,
type
,
REQUEST
=
None
):
def
manage_addProperty
(
self
,
id
,
value
,
type
,
REQUEST
=
None
):
"""Add a new property via the web. Sets a new property with
"""Add a new property via the web. Sets a new property with
the given id, type, and value."""
the given id, type, and value."""
if
type
_converters
.
has_key
(
type
)
:
if
type
in
type_converters
:
value
=
type_converters
[
type
](
value
)
value
=
type_converters
[
type
](
value
)
self
.
_setProperty
(
id
,
value
,
type
)
self
.
_setProperty
(
id
,
value
,
type
)
if
REQUEST
is
not
None
:
if
REQUEST
is
not
None
:
...
...
src/Products/Five/browser/decode.py
View file @
c244e98a
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
encoding.
encoding.
"""
"""
from
zope.publisher.browser
import
isCGI_NAME
from
ZPublisher.HTTPRequest
import
isCGI_NAMEs
from
zope.i18n.interfaces
import
IUserPreferredCharsets
from
zope.i18n.interfaces
import
IUserPreferredCharsets
# taken and adapted from zope.publisher.browser.BrowserRequest
# taken and adapted from zope.publisher.browser.BrowserRequest
...
@@ -62,7 +62,7 @@ def processInputs(request, charsets=None):
...
@@ -62,7 +62,7 @@ def processInputs(request, charsets=None):
charsets
=
envadapter
.
getPreferredCharsets
()
or
[
'utf-8'
]
charsets
=
envadapter
.
getPreferredCharsets
()
or
[
'utf-8'
]
for
name
,
value
in
request
.
form
.
items
():
for
name
,
value
in
request
.
form
.
items
():
if
not
(
isCGI_NAME
(
name
)
or
name
.
startswith
(
'HTTP_'
)):
if
not
(
name
in
isCGI_NAMEs
or
name
.
startswith
(
'HTTP_'
)):
request
.
form
[
name
]
=
processInputValue
(
value
,
charsets
)
request
.
form
[
name
]
=
processInputValue
(
value
,
charsets
)
def
setPageEncoding
(
request
):
def
setPageEncoding
(
request
):
...
...
src/Products/PageTemplates/PageTemplateFile.py
View file @
c244e98a
...
@@ -109,7 +109,7 @@ class PageTemplateFile(SimpleItem, Script, PageTemplate, Traversable):
...
@@ -109,7 +109,7 @@ class PageTemplateFile(SimpleItem, Script, PageTemplate, Traversable):
def
_exec
(
self
,
bound_names
,
args
,
kw
):
def
_exec
(
self
,
bound_names
,
args
,
kw
):
"""Call a Page Template"""
"""Call a Page Template"""
self
.
_cook_check
()
self
.
_cook_check
()
if
not
kw
.
has_key
(
'args'
)
:
if
'args'
not
in
kw
:
kw
[
'args'
]
=
args
kw
[
'args'
]
=
args
bound_names
[
'options'
]
=
kw
bound_names
[
'options'
]
=
kw
...
...
src/Products/PageTemplates/ZopePageTemplate.py
View file @
c244e98a
...
@@ -303,7 +303,7 @@ class ZopePageTemplate(Script, PageTemplate, Historical, Cacheable,
...
@@ -303,7 +303,7 @@ class ZopePageTemplate(Script, PageTemplate, Historical, Cacheable,
def
_exec
(
self
,
bound_names
,
args
,
kw
):
def
_exec
(
self
,
bound_names
,
args
,
kw
):
"""Call a Page Template"""
"""Call a Page Template"""
if
not
kw
.
has_key
(
'args'
)
:
if
'args'
not
in
kw
:
kw
[
'args'
]
=
args
kw
[
'args'
]
=
args
bound_names
[
'options'
]
=
kw
bound_names
[
'options'
]
=
kw
...
...
src/Products/SiteAccess/VirtualHostMonster.py
View file @
c244e98a
...
@@ -97,7 +97,7 @@ class VirtualHostMonster(Persistent, Item, Implicit):
...
@@ -97,7 +97,7 @@ class VirtualHostMonster(Persistent, Item, Implicit):
else
:
else
:
host_map
=
fixed_map
host_map
=
fixed_map
hostname
,
port
=
(
host
.
split
(
':'
,
1
)
+
[
None
])[:
2
]
hostname
,
port
=
(
host
.
split
(
':'
,
1
)
+
[
None
])[:
2
]
if
not
host_map
.
has_key
(
hostname
)
:
if
hostname
not
in
host_map
:
host_map
[
hostname
]
=
{}
host_map
[
hostname
]
=
{}
host_map
[
hostname
][
port
]
=
pp
host_map
[
hostname
][
port
]
=
pp
except
'LineError'
,
msg
:
except
'LineError'
,
msg
:
...
...
src/Shared/DC/Scripts/Bindings.py
View file @
c244e98a
...
@@ -55,7 +55,7 @@ class NameAssignments:
...
@@ -55,7 +55,7 @@ class NameAssignments:
asgns
=
{}
asgns
=
{}
_isLegalName
=
self
.
_isLegalName
_isLegalName
=
self
.
_isLegalName
for
name
,
expr
in
self
.
_exprs
:
for
name
,
expr
in
self
.
_exprs
:
if
mapping
.
has_key
(
name
)
:
if
name
in
mapping
:
assigned_name
=
string
.
strip
(
mapping
[
name
])
assigned_name
=
string
.
strip
(
mapping
[
name
])
if
not
assigned_name
:
if
not
assigned_name
:
continue
continue
...
@@ -71,7 +71,7 @@ class NameAssignments:
...
@@ -71,7 +71,7 @@ class NameAssignments:
return
0
return
0
def
isNameAssigned
(
self
,
name
):
def
isNameAssigned
(
self
,
name
):
return
self
.
_asgns
.
has_key
(
name
)
return
name
in
self
.
_asgns
def
getAssignedName
(
self
,
name
,
default
=
_marker
):
def
getAssignedName
(
self
,
name
,
default
=
_marker
):
val
=
self
.
_asgns
.
get
(
name
,
default
)
val
=
self
.
_asgns
.
get
(
name
,
default
)
...
@@ -89,7 +89,7 @@ class NameAssignments:
...
@@ -89,7 +89,7 @@ class NameAssignments:
rval
=
[]
rval
=
[]
asgns
=
self
.
_asgns
asgns
=
self
.
_asgns
for
name
,
expr
in
self
.
_exprs
:
for
name
,
expr
in
self
.
_exprs
:
if
asgns
.
has_key
(
name
)
:
if
name
in
asgns
:
assigned_name
=
asgns
[
name
]
assigned_name
=
asgns
[
name
]
rval
.
append
(
assigned_name
)
rval
.
append
(
assigned_name
)
return
rval
return
rval
...
@@ -114,7 +114,7 @@ class NameAssignments:
...
@@ -114,7 +114,7 @@ class NameAssignments:
assigned_names
=
[]
assigned_names
=
[]
asgns
=
self
.
_asgns
asgns
=
self
.
_asgns
for
name
,
expr
in
self
.
_exprs
:
for
name
,
expr
in
self
.
_exprs
:
if
asgns
.
has_key
(
name
)
:
if
name
in
asgns
:
assigned_name
=
asgns
[
name
]
assigned_name
=
asgns
[
name
]
assigned_names
.
append
(
assigned_name
)
assigned_names
.
append
(
assigned_name
)
exprtext
.
append
(
'"%s":%s,'
%
(
assigned_name
,
expr
))
exprtext
.
append
(
'"%s":%s,'
%
(
assigned_name
,
expr
))
...
@@ -133,7 +133,7 @@ class NameAssignments:
...
@@ -133,7 +133,7 @@ class NameAssignments:
passedLastBoundArg
=
1
passedLastBoundArg
=
1
for
name
,
expr
in
self
.
_exprs
:
for
name
,
expr
in
self
.
_exprs
:
# Provide a value for the available exprs.
# Provide a value for the available exprs.
if
asgns
.
has_key
(
name
)
:
if
name
in
asgns
:
assigned_name
=
asgns
[
name
]
assigned_name
=
asgns
[
name
]
if
assigned_name
==
argName
:
if
assigned_name
==
argName
:
# The value for this argument will be filled in.
# The value for this argument will be filled in.
...
...
src/ZPublisher/BaseRequest.py
View file @
c244e98a
...
@@ -669,7 +669,7 @@ def old_validation(groups, request, auth,
...
@@ -669,7 +669,7 @@ def old_validation(groups, request, auth,
if
auth
:
name
,
password
=
auth
if
auth
:
name
,
password
=
auth
elif
roles
is
None
:
return
''
elif
roles
is
None
:
return
''
else
:
return
None
else
:
return
None
elif
request
.
environ
.
has_key
(
'REMOTE_USER'
)
:
elif
'REMOTE_USER'
in
request
.
environ
:
name
=
request
.
environ
[
'REMOTE_USER'
]
name
=
request
.
environ
[
'REMOTE_USER'
]
password
=
None
password
=
None
else
:
else
:
...
@@ -693,11 +693,11 @@ def old_validation(groups, request, auth,
...
@@ -693,11 +693,11 @@ def old_validation(groups, request, auth,
if
roles
is
UNSPECIFIED_ROLES
:
roles
=
keys
()
if
roles
is
UNSPECIFIED_ROLES
:
roles
=
keys
()
g
=
[]
g
=
[]
for
role
in
roles
:
for
role
in
roles
:
if
groups
.
has_key
(
role
)
:
g
.
append
(
groups
[
role
])
if
role
in
groups
:
g
.
append
(
groups
[
role
])
groups
=
g
groups
=
g
for
d
in
groups
:
for
d
in
groups
:
if
d
.
has_key
(
name
)
and
(
d
[
name
]
==
password
or
password
is
None
):
if
name
in
d
and
(
d
[
name
]
==
password
or
password
is
None
):
return
name
return
name
if
keys
is
None
:
if
keys
is
None
:
...
...
src/ZPublisher/BaseResponse.py
View file @
c244e98a
...
@@ -69,7 +69,7 @@ class BaseResponse:
...
@@ -69,7 +69,7 @@ class BaseResponse:
cookie in the Response object.
cookie in the Response object.
'''
'''
cookies
=
self
.
cookies
cookies
=
self
.
cookies
if
cookies
.
has_key
(
name
)
:
if
name
in
cookies
:
cookie
=
cookies
[
name
]
cookie
=
cookies
[
name
]
else
:
else
:
cookie
=
cookies
[
name
]
=
{}
cookie
=
cookies
[
name
]
=
{}
...
...
src/ZPublisher/HTTPRequest.py
View file @
c244e98a
This diff is collapsed.
Click to expand it.
src/ZPublisher/HTTPResponse.py
View file @
c244e98a
...
@@ -220,7 +220,7 @@ class HTTPResponse(BaseResponse):
...
@@ -220,7 +220,7 @@ class HTTPResponse(BaseResponse):
if
isinstance
(
status
,
str
):
if
isinstance
(
status
,
str
):
status
=
status
.
lower
()
status
=
status
.
lower
()
if
status
_codes
.
has_key
(
status
)
:
if
status
in
status_codes
:
status
=
status_codes
[
status
]
status
=
status_codes
[
status
]
else
:
else
:
status
=
500
status
=
500
...
@@ -228,7 +228,7 @@ class HTTPResponse(BaseResponse):
...
@@ -228,7 +228,7 @@ class HTTPResponse(BaseResponse):
self
.
status
=
status
self
.
status
=
status
if
reason
is
None
:
if
reason
is
None
:
if
status
_reasons
.
has_key
(
status
)
:
if
status
in
status_reasons
:
reason
=
status_reasons
[
status
]
reason
=
status_reasons
[
status
]
else
:
else
:
reason
=
'Unknown'
reason
=
'Unknown'
...
@@ -252,7 +252,7 @@ class HTTPResponse(BaseResponse):
...
@@ -252,7 +252,7 @@ class HTTPResponse(BaseResponse):
value
=
str
(
value
)
value
=
str
(
value
)
cookies
=
self
.
cookies
cookies
=
self
.
cookies
if
cookies
.
has_key
(
name
)
:
if
name
in
cookies
:
cookie
=
cookies
[
name
]
cookie
=
cookies
[
name
]
else
:
else
:
cookie
=
cookies
[
name
]
=
{}
cookie
=
cookies
[
name
]
=
{}
...
@@ -273,11 +273,11 @@ class HTTPResponse(BaseResponse):
...
@@ -273,11 +273,11 @@ class HTTPResponse(BaseResponse):
value
=
str
(
value
)
value
=
str
(
value
)
cookies
=
self
.
cookies
cookies
=
self
.
cookies
if
cookies
.
has_key
(
name
)
:
if
name
in
cookies
:
cookie
=
cookies
[
name
]
cookie
=
cookies
[
name
]
else
:
else
:
cookie
=
cookies
[
name
]
=
{}
cookie
=
cookies
[
name
]
=
{}
if
cookie
.
has_key
(
'value'
)
:
if
'value'
in
cookie
:
cookie
[
'value'
]
=
'%s:%s'
%
(
cookie
[
'value'
],
value
)
cookie
[
'value'
]
=
'%s:%s'
%
(
cookie
[
'value'
],
value
)
else
:
else
:
cookie
[
'value'
]
=
value
cookie
[
'value'
]
=
value
...
@@ -351,7 +351,7 @@ class HTTPResponse(BaseResponse):
...
@@ -351,7 +351,7 @@ class HTTPResponse(BaseResponse):
name
=
name
.
lower
()
name
=
name
.
lower
()
headers
=
self
.
headers
headers
=
self
.
headers
if
headers
.
has_key
(
name
)
:
if
name
in
headers
:
h
=
headers
[
name
]
h
=
headers
[
name
]
h
=
"%s%s%s"
%
(
h
,
delimiter
,
value
)
h
=
"%s%s%s"
%
(
h
,
delimiter
,
value
)
else
:
else
:
...
...
src/ZPublisher/Publish.py
View file @
c244e98a
...
@@ -286,7 +286,7 @@ def get_module_info(module_name, modules={},
...
@@ -286,7 +286,7 @@ def get_module_info(module_name, modules={},
release
=
_l
.
release
,
release
=
_l
.
release
,
):
):
if
module
s
.
has_key
(
module_name
)
:
return
modules
[
module_name
]
if
module
_name
in
modules
:
return
modules
[
module_name
]
if
module_name
[
-
4
:]
==
'.cgi'
:
module_name
=
module_name
[:
-
4
]
if
module_name
[
-
4
:]
==
'.cgi'
:
module_name
=
module_name
[:
-
4
]
...
...
src/ZTUtils/Zope.py
View file @
c244e98a
...
@@ -297,18 +297,17 @@ def url_query(request, req_name="URL", omit=None):
...
@@ -297,18 +297,17 @@ def url_query(request, req_name="URL", omit=None):
omits
=
{}
omits
=
{}
for
name
in
omit
:
for
name
in
omit
:
omits
[
name
]
=
None
omits
[
name
]
=
None
omitted
=
omits
.
has_key
unq
=
urllib
.
unquote
unq
=
urllib
.
unquote
for
i
in
range
(
len
(
qsparts
)):
for
i
in
range
(
len
(
qsparts
)):
name
=
unq
(
qsparts
[
i
].
split
(
'='
,
1
)[
0
])
name
=
unq
(
qsparts
[
i
].
split
(
'='
,
1
)[
0
])
if
omitted
(
name
)
:
if
name
in
omits
:
qsparts
[
i
]
=
''
qsparts
[
i
]
=
''
name
=
name
.
split
(
':'
,
1
)[
0
]
name
=
name
.
split
(
':'
,
1
)[
0
]
if
omitted
(
name
)
:
if
name
in
omits
:
qsparts
[
i
]
=
''
qsparts
[
i
]
=
''
name
=
name
.
split
(
'.'
,
1
)[
0
]
name
=
name
.
split
(
'.'
,
1
)[
0
]
if
omitted
(
name
)
:
if
name
in
omits
:
qsparts
[
i
]
=
''
qsparts
[
i
]
=
''
qs
=
'&'
.
join
(
filter
(
None
,
qsparts
))
qs
=
'&'
.
join
(
filter
(
None
,
qsparts
))
...
...
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