Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
validators=(colander_body_validator,), header='X-foo')
def bound_post_with_override(request):
return request.validated
validators=(colander_body_validator, ),
schema=ServicesPostBodySchema())
def register_service(request):
"""Register a service."""
LOGGER.debug("request validated={}".format(request.validated))
return request.owsregistry.register_service(**request.validated)
validators=(colander_body_validator,
validate_update_id,
validate_acls),
permission='edit', renderer='json',
error_handler=bodhi.server.services.errors.json_handler)
def trigger_tests(request):
"""
Trigger tests for update.
Args:
request (pyramid.request): The current request.
Returns:
dict: A dictionary mapping the key "update" to the update.
"""
update = request.validated['update']
if update.status != UpdateStatus.testing:
colander_body_validator,
validate_override_builds,
validate_expiration_date,
))
@overrides.post(schema=bodhi.server.schemas.SaveOverrideSchema,
permission='edit',
accept=("application/javascript"), renderer="jsonp",
error_handler=bodhi.server.services.errors.jsonp_handler,
validators=(
colander_body_validator,
validate_override_builds,
validate_expiration_date,
))
def save_override(request):
"""
Create or edit a buildroot override.
@channel.post(permission=PRIVATE, schema=PayloadSchema(), validators=(colander_body_validator,))
def send_push_notifications(request):
channel_id = request.matchdict['channel_id']
parent_id = '/channels/{}'.format(channel_id)
registrations, count = request.registry.storage.get_all(
collection_id=REGISTRATION_COLLECTION_ID,
parent_id=parent_id)
subscriptions = []
for registration in registrations:
user_subscriptions, count = request.registry.storage.get_all(
collection_id=SUBSCRIPTION_COLLECTION_ID,
parent_id=registration['id'])
subscriptions += user_subscriptions
@values.put(tags=['values'], validators=(colander_body_validator, ),
schema=BodySchema(), response_schemas=response_schemas)
def set_value(request):
"""Set the value and returns *True* or *False*."""
key = request.matchdict['key']
_VALUES[key] = request.json_body
return _VALUES.get(key)
@mail_service.post(schema=EmailSchema(), validators=(colander_body_validator,))
def send_mail(request):
settings = request.registry.settings
logger.info("Send email request received",
extra={"request": request.validated})
host = settings["edwiges.provider_host"]
port = settings["edwiges.provider_port"]
username = settings["edwiges.provider_username"]
password = settings["edwiges.provider_password"]
with SMTP_SSL(host, port) as smtp:
try:
smtp.ehlo()
if username and password:
colander_body_validator,
validate_update,
validate_bug_feedback,
validate_testcase_feedback,
validate_comments_open,
))
def new_comment(request):
"""
Add a new comment to an update.
Args:
request (pyramid.request): The current request.
Returns:
dict: A dictionary with two keys. "comment" indexes the new comment, and "caveats" indexes
an iterable of messages to display to the user.
"""
data = request.validated
def body_schema_transformer(schema, args):
validators = args.get('validators', [])
if colander_body_validator in validators:
body_schema = schema
schema = colander.MappingSchema()
schema['body'] = body_schema
return schema
validators=(colander_body_validator, validate_tags, validate_enums)
)
def save_release(request):
"""
Save a release.
This entails either creating a new release, or editing an existing one. To
edit an existing release, the release's original name must be specified in
the ``edited`` parameter.
Args:
request (pyramid.request): The current request.
Returns:
bodhi.server.models.Request: The created or edited Request.
"""
data = request.validated