Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZODB
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
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
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
ZODB
Commits
78619a38
Commit
78619a38
authored
Mar 02, 2013
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Whack dem moles.
parent
257fed3f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
5 deletions
+19
-5
src/ZODB/_compat.py
src/ZODB/_compat.py
+10
-0
src/ZODB/blob.py
src/ZODB/blob.py
+5
-2
src/ZODB/utils.py
src/ZODB/utils.py
+4
-3
No files found.
src/ZODB/_compat.py
View file @
78619a38
...
...
@@ -80,3 +80,13 @@ except NameError:
# Py3
long
=
int
try
:
TEXT
=
unicode
except
NameError
:
#pragma NO COVER Py3k
TEXT
=
str
def
ascii_bytes
(
x
):
if
isinstance
(
x
,
TEXT
):
x
=
x
.
encode
(
'ascii'
)
return
x
src/ZODB/blob.py
View file @
78619a38
...
...
@@ -31,7 +31,10 @@ import ZODB.interfaces
from
ZODB.interfaces
import
BlobError
from
ZODB
import
utils
from
ZODB.POSException
import
POSKeyError
from
ZODB._compat
import
BytesIO
,
Unpickler
,
decodebytes
from
ZODB._compat
import
BytesIO
from
ZODB._compat
import
Unpickler
from
ZODB._compat
import
decodebytes
from
ZODB._compat
import
ascii_bytes
if
sys
.
version_info
[
0
]
>=
3
:
...
...
@@ -557,7 +560,7 @@ class BushyLayout(object):
def
path_to_oid
(
self
,
path
):
if
self
.
blob_path_pattern
.
match
(
path
)
is
None
:
raise
ValueError
(
"Not a valid OID path: `%s`"
%
path
)
path
=
[
bytes
(
x
,
'ascii'
)
for
x
in
path
.
split
(
os
.
path
.
sep
)]
path
=
[
ascii_bytes
(
x
)
for
x
in
path
.
split
(
os
.
path
.
sep
)]
# Each path segment stores a byte in hex representation. Turn it into
# an int and then get the character for our byte string.
oid
=
b''
.
join
(
binascii
.
unhexlify
(
byte
[
2
:])
for
byte
in
path
)
...
...
src/ZODB/utils.py
View file @
78619a38
...
...
@@ -22,7 +22,9 @@ from tempfile import mkstemp
from
persistent.TimeStamp
import
TimeStamp
from
ZODB._compat
import
Unpickler
,
BytesIO
from
ZODB._compat
import
Unpickler
from
ZODB._compat
import
BytesIO
from
ZODB._compat
import
ascii_bytes
__all__
=
[
'z64'
,
...
...
@@ -164,8 +166,7 @@ def oid_repr(oid):
return
repr
(
oid
)
def
repr_to_oid
(
repr
):
if
not
isinstance
(
repr
,
bytes
):
repr
=
bytes
(
repr
,
'ascii'
)
repr
=
ascii_bytes
(
repr
)
if
repr
.
startswith
(
b"0x"
):
repr
=
repr
[
2
:]
as_bin
=
unhexlify
(
repr
)
...
...
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