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
Labels
Merge Requests
138
Merge Requests
138
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
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
0f138b27
Commit
0f138b27
authored
Mar 07, 2024
by
Kazuhiko Shiozaki
Committed by
Arnaud Fontaine
Jul 04, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
patch: update memcache_client patch based on python-memcached-1.58.
parent
0efbc52e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
21 deletions
+17
-21
product/ERP5Type/patches/memcache_client.py
product/ERP5Type/patches/memcache_client.py
+17
-21
No files found.
product/ERP5Type/patches/memcache_client.py
View file @
0f138b27
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
# Code based on python-memcached-1.5
3
# Code based on python-memcached-1.5
8
try
:
try
:
from
memcache
import
_Host
,
Client
,
_Error
from
memcache
import
_Host
,
Client
,
_Error
except
ImportError
:
except
ImportError
:
...
@@ -15,9 +15,11 @@ else:
...
@@ -15,9 +15,11 @@ else:
pass
pass
Client
.
MemcachedConnectionError
=
_ConnectionDeadError
Client
.
MemcachedConnectionError
=
_ConnectionDeadError
import
six
import
socket
import
socket
def
_get
(
self
,
cmd
,
key
):
def
_get
(
self
,
cmd
,
key
):
if
getattr
(
self
,
'do_check_key'
,
True
):
key
=
self
.
_encode_key
(
key
)
if
self
.
do_check_key
:
self
.
check_key
(
key
)
self
.
check_key
(
key
)
server
,
key
=
self
.
_get_server
(
key
)
server
,
key
=
self
.
_get_server
(
key
)
if
not
server
:
if
not
server
:
...
@@ -29,25 +31,22 @@ else:
...
@@ -29,25 +31,22 @@ else:
self
.
_statlog
(
cmd
)
self
.
_statlog
(
cmd
)
try
:
try
:
server
.
send_cmd
(
"%s %s"
%
(
cmd
,
key
))
cmd_bytes
=
cmd
.
encode
(
'utf-8'
)
if
six
.
PY3
else
cmd
fullcmd
=
b''
.
join
((
cmd_bytes
,
b' '
,
key
))
server
.
send_cmd
(
fullcmd
)
rkey
=
flags
=
rlen
=
cas_id
=
None
rkey
=
flags
=
rlen
=
cas_id
=
None
if
cmd
==
'gets'
:
if
cmd
==
'gets'
:
try
:
rkey
,
flags
,
rlen
,
cas_id
,
=
self
.
_expect_cas_value
(
rkey
,
flags
,
rlen
,
cas_id
,
=
self
.
_expect_cas_value
(
server
,
server
,
raise_exception
=
True
raise_exception
=
True
)
)
except
TypeError
:
# BBB
rkey
,
flags
,
rlen
,
cas_id
,
=
self
.
_expect_cas_value
(
server
)
if
rkey
and
self
.
cache_cas
:
if
rkey
and
self
.
cache_cas
:
self
.
cas_ids
[
rkey
]
=
cas_id
self
.
cas_ids
[
rkey
]
=
cas_id
else
:
else
:
try
:
rkey
,
flags
,
rlen
,
=
self
.
_expectvalue
(
rkey
,
flags
,
rlen
,
=
self
.
_expectvalue
(
server
,
server
,
raise_exception
=
True
raise_exception
=
True
)
)
except
TypeError
:
# BBB
rkey
,
flags
,
rlen
,
=
self
.
_expectvalue
(
server
)
if
not
rkey
:
if
not
rkey
:
# (patch)
# (patch)
# return None
# return None
...
@@ -55,13 +54,10 @@ else:
...
@@ -55,13 +54,10 @@ else:
try
:
try
:
value
=
self
.
_recv_value
(
server
,
flags
,
rlen
)
value
=
self
.
_recv_value
(
server
,
flags
,
rlen
)
finally
:
finally
:
try
:
server
.
expect
(
b"END"
,
raise_exception
=
True
)
server
.
expect
(
"END"
,
raise_exception
=
True
)
except
TypeError
:
# BBB
server
.
expect
(
"END"
)
except
(
_Error
,
socket
.
error
)
as
msg
:
except
(
_Error
,
socket
.
error
)
as
msg
:
if
isinstance
(
msg
,
tuple
):
msg
=
msg
[
1
]
if
isinstance
(
msg
,
tuple
):
msg
=
msg
[
1
]
server
.
mark_dead
(
msg
)
server
.
mark_dead
(
msg
)
# (patch)
# (patch)
# return None
# return None
...
...
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