Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
4eff9f7f
Kaydet (Commit)
4eff9f7f
authored
Eyl 04, 2009
tarafından
Georg Brandl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Remove pseudo-end markers from http.cookies.
üst
85477afc
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
22 deletions
+1
-22
cookies.py
Lib/http/cookies.py
+1
-22
No files found.
Lib/http/cookies.py
Dosyayı görüntüle @
4eff9f7f
...
@@ -236,7 +236,6 @@ def _quote(str, LegalChars=_LegalChars):
...
@@ -236,7 +236,6 @@ def _quote(str, LegalChars=_LegalChars):
return
str
return
str
else
:
else
:
return
'"'
+
_nulljoin
(
map
(
_Translator
.
get
,
str
,
str
)
)
+
'"'
return
'"'
+
_nulljoin
(
map
(
_Translator
.
get
,
str
,
str
)
)
+
'"'
# end _quote
_OctalPatt
=
re
.
compile
(
r"\\[0-3][0-7][0-7]"
)
_OctalPatt
=
re
.
compile
(
r"\\[0-3][0-7][0-7]"
)
...
@@ -282,7 +281,6 @@ def _unquote(str):
...
@@ -282,7 +281,6 @@ def _unquote(str):
res
.
append
(
chr
(
int
(
str
[
j
+
1
:
j
+
4
],
8
)
)
)
res
.
append
(
chr
(
int
(
str
[
j
+
1
:
j
+
4
],
8
)
)
)
i
=
j
+
4
i
=
j
+
4
return
_nulljoin
(
res
)
return
_nulljoin
(
res
)
# end _unquote
# The _getdate() routine is used to set the expiration time in
# The _getdate() routine is used to set the expiration time in
# the cookie's HTTP header. By default, _getdate() returns the
# the cookie's HTTP header. By default, _getdate() returns the
...
@@ -348,18 +346,15 @@ class Morsel(dict):
...
@@ -348,18 +346,15 @@ class Morsel(dict):
# Set default attributes
# Set default attributes
for
K
in
self
.
_reserved
:
for
K
in
self
.
_reserved
:
dict
.
__setitem__
(
self
,
K
,
""
)
dict
.
__setitem__
(
self
,
K
,
""
)
# end __init__
def
__setitem__
(
self
,
K
,
V
):
def
__setitem__
(
self
,
K
,
V
):
K
=
K
.
lower
()
K
=
K
.
lower
()
if
not
K
in
self
.
_reserved
:
if
not
K
in
self
.
_reserved
:
raise
CookieError
(
"Invalid Attribute
%
s"
%
K
)
raise
CookieError
(
"Invalid Attribute
%
s"
%
K
)
dict
.
__setitem__
(
self
,
K
,
V
)
dict
.
__setitem__
(
self
,
K
,
V
)
# end __setitem__
def
isReservedKey
(
self
,
K
):
def
isReservedKey
(
self
,
K
):
return
K
.
lower
()
in
self
.
_reserved
return
K
.
lower
()
in
self
.
_reserved
# end isReservedKey
def
set
(
self
,
key
,
val
,
coded_val
,
LegalChars
=
_LegalChars
):
def
set
(
self
,
key
,
val
,
coded_val
,
LegalChars
=
_LegalChars
):
# First we verify that the key isn't a reserved word
# First we verify that the key isn't a reserved word
...
@@ -373,7 +368,6 @@ class Morsel(dict):
...
@@ -373,7 +368,6 @@ class Morsel(dict):
self
.
key
=
key
self
.
key
=
key
self
.
value
=
val
self
.
value
=
val
self
.
coded_value
=
coded_val
self
.
coded_value
=
coded_val
# end set
def
output
(
self
,
attrs
=
None
,
header
=
"Set-Cookie:"
):
def
output
(
self
,
attrs
=
None
,
header
=
"Set-Cookie:"
):
return
"
%
s
%
s"
%
(
header
,
self
.
OutputString
(
attrs
)
)
return
"
%
s
%
s"
%
(
header
,
self
.
OutputString
(
attrs
)
)
...
@@ -393,7 +387,6 @@ class Morsel(dict):
...
@@ -393,7 +387,6 @@ class Morsel(dict):
// end hiding -->
// end hiding -->
</script>
</script>
"""
%
(
self
.
OutputString
(
attrs
)
.
replace
(
'"'
,
r'\"'
))
"""
%
(
self
.
OutputString
(
attrs
)
.
replace
(
'"'
,
r'\"'
))
# end js_output()
def
OutputString
(
self
,
attrs
=
None
):
def
OutputString
(
self
,
attrs
=
None
):
# Build up our result
# Build up our result
...
@@ -424,9 +417,6 @@ class Morsel(dict):
...
@@ -424,9 +417,6 @@ class Morsel(dict):
# Return the result
# Return the result
return
_semispacejoin
(
result
)
return
_semispacejoin
(
result
)
# end OutputString
# end Morsel class
#
#
...
@@ -470,7 +460,6 @@ class BaseCookie(dict):
...
@@ -470,7 +460,6 @@ class BaseCookie(dict):
Override this function to modify the behavior of cookies.
Override this function to modify the behavior of cookies.
"""
"""
return
val
,
val
return
val
,
val
# end value_encode
def
value_encode
(
self
,
val
):
def
value_encode
(
self
,
val
):
"""real_value, coded_value = value_encode(VALUE)
"""real_value, coded_value = value_encode(VALUE)
...
@@ -480,24 +469,20 @@ class BaseCookie(dict):
...
@@ -480,24 +469,20 @@ class BaseCookie(dict):
"""
"""
strval
=
str
(
val
)
strval
=
str
(
val
)
return
strval
,
strval
return
strval
,
strval
# end value_encode
def
__init__
(
self
,
input
=
None
):
def
__init__
(
self
,
input
=
None
):
if
input
:
self
.
load
(
input
)
if
input
:
self
.
load
(
input
)
# end __init__
def
__set
(
self
,
key
,
real_value
,
coded_value
):
def
__set
(
self
,
key
,
real_value
,
coded_value
):
"""Private method for setting a cookie's value"""
"""Private method for setting a cookie's value"""
M
=
self
.
get
(
key
,
Morsel
())
M
=
self
.
get
(
key
,
Morsel
())
M
.
set
(
key
,
real_value
,
coded_value
)
M
.
set
(
key
,
real_value
,
coded_value
)
dict
.
__setitem__
(
self
,
key
,
M
)
dict
.
__setitem__
(
self
,
key
,
M
)
# end __set
def
__setitem__
(
self
,
key
,
value
):
def
__setitem__
(
self
,
key
,
value
):
"""Dictionary style assignment."""
"""Dictionary style assignment."""
rval
,
cval
=
self
.
value_encode
(
value
)
rval
,
cval
=
self
.
value_encode
(
value
)
self
.
__set
(
key
,
rval
,
cval
)
self
.
__set
(
key
,
rval
,
cval
)
# end __setitem__
def
output
(
self
,
attrs
=
None
,
header
=
"Set-Cookie:"
,
sep
=
"
\015\012
"
):
def
output
(
self
,
attrs
=
None
,
header
=
"Set-Cookie:"
,
sep
=
"
\015\012
"
):
"""Return a string suitable for HTTP."""
"""Return a string suitable for HTTP."""
...
@@ -506,7 +491,6 @@ class BaseCookie(dict):
...
@@ -506,7 +491,6 @@ class BaseCookie(dict):
for
K
,
V
in
items
:
for
K
,
V
in
items
:
result
.
append
(
V
.
output
(
attrs
,
header
)
)
result
.
append
(
V
.
output
(
attrs
,
header
)
)
return
sep
.
join
(
result
)
return
sep
.
join
(
result
)
# end output
__str__
=
output
__str__
=
output
...
@@ -524,7 +508,6 @@ class BaseCookie(dict):
...
@@ -524,7 +508,6 @@ class BaseCookie(dict):
for
K
,
V
in
items
:
for
K
,
V
in
items
:
result
.
append
(
V
.
js_output
(
attrs
)
)
result
.
append
(
V
.
js_output
(
attrs
)
)
return
_nulljoin
(
result
)
return
_nulljoin
(
result
)
# end js_output
def
load
(
self
,
rawdata
):
def
load
(
self
,
rawdata
):
"""Load cookies from a string (presumably HTTP_COOKIE) or
"""Load cookies from a string (presumably HTTP_COOKIE) or
...
@@ -537,7 +520,6 @@ class BaseCookie(dict):
...
@@ -537,7 +520,6 @@ class BaseCookie(dict):
else
:
else
:
self
.
update
(
rawdata
)
self
.
update
(
rawdata
)
return
return
# end load()
def
__ParseString
(
self
,
str
,
patt
=
_CookiePattern
):
def
__ParseString
(
self
,
str
,
patt
=
_CookiePattern
):
i
=
0
# Our starting point
i
=
0
# Our starting point
...
@@ -566,8 +548,7 @@ class BaseCookie(dict):
...
@@ -566,8 +548,7 @@ class BaseCookie(dict):
rval
,
cval
=
self
.
value_decode
(
V
)
rval
,
cval
=
self
.
value_decode
(
V
)
self
.
__set
(
K
,
rval
,
cval
)
self
.
__set
(
K
,
rval
,
cval
)
M
=
self
[
K
]
M
=
self
[
K
]
# end __ParseString
# end BaseCookie class
class
SimpleCookie
(
BaseCookie
):
class
SimpleCookie
(
BaseCookie
):
"""SimpleCookie
"""SimpleCookie
...
@@ -581,9 +562,7 @@ class SimpleCookie(BaseCookie):
...
@@ -581,9 +562,7 @@ class SimpleCookie(BaseCookie):
def
value_encode
(
self
,
val
):
def
value_encode
(
self
,
val
):
strval
=
str
(
val
)
strval
=
str
(
val
)
return
strval
,
_quote
(
strval
)
return
strval
,
_quote
(
strval
)
# end SimpleCookie
#
###########################################################
###########################################################
def
_test
():
def
_test
():
...
...
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