Skip to content

Instantly share code, notes, and snippets.

@zopyx
Created July 15, 2016 06:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save zopyx/193412b48621e0f55e72e77abd3d2bce to your computer and use it in GitHub Desktop.
Save zopyx/193412b48621e0f55e72e77abd3d2bce to your computer and use it in GitHub Desktop.
def context_property(name, default=None):
def getter(self, default=default):
return getattr(self.context, name, default)
def setter(self, value):
setattr(self.context, name, value)
def deleter(self):
delattr(self.context, name)
return property(getter, setter, deleter)
class Guideline(object):
""" Adapter for Guideline """
implements(IGuideline)
adapts(IDexterityContent)
def __init__(self, context):
self.context = context
gl_language = context_property('gl_language')
gl_state = context_property('gl_state', '')
gl_date = context_property('gl_date', '')
gl_area = context_property('gl_area')
gl_guideline_topics = context_property('gl_guideline_topics', None)
gl_id = context_property('gl_id')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment