Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
a9a27ccc
authored
Jul 09, 2014
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: dummy error handling for store
parent
2314ab88
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
0 deletions
+16
-0
circle/dashboard/store_api.py
+16
-0
No files found.
circle/dashboard/store_api.py
View file @
a9a27ccc
...
@@ -9,11 +9,16 @@ from sizefield.utils import filesizeformat
...
@@ -9,11 +9,16 @@ from sizefield.utils import filesizeformat
settings
=
django
.
conf
.
settings
.
STORE_SETTINGS
settings
=
django
.
conf
.
settings
.
STORE_SETTINGS
class
Mock
(
object
):
pass
def
get_host
():
def
get_host
():
return
settings
[
'store_url'
]
return
settings
[
'store_url'
]
def
post_request
(
url
,
payload
):
def
post_request
(
url
,
payload
):
try
:
headers
=
{
'content-type'
:
'application/json'
}
headers
=
{
'content-type'
:
'application/json'
}
if
settings
[
'ssl_auth'
]
==
'True'
and
settings
[
'basic_auth'
]
==
'True'
:
if
settings
[
'ssl_auth'
]
==
'True'
and
settings
[
'basic_auth'
]
==
'True'
:
r
=
requests
.
post
(
url
,
data
=
payload
,
headers
=
headers
,
r
=
requests
.
post
(
url
,
data
=
payload
,
headers
=
headers
,
...
@@ -40,9 +45,15 @@ def post_request(url, payload):
...
@@ -40,9 +45,15 @@ def post_request(url, payload):
verify
=
settings
[
'verify_ssl'
]
==
'True'
verify
=
settings
[
'verify_ssl'
]
==
'True'
)
)
return
r
return
r
except
:
dummy
=
Mock
()
setattr
(
dummy
,
"status_code"
,
200
)
setattr
(
dummy
,
"content"
,
"[]"
)
return
dummy
def
get_request
(
url
):
def
get_request
(
url
):
try
:
headers
=
{
'content-type'
:
'application/json'
}
headers
=
{
'content-type'
:
'application/json'
}
if
settings
[
'ssl_auth'
]
==
'True'
and
settings
[
'basic_auth'
]
==
'True'
:
if
settings
[
'ssl_auth'
]
==
'True'
and
settings
[
'basic_auth'
]
==
'True'
:
r
=
requests
.
get
(
r
=
requests
.
get
(
...
@@ -76,6 +87,11 @@ def get_request(url):
...
@@ -76,6 +87,11 @@ def get_request(url):
verify
=
settings
[
'verify_ssl'
]
==
'True'
verify
=
settings
[
'verify_ssl'
]
==
'True'
)
)
return
r
return
r
except
:
dummy
=
Mock
()
setattr
(
dummy
,
"status_code"
,
200
)
setattr
(
dummy
,
"content"
,
"[]"
)
return
dummy
def
listfolder
(
neptun
,
path
):
def
listfolder
(
neptun
,
path
):
...
...
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