Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
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
Thomas Gambier
slapos.core
Commits
82bad6e9
Commit
82bad6e9
authored
May 24, 2012
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow flexibility in headers.
parent
a97747ed
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
+6
-5
master/product/Vifib/Tool/VifibRestApiV1Tool.py
master/product/Vifib/Tool/VifibRestApiV1Tool.py
+6
-5
No files found.
master/product/Vifib/Tool/VifibRestApiV1Tool.py
View file @
82bad6e9
...
...
@@ -41,6 +41,7 @@ import json
import
transaction
from
App.Common
import
rfc1123_date
from
DateTime
import
DateTime
import
re
class
WrongRequest
(
Exception
):
pass
...
...
@@ -61,7 +62,7 @@ def requireHeader(header_dict):
def
wrapperRequireHeader
(
self
,
*
args
,
**
kwargs
):
problem_dict
=
{}
for
header
,
value
in
header_dict
.
iteritems
():
if
self
.
REQUEST
.
getHeader
(
header
)
!=
value
:
if
not
re
.
match
(
value
,
self
.
REQUEST
.
getHeader
(
header
))
:
problem_dict
[
header
]
=
'Header with value %r is required.'
%
value
if
not
problem_dict
:
return
fn
(
self
,
*
args
,
**
kwargs
)
...
...
@@ -249,7 +250,7 @@ class InstancePublisher(GenericPublisher):
@
responseSupport
()
@
requireHeader
({
'Accept'
:
'application/json'
,
'Content-Type'
:
'
application/json
'
})
'Content-Type'
:
'
^application/json.*
'
})
@
requireJson
(
dict
(
title
=
(
unicode
,
encode_utf8
),
connection
=
dict
...
...
@@ -285,7 +286,7 @@ class InstancePublisher(GenericPublisher):
return
self
.
REQUEST
.
response
@
requireHeader
({
'Accept'
:
'application/json'
,
'Content-Type'
:
'
application/json
'
})
'Content-Type'
:
'
^application/json.*
'
})
@
requireJson
(
dict
(
log
=
unicode
))
@
extractDocument
([
'Software Instance'
,
'Slave Instance'
])
def
__bang
(
self
):
...
...
@@ -303,7 +304,7 @@ class InstancePublisher(GenericPublisher):
return
self
.
REQUEST
.
response
@
requireHeader
({
'Accept'
:
'application/json'
,
'Content-Type'
:
'
application/json
'
})
'Content-Type'
:
'
^application/json.*
'
})
@
requireJson
(
dict
(
slave
=
bool
,
software_release
=
(
unicode
,
encode_utf8
),
...
...
@@ -439,7 +440,7 @@ class InstancePublisher(GenericPublisher):
class
ComputerPublisher
(
GenericPublisher
):
@
responseSupport
()
@
requireHeader
({
'Accept'
:
'application/json'
,
'Content-Type'
:
'
application/json
'
})
'Content-Type'
:
'
^application/json.*
'
})
@
extractDocument
(
'Computer'
)
@
requireJson
(
dict
(
partition
=
list
,
...
...
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