--- a/src/pyams_skin/interfaces/__init__.py Mon Oct 10 11:32:08 2016 +0200
+++ b/src/pyams_skin/interfaces/__init__.py Mon Oct 10 15:27:10 2016 +0200
@@ -20,7 +20,7 @@
# import packages
from pyams_template.template import layout_config
-from zope.interface import implementer, Interface, Attribute
+from zope.interface import implementer, invariant, Interface, Attribute, Invalid
from zope.configuration.fields import GlobalInterface
from zope.schema import Text, TextLine, Choice, Int, Bool
@@ -62,9 +62,15 @@
skin_parent = Attribute("Skin parent (local or inherited)")
- skin = Choice(title=_("Presentation skin"),
- description=_("This skin will be used to handle presentation templates"),
- vocabulary='PyAMS user skins')
+ skin = Choice(title=_("Custom graphic theme"),
+ description=_("This theme will be used to handle graphic design (colors and images)"),
+ vocabulary='PyAMS user skins',
+ required=False)
+
+ @invariant
+ def check_skin(self):
+ if not (self.skin or self.inherit_skin):
+ raise Invalid(_("You must select a custom skin or inherit from parent!"))
def get_skin(self, request=None):
"""Get skin matching this content"""