-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
96 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[settings] | ||
profile=plone | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
16 changes: 16 additions & 0 deletions
16
src/rer/ufficiostampa/restapi/services/send_form/configure.zcml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<configure | ||
xmlns="http://namespaces.zope.org/zope" | ||
xmlns:plone="http://namespaces.plone.org/plone" | ||
xmlns:zcml="http://namespaces.zope.org/zcml" | ||
> | ||
|
||
<plone:service | ||
method="GET" | ||
factory=".schema.SendComunicatoSchema" | ||
for="rer.ufficiostampa.interfaces.IComunicatoStampa" | ||
permission="rer.ufficiostampa.Send" | ||
layer="rer.ufficiostampa.interfaces.IRerUfficiostampaLayer" | ||
name="@send-comunicato-schema" | ||
/> | ||
|
||
</configure> |
33 changes: 33 additions & 0 deletions
33
src/rer/ufficiostampa/restapi/services/send_form/schema.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from plone.restapi.serializer.converters import IJsonCompatible | ||
from plone.restapi.services import Service | ||
from plone.restapi.types.utils import get_fieldset_infos | ||
from plone.restapi.types.utils import get_fieldsets | ||
from plone.restapi.types.utils import get_jsonschema_properties | ||
from plone.restapi.types.utils import iter_fields | ||
from rer.ufficiostampa import _ | ||
from rer.ufficiostampa.browser.send import ISendForm | ||
|
||
|
||
class SendComunicatoSchema(Service): | ||
title = _("Send Comunicato Schema") | ||
|
||
def reply(self): | ||
fieldsets = get_fieldsets(self.context, self.request, ISendForm) | ||
properties = get_jsonschema_properties(self.context, self.request, fieldsets) | ||
# Determine required fields | ||
required = [] | ||
for field in iter_fields(fieldsets): | ||
if field.field.required: | ||
required.append(field.field.getName()) | ||
|
||
# Include field modes | ||
for field in iter_fields(fieldsets): | ||
if field.mode: | ||
properties[field.field.getName()]["mode"] = field.mode | ||
return { | ||
"type": "object", | ||
"title": self.title, | ||
"properties": IJsonCompatible(properties), | ||
"required": required, | ||
"fieldsets": get_fieldset_infos(fieldsets), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters