Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.libnetworkcache
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
Ophélie Gagnard
slapos.libnetworkcache
Commits
4387e4e0
Commit
4387e4e0
authored
Mar 20, 2014
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Shorten traceback of ignored exceptions
parent
73e8af9e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
2 deletions
+13
-2
slapos/libnetworkcache.py
slapos/libnetworkcache.py
+12
-1
slapos/libnetworkcachetests.py
slapos/libnetworkcachetests.py
+1
-1
No files found.
slapos/libnetworkcache.py
View file @
4387e4e0
...
@@ -41,6 +41,16 @@ logger = logging.getLogger('networkcache')
...
@@ -41,6 +41,16 @@ logger = logging.getLogger('networkcache')
logger
.
setLevel
(
logging
.
INFO
)
logger
.
setLevel
(
logging
.
INFO
)
class
short_exc_info
(
tuple
):
def
__str__
(
self
):
t
,
v
,
tb
=
self
filename
,
lineno
,
name
,
line
=
traceback
.
extract_tb
(
tb
,
1
)[
0
]
l
=
[
'%s:%s
\
n
'
%
(
filename
,
lineno
)]
l
+=
traceback
.
format_exception_only
(
t
,
v
)
return
''
.
join
(
l
).
rstrip
()
class
NetworkcacheClient
(
object
):
class
NetworkcacheClient
(
object
):
'''
'''
NetworkcacheClient is a wrapper for httplib.
NetworkcacheClient is a wrapper for httplib.
...
@@ -108,7 +118,8 @@ class NetworkcacheClient(object):
...
@@ -108,7 +118,8 @@ class NetworkcacheClient(object):
if
isinstance
(
v
,
NetworkcacheException
):
if
isinstance
(
v
,
NetworkcacheException
):
logger
.
info
(
*
v
.
args
)
logger
.
info
(
*
v
.
args
)
else
:
else
:
logger
.
info
(
"ignored unhandled exception"
,
exc_info
=
(
t
,
v
,
tb
))
logger
.
info
(
"ignored unhandled exception at %s"
,
short_exc_info
((
t
,
v
,
tb
)))
return
True
return
True
def
_request
(
self
,
where
,
name
=
None
,
data
=
None
,
headers
=
None
):
def
_request
(
self
,
where
,
name
=
None
,
data
=
None
,
headers
=
None
):
...
...
slapos/libnetworkcachetests.py
View file @
4387e4e0
...
@@ -194,7 +194,7 @@ class OnlineMixin:
...
@@ -194,7 +194,7 @@ class OnlineMixin:
del
self
.
handler
del
self
.
handler
def
assertRaised
(
self
,
exc_type
):
def
assertRaised
(
self
,
exc_type
):
self
.
assert
Equal
(
exc_type
,
self
.
handler
.
buffer
.
pop
(
0
).
exc_info
[
0
])
self
.
assert
Is
(
exc_type
,
self
.
handler
.
buffer
.
pop
(
0
).
args
[
0
]
[
0
])
def
assertLog
(
self
,
msg
=
None
):
def
assertLog
(
self
,
msg
=
None
):
try
:
try
:
...
...
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