Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.buildout
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
Yusei Tahara
slapos.buildout
Commits
2ad6ef0b
Commit
2ad6ef0b
authored
Aug 24, 2011
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Be nice for slapos.libnetworkcache.
Convert buildout emptiness to Nones.
parent
1b0265d9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
6 deletions
+12
-6
src/zc/buildout/networkcache.py
src/zc/buildout/networkcache.py
+12
-6
No files found.
src/zc/buildout/networkcache.py
View file @
2ad6ef0b
...
@@ -72,9 +72,12 @@ def download_network_cached(dir_url, cache_url, path, url, logger,
...
@@ -72,9 +72,12 @@ def download_network_cached(dir_url, cache_url, path, url, logger,
directory_key
=
get_directory_key
(
url
)
directory_key
=
get_directory_key
(
url
)
url
=
os
.
path
.
basename
(
url
)
url
=
os
.
path
.
basename
(
url
)
if
len
(
signature_certificate_list
)
==
0
:
# convert [] into None in order to call nc nicely
signature_certificate_list
=
None
try
:
try
:
nc
=
NetworkcacheClient
(
cache_url
,
dir_url
,
nc
=
NetworkcacheClient
(
cache_url
,
dir_url
,
signature_certificate_list
=
signature_certificate_list
)
signature_certificate_list
=
signature_certificate_list
)
except
TypeError
:
except
TypeError
:
logger
.
warning
(
'Incompatible version of networkcache, not using it.'
)
logger
.
warning
(
'Incompatible version of networkcache, not using it.'
)
return
False
return
False
...
@@ -119,12 +122,15 @@ def upload_network_cached(dir_url, cache_url, external_url, path, logger,
...
@@ -119,12 +122,15 @@ def upload_network_cached(dir_url, cache_url, external_url, path, logger,
urlmd5
=
hashlib
.
md5
(
external_url
).
hexdigest
())
urlmd5
=
hashlib
.
md5
(
external_url
).
hexdigest
())
f
=
open
(
path
,
'r'
)
f
=
open
(
path
,
'r'
)
if
not
signature_private_key_file
:
# convert '' into None in order to call nc nicely
signature_private_key_file
=
None
try
:
try
:
nc
=
NetworkcacheClient
(
cache_url
,
dir_url
,
nc
=
NetworkcacheClient
(
cache_url
,
dir_url
,
signature_private_key_file
=
signature_private_key_file
)
signature_private_key_file
=
signature_private_key_file
)
except
TypeError
:
except
TypeError
:
logger
.
warning
(
'Incompatible version of networkcache, not using it.'
)
logger
.
warning
(
'Incompatible version of networkcache, not using it.'
)
return
False
return
False
try
:
try
:
return
nc
.
upload
(
f
,
directory_key
,
**
kw
)
return
nc
.
upload
(
f
,
directory_key
,
**
kw
)
...
...
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