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
d6f8446b
Commit
d6f8446b
authored
Jul 21, 2002
by
Martijn Pieters
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace very funky instance checks with isinstance, which is more readable
and faster.
parent
c8249705
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
6 deletions
+5
-6
lib/python/ZPublisher/HTTPRequest.py
lib/python/ZPublisher/HTTPRequest.py
+5
-6
No files found.
lib/python/ZPublisher/HTTPRequest.py
View file @
d6f8446b
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
#
#
##############################################################################
##############################################################################
__version__
=
'$Revision: 1.7
0
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.7
1
$'
[
11
:
-
2
]
import
re
,
sys
,
os
,
urllib
,
time
,
random
,
cgi
,
codecs
import
re
,
sys
,
os
,
urllib
,
time
,
random
,
cgi
,
codecs
from
BaseRequest
import
BaseRequest
from
BaseRequest
import
BaseRequest
...
@@ -589,7 +589,7 @@ class HTTPRequest(BaseRequest):
...
@@ -589,7 +589,7 @@ class HTTPRequest(BaseRequest):
form
[
keys
]
=
values
form
[
keys
]
=
values
else
:
else
:
#The form has the key
#The form has the key
if
getattr
(
values
,
'__class__'
,
0
)
is
record
:
if
isinstance
(
values
,
record
)
:
# if the key is mapped to a record, get the
# if the key is mapped to a record, get the
# record
# record
r
=
form
[
keys
]
r
=
form
[
keys
]
...
@@ -606,7 +606,7 @@ class HTTPRequest(BaseRequest):
...
@@ -606,7 +606,7 @@ class HTTPRequest(BaseRequest):
l
=
form
[
keys
]
l
=
form
[
keys
]
for
x
in
values
:
for
x
in
values
:
# for each x in the list
# for each x in the list
if
getattr
(
x
,
'__class__'
,
0
)
is
record
:
if
isinstance
(
x
,
record
)
:
# if the x is a record
# if the x is a record
for
k
,
v
in
x
.
__dict__
.
items
():
for
k
,
v
in
x
.
__dict__
.
items
():
...
@@ -650,8 +650,7 @@ class HTTPRequest(BaseRequest):
...
@@ -650,8 +650,7 @@ class HTTPRequest(BaseRequest):
if
form
.
has_key
(
k
):
if
form
.
has_key
(
k
):
# If the form has the split key get its value
# If the form has the split key get its value
item
=
form
[
k
]
item
=
form
[
k
]
if
(
hasattr
(
item
,
'__class__'
)
and
if
isinstance
(
item
,
record
):
item
.
__class__
is
record
):
# if the value is mapped to a record, check if it
# if the value is mapped to a record, check if it
# has the attribute, if it has it, convert it to
# has the attribute, if it has it, convert it to
# a tuple and set it
# a tuple and set it
...
@@ -1005,7 +1004,7 @@ def str_field(v):
...
@@ -1005,7 +1004,7 @@ def str_field(v):
if
type
(
v
)
is
ListType
:
if
type
(
v
)
is
ListType
:
return
map
(
str_field
,
v
)
return
map
(
str_field
,
v
)
if
hasattr
(
v
,
'__class__'
)
and
v
.
__class__
is
FieldStorage
:
if
isinstance
(
v
,
FieldStorage
)
:
v
=
v
.
value
v
=
v
.
value
elif
type
(
v
)
is
not
StringType
:
elif
type
(
v
)
is
not
StringType
:
if
hasattr
(
v
,
'file'
)
and
v
.
file
:
v
=
v
.
file
if
hasattr
(
v
,
'file'
)
and
v
.
file
:
v
=
v
.
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