Пример #1
0
                if 'eionet-nfp-cc-' in group[0]:
                    return group[0].replace('eionet-nfp-cc-', '')
                if 'eionet-nfp-mc-' in group[0]:
                    return group[0].replace('eionet-nfp-mc-', '')
                if 'eionet-nfp-oc-' in group[0]:
                    return group[0].replace('eionet-nfp-oc-', '')

    def get_ldap_user_groups(self, user_id):
        """ """
        agent = self._get_ldap_agent(bind=True, secondary=True)
        ldap_roles = sorted(
            agent.member_roles_info('user', user_id, ('description', )))
        return ldap_roles


InitializeClass(OrganisationsEditor)

id_re = re.compile(r'^[a-z]{2}_[a-z]+$')
phone_re = re.compile(r'^\+[\d ]+$')
postal_code_re = re.compile(r'^[a-zA-Z]{2}[a-zA-Z0-9\- ]+$')

_phone_help = ('Telephone numbers must be in international notation (they '
               'must start with a "+" followed by digits which may be '
               'separated using spaces).')
VALIDATION_ERRORS = {
    'id': ('Invalid organisation ID. Mandatory format xx_yyyy - '
           'It must start with a two letter lowercase country code, '
           'followed by an underscore ("_") and then any number '
           'of lowercase a-z letters (no accented characters - unlike the '
           'title, which can contain any characters).'),
    'name':
"""

    Time column for DataGridField.

"""

__author__ = "T. Kim Nguyen <*****@*****.**>"
__docformat__ = 'plaintext'

# Zope imports
from AccessControl import ClassSecurityInfo
from App.class_init import InitializeClass
from Products.DataGridField.Column import Column


class TimeColumn(Column):
    """ Time column """

    security = ClassSecurityInfo()

    security.declarePublic('getMacro')

    def getMacro(self):
        """ Return macro used to render this column in view/edit """
        return "datagrid_time_cell"


# Initializes class security
InitializeClass(TimeColumn)
Пример #3
0
        """See IUniqueIdAnnotation.
        """
        return self._uid

    def getId(self):
        """See IUniqueIdAnnotation.
        """
        return self.id

    def setUid(self, uid):
        """See IUniqueIdAnnotation.
        """
        self._uid = uid


InitializeClass(UniqueIdAnnotation)


def handleUidAnnotationEvent(ob, event):
    """ Event subscriber for (IContentish, IObjectEvent) events
    """

    if IObjectAddedEvent.providedBy(event):
        if event.newParent is not None:
            anno_tool = queryUtility(IUniqueIdAnnotationManagement)
            uid_handler = getToolByName(ob, 'portal_uidhandler', None)
            if anno_tool is not None:
                remove_on_add = anno_tool.getProperty('remove_on_add', False)
                remove_on_clone = anno_tool.getProperty(
                    'remove_on_clone', False)
                assign_on_add = anno_tool.getProperty('assign_on_add', False)
Пример #4
0
        ctool = queryUtility(ICatalogTool)
        if ctool is not None:
            results = self.getReplyResults()
            rids = [x.data_record_id_ for x in results]
            objects = list(map(ctool.getobject, rids))
            return objects

    def quotedContents(self):
        """
            Return this object's contents in a form suitable for inclusion
            as a quote in a response.
        """

        return ""

InitializeClass(OldDiscussable)


@implementer(IOldstyleDiscussionTool)
class DiscussionTool(UniqueObject, SimpleItem, ActionProviderBase):

    id = 'portal_discussion'
    meta_type = 'Oldstyle CMF Discussion Tool'
    # This tool is used to find the discussion for a given content object.

    security = ClassSecurityInfo()

    manage_options = (
        ({'label': 'Overview', 'action': 'manage_overview'},) +
        SimpleItem.manage_options)
Пример #5
0
                function = v.function()

            info = {
                'id': k,
                'meta_type': v.meta_type,
                'module': module,
                'function': function,
                'filename': filename
            }

            result.append(info)

        return result


InitializeClass(WorkflowDefinitionConfigurator)


def _getScriptFilename(workflow_id, script_id, meta_type):
    """ Return the name of the file which holds the script.
    """
    wf_dir = workflow_id.replace(' ', '_')
    suffix = _METATYPE_SUFFIXES.get(meta_type, None)

    if suffix is None:
        return ''

    return 'workflows/%s/scripts/%s.%s' % (wf_dir, script_id, suffix)


def _extractCreationGuard(root, encoding=None):
Пример #6
0
        if setCookieEverywhere and useCookie and langs[0] != langsCookie:
            tool.setLanguageCookie(langs[0], noredir=True)

        self.default_language = langs[-1]
        self.language = langs[0]
        self.language_list = langs[1:-1]


class PrefsForPTS:
    """A preference to hook into PTS."""
    def __init__(self, context):
        self._env = context
        self.languages = []
        binding = context.get('LANGUAGE_TOOL')
        if not isinstance(binding, LanguageBinding):
            return None
        self.pref = binding.getLanguageBindings()
        self.languages = [self.pref[0]] + self.pref[2] + [self.pref[1]]
        return None

    def getPreferredLanguages(self):
        """Returns the list of the bound languages."""
        return self.languages


if _hasPTS:
    registerLangPrefsMethod({'klass': PrefsForPTS, 'priority': 100})

InitializeClass(LanguageTool)
registerToolInterface('portal_languages', ILanguageTool)
Пример #7
0
        """
            Return the Type of Criterion this object is.  This
            method can be overriden in subclasses, or those
            concrete subclasses must define the 'meta_type'
            attribute.
        """
        return self.meta_type

    security.declareProtected(AccessContentsInformation, 'Field')

    def Field(self):
        """
            Return the field that this criterion searches on.  The
            concrete subclasses can override this method, or have
            the 'field' attribute.
        """
        return self.field

    security.declareProtected(AccessContentsInformation, 'Description')

    def Description(self):
        """
            Return a brief but helpful description of the Criterion type,
            preferably based on the classes __doc__ string.
        """
        lines = [line.strip() for line in self.__doc__.splitlines()]
        return ' '.join([line for line in lines if line])


InitializeClass(AbstractCriterion)
Пример #8
0
        m = import_from_name(self.module)
        reload(m)
        self._tr_init()

    def preprocess_param(self, kwargs):
        """ preprocess param fetched from an http post to handle
        optional dictionary
        """
        for param in self.get_parameters():
            if self.get_parameter_infos(param)[0] == 'dict':
                try:
                    keys = kwargs[param + '_key']
                    del kwargs[param + '_key']
                except:
                    keys = ()
                try:
                    values = kwargs[param + '_value']
                    del kwargs[param + '_value']
                except:
                    values = ()
                kwargs[param] = dict = {}
                for key, value in zip(keys, values):
                    key = key.strip()
                    if key:
                        value = value.strip()
                        if value:
                            dict[key] = value


InitializeClass(Transform)
Пример #9
0
        response.setStatus('200')
        response.setBody(self.body)

        # Keep HTTPResponse.exception() from further writing on the
        # response body, without using HTTPResponse.write()
        response._locked_status = True
        response.setBody = self._setBody  # Keep response.exception
        return True

    # Methods to override on response

    def _setBody(self, body, *args, **kw):
        pass


InitializeClass(InlineAuthHelper)

BASIC_LOGIN_FORM = """<html>
  <head>
    <title> Login Form </title>
  </head>

  <body>

    <h3> Please log in </h3>

    <form method="post">
      <table cellpadding="2">
        <tr>
          <td><b>Login:</b> </td>
          <td><input type="text" name="__ac_name" size="30" /></td>
Пример #10
0
        plugins = pas_instance._getOb( 'plugins' )

        active_interfaces = []

        for iface_name in interfaces:
            active_interfaces.append( plugins._getInterfaceFromName( 
                                                iface_name ) )

        pt = plugins._plugin_types
        id = self.getId()

        for type in pt:
            ids = plugins.listPluginIds( type )
            if id not in ids and type in active_interfaces:
                plugins.activatePlugin( type, id ) # turn us on
            elif id in ids and type not in active_interfaces:
                plugins.deactivatePlugin( type, id ) # turn us off

        if RESPONSE is not None:
            RESPONSE.redirect('%s/manage_workspace'
                              '?manage_tabs_message='
                              'Interface+activations+updated.'
                            % self.absolute_url())

    security.declarePrivate( '_getPAS' )
    def _getPAS( self ):
        """ Canonical way to get at the PAS instance from a plugin """
        return aq_parent( aq_inner( self ) )

InitializeClass(BasePlugin)
Пример #11
0
    def _checkAvailable(self, ec):
        """ Check if the action is available in the current context.
        """
        return ec.contexts['folder'].getTypeInfo().allowType(self.getId())

    def _checkAllowed(self, ec):
        """ Check if the action is allowed in the current context.
        """
        container = ec.contexts['folder']
        if not _checkPermission(AddPortalContent, container):
            return False
        return self.isConstructionAllowed(container)


InitializeClass(TypeInformation)


class FactoryTypeInformation(TypeInformation):
    """ Portal content factory.
    """

    implements(ITypeInformation)

    security = ClassSecurityInfo()

    _properties = (TypeInformation._basic_properties +
                   ({
                       'id': 'product',
                       'type': 'string',
                       'mode': 'w',
Пример #12
0
    security.declarePrivate('listActions')

    def listActions(self, info=None, object=None):
        """ Returns a list of actions to be displayed to the user.

        o Invoked by the portal_actions tool.

        o Allows workflows to include actions to be displayed in the
          actions box.

        o Object actions are supplied by workflows that apply to the object.
        """
        if object is not None or info is None:
            info = self._getOAI(object)
        chain = self.getChainFor(info.object)
        actions = []

        for wf_id in chain:
            wf = self.getWorkflowById(wf_id)
            if wf is not None:
                a = wf.listObjectActions(info)
                if a is not None:
                    actions.extend(a)
        return actions


WorkflowTool.__doc__ = BaseTool.__doc__

InitializeClass(WorkflowTool)
Пример #13
0
@implementer(IExtractionPlugin)
class CookieCrumblingPlugin(Folder, BasePlugin):
    """Multi-plugin for injecting HTTP Basic Authentication
    credentials from form credentials.
    """
    meta_type = 'Cookie Crumbling Plugin'

    security = ClassSecurityInfo()

    def __init__(self, id, title=None):
        self._setId(id)
        self.title = title

    def _getCC(self):
        return getattr(aq_base(self), CC_ID, None)

    @security.private
    def extractCredentials(self, request):
        """ Extract basic auth credentials from 'request'.
        """

        try:
            self._getCC().modifyRequest(request, request.RESPONSE)

        except Exception as e:
            logger.error("PlonePAS error: %s", e, exc_info=1)

        return {}

InitializeClass(CookieCrumblingPlugin)
Пример #14
0
            event.notify(UserLoggedInEvent(user))

        # Expire the clipboard
        if self.REQUEST.get('__cp', None) is not None:
            self.REQUEST.RESPONSE.expireCookie('__cp', path='/')

        # Create member area
        mtool.createMemberArea(member_id=login)

    def _signature_context(self, purge=False):
        context = getattr(self, '_v_signature_context', None)
        if purge or context is None:
            context = SignatureContext()
            key = Key.loadMemory(self.signing_cert, KeyDataFormatCertPem, None)
            context.add_key(key, self.issuer_id)
            setattr(self, '_v_signature_context', context)
        return context

    def _extract_attributes(self, assertion):
        attrs = {}
        for astmt in assertion.AttributeStatement:
            for attr in astmt.Attribute:
                key = attr.Name.encode('utf8')
                value = xs_convert_from_xml(attr.AttributeValue,
                                            ty='string').encode('utf8')
                attrs[key] = value
        return attrs


InitializeClass(Saml2WebSSOPlugin)
Пример #15
0
    def may_accept_items(self):
        if self.context.query_state(
        ) in self.cfg.getMeetingStatesAcceptingItemsForMeetingManagers():
            return True

    security.declarePublic('may_change_items_order')

    def may_change_items_order(self):
        res = True
        if not _checkPermission(ModifyPortalContent, self.context) or \
           self.context.query_state() in Meeting.MEETINGCLOSEDSTATES:
            res = False
        return res


InitializeClass(MeetingWorkflowConditions)


class MeetingWorkflowActions(object):
    '''Adapts a meeting to interface IMeetingWorkflowActions.'''
    implements(IMeetingWorkflowActions)
    security = ClassSecurityInfo()

    def __init__(self, meeting):
        self.context = meeting
        self.tool = api.portal.get_tool('portal_plonemeeting')
        self.cfg = self.tool.getMeetingConfig(self.context)

    security.declarePrivate('init_sequence_number')

    def init_sequence_number(self):
Пример #16
0
        full_path = os.path.join( self._profile_path, path )

        if not os.path.exists( full_path ) or not os.path.isdir( full_path ):
            return None

        names = []
        for name in os.listdir(full_path):
            if name in skip:
                continue
            if [s for s in skip_suffixes if name.endswith(s)]:
                continue
            names.append(name)

        return names

InitializeClass( DirectoryImportContext )


class DirectoryExportContext( BaseContext ):

    implements(IChunkableExportContext)

    security = ClassSecurityInfo()

    def __init__( self, tool, profile_path, encoding=None ):

        BaseContext.__init__( self, tool, encoding )
        self._profile_path = profile_path

    security.declareProtected( ManagePortal, 'openDataFile' )
    def openDataFile( self, filename, content_type, subdir=None ):
Пример #17
0
    def objectIds(self, spec=None):
        return SequenceWrapper(self, self._histories.keys())

    security.declarePrivate('objectValues')

    def objectValues(self, spec=None):
        return SequenceWrapper(self, self._histories.values())

    security.declarePrivate('objectItems')

    def objectItems(self, spec=None):
        return SequenceWrapper(self, self._histories.items(), 1)


InitializeClass(ZopeRepository)


def addRepository(self, id, title='', REQUEST=None):
    """Zope object constructor function."""
    object = ZopeRepository(title=title)
    object._setId(id)
    self._setObject(id, object)
    object = self._getOb(id)
    if REQUEST is not None:
        try:
            url = self.DestinationURL()
        except:
            url = REQUEST['URL1']
        REQUEST.RESPONSE.redirect('%s/manage_main' % url)
    return
Пример #18
0
            filename = theFile.getId()
            data = str(theFile.data)
            content_type = content_type or theFile.content_type
        elif isinstance(theFile, file):
            filename = cookId(theFile.name)
            data = theFile.read()
            if content_type is None:
                content_type, enc = guess_content_type(filename, data)
        elif isinstance(theFile, FileUpload):
            filename = cookId(theFile.filename)
            data = theFile.read()
            headers = theFile.headers
            if content_type is None:
                if 'content-type' in headers:
                    content_type = headers['content-type']
                else:
                    content_type, enc = guess_content_type(filename, data)
        else:
            raise TypeError('Unknown object type found: %r' % theFile)

        msg = MIMEBase(*content_type.split('/'))
        msg.set_payload(data)
        encode_base64(msg)
        msg.add_header('Content-ID', '<%s>' % \
            ''.join(['%s' % ord(i) for i in filename]))
        msg.add_header('Content-Disposition', 'attachment', filename=filename)
        self.attach(msg)


InitializeClass(MTMultipart)
Пример #19
0
            #posargs = (self, REQUEST, RESPONSE)
            posargs = (self, REQUEST)
        else:
            posargs = ()

        kwargs = {'cooked': self.cook()}
        return template(*posargs, **kwargs)

    security.declareProtected(FTPAccess, 'manage_FTPget')
    def manage_FTPget(self):
        """ Fetch our source for delivery via FTP.
        """
        return self.raw

    security.declareProtected(ViewManagementScreens, 'PrincipiaSearchSource')
    def PrincipiaSearchSource(self):
        """ Fetch our source for indexing in a catalog.
        """
        return self.raw

    security.declareProtected(ViewManagementScreens, 'document_src')
    def document_src( self ):
        """ Fetch our source for rendering in the ZMI.
        """
        return self.raw

InitializeClass(FSSTXMethod)

registerFileExtension('stx', FSSTXMethod)
registerMetaType('STX Method', FSSTXMethod)
Пример #20
0
    security.declareProtected(permissions.ModifyPortalContent,
                              'setDescription')
    setDescription = BaseFolder.setDescription.im_func

    manage_addFolder = BaseFolder.manage_addFolder.im_func

    MKCOL = BaseFolder.MKCOL.im_func
    MKCOL_handler = BaseFolder.MKCOL_handler.im_func

    security.declareProtected(permissions.ModifyPortalContent, 'PUT')
    PUT = WebDAVSupport.PUT

    security.declareProtected(permissions.View, 'manage_FTPget')
    manage_FTPget = WebDAVSupport.manage_FTPget

    security.declarePrivate('manage_afterPUT')
    manage_afterPUT = WebDAVSupport.manage_afterPUT

    security.declareProtected(permissions.ModifyPortalContent, 'edit')
    edit = BaseFolder.edit.im_func


InitializeClass(BaseBTreeFolder)

BaseBTreeFolderSchema = BaseBTreeFolder.schema

__all__ = (
    'BaseBTreeFolder',
    'BaseBTreeFolderSchema',
)
Пример #21
0
            tool_id = self._extract(attrs, 'tool_id')

            if tool_id not in self._forbidden:
                self._forbidden.append(tool_id)

        elif name == 'required':

            tool_id = self._extract(attrs, 'tool_id')
            dotted_name = self._extract(attrs, 'class')
            self._required[tool_id] = dotted_name

        else:
            raise ValueError, 'Unknown element %s' % name


InitializeClass(_ToolsetParser)


class _ImportStepRegistryParser(_HandlerBase):

    security = ClassSecurityInfo()
    security.declareObjectPrivate()
    security.setDefaultAccess('deny')

    def __init__(self, encoding):

        self._encoding = encoding
        self._started = False
        self._pending = None
        self._parsed = []
Пример #22
0

class CMFBTreeFolder(BTreeFolder2Base, PortalFolderBase):

    """BTree folder for CMF sites.
    """

    security = ClassSecurityInfo()

    def __init__(self, id, title=''):
        PortalFolderBase.__init__(self, id, title)
        BTreeFolder2Base.__init__(self, id)

    def _checkId(self, id, allow_dup=0):
        PortalFolderBase._checkId(self, id, allow_dup)
        BTreeFolder2Base._checkId(self, id, allow_dup)

    security.declareProtected(AddPortalFolders, 'manage_addPortalFolder')
    def manage_addPortalFolder(self, id, title='', REQUEST=None):
        """Add a new PortalFolder object with id *id*.
        """
        ob = PortalFolder(id, title)
        self._setObject(id, ob, suppress_events=True)
        if REQUEST is not None:
            return self.folder_contents( # XXX: ick!
                self, REQUEST, portal_status_message="Folder added")

InitializeClass(CMFBTreeFolder)

CMFBTreeFolderFactory = Factory(CMFBTreeFolder)
Пример #23
0
                # Prevent denial of service
                raise ExhaustedUniqueIdsError
        self._v_nextid = n + 1
        return id

    def __getattr__(self, name):
        # Boo hoo hoo!  Zope 2 prefers implicit acquisition over traversal
        # to subitems, and __bobo_traverse__ hooks don't work with
        # restrictedTraverse() unless __getattr__() is also present.
        # Oh well.
        try:
            return self._htree_get(name)
        except KeyError:
            raise AttributeError(name)


InitializeClass(HBTreeFolder2Base)


class HBTreeFolder2(HBTreeFolder2Base, Folder):
    """BTreeFolder2 based on OFS.Folder.
    """
    meta_type = 'HBTreeFolder2'

    def _checkId(self, id, allow_dup=0):
        Folder._checkId(self, id, allow_dup)
        HBTreeFolder2Base._checkId(self, id, allow_dup)


InitializeClass(HBTreeFolder2)
Пример #24
0
    security.declarePublic('getId')
    def getId(self):
        return self.id

    security.declarePrivate('saveState')
    def saveState(self, obj):
        """Save the state of object as the state for this version of
           a version-controlled resource."""
        self._data = self.stateCopy(obj, self)

    security.declarePrivate('copyState')
    def copyState(self):
        """Return an independent deep copy of the state of the version."""
        data = self.__dict__.get('_data')  # Avoid __of__ hooks
        return self.stateCopy(data, self)

    security.declarePrivate('stateCopy')
    def stateCopy(self, obj, container):
        """Get a deep copy of the state of an object.

        Breaks any database identity references.
        """
        ignore = listNonVersionedObjects(obj)
        res = cloneByPickle(aq_base(obj), ignore)
        removeNonVersionedData(res)
        return res


InitializeClass(Version)
Пример #25
0
    security = ClassSecurityInfo()
    security.declarePrivate('manage_addProperty')
    security.declarePrivate('manage_delProperties')
    security.declarePrivate('manage_changePropertyTypes')

    def manage_propertiesForm(self, REQUEST, *args, **kw):
        """ An override that makes the schema fixed.
        """
        my_kw = kw.copy()
        my_kw['property_extensible_schema__'] = 0
        form = PropertyManager.manage_propertiesForm.__of__(self)
        return form(self, REQUEST, *args, **my_kw)


InitializeClass(SimpleItemWithProperties)


#
#   "Omnibus" factory framework for tools.
#
class ToolInit:
    """ Utility class for generating the factories for several tools.
    """
    __name__ = 'toolinit'

    security = ClassSecurityInfo()
    security.declareObjectPrivate()  # equivalent of __roles__ = ()

    def __init__(self, meta_type, tools, product_name=None, icon=None):
        self.meta_type = meta_type
Пример #26
0
    def __setitem__(self, i, y):
        super(SortedDict, self).__setitem__(i, y)
        if i not in self.pmt:
            self.pmt.append(i)

    security.declarePublic('pop')

    def pop(self, k, *args, **kwargs):
        super(SortedDict, self).pop(k, *args, **kwargs)
        if k in self.pmt:
            self.pmt.remove(k)


try:
    InitializeClass(SortedDict)
except:
    pass


def _group_unescape(m):
    if m.group("ent"):
        try:
            return unescape(entitydefs[m.group("ent")])
        except KeyError:
            return m.group(0)
    if m.group("dec"):
        return unichr(int(m.group("dec")))
    if m.group("hex"):
        return unichr(int(m.group("hex"), 16))
Пример #27
0
    def manage_updateProtocolMapping(self, mapping, REQUEST=None):
        """ Update mapping of Request Type to Protocols
        """
        for key, value in mapping.items():
            value = filter(None, value)
            if not value:
                if self._map.has_key(key):
                    del self._map[key]
            else:
                self._map[key] = value

        if REQUEST is not None:
            REQUEST['RESPONSE'].redirect('%s/manage_editProtocolMapping'
                                         '?manage_tabs_message='
                                         'Protocol+Mappings+Changed.' %
                                         self.absolute_url())


classImplements(
    ChallengeProtocolChooser,
    IChallengeProtocolChooserPlugin,
    IChallengeProtocolChooser,
)

InitializeClass(ChallengeProtocolChooser)

for label, iface in (('Browser', IBrowserRequest), ('WebDAV', IWebDAVRequest),
                     ('FTP', IFTPRequest), ('XML-RPC', IXMLRPCRequest)):
    registerRequestType(label, iface)
Пример #28
0
        self._members[id] = aq_base(m)

    security.declarePrivate('deleteMemberData')

    def deleteMemberData(self, member_id):
        """ Delete member data of specified member.
        """
        members = self._members
        if members.has_key(member_id):
            del members[member_id]
            return 1
        else:
            return 0


InitializeClass(MemberDataTool)
registerToolInterface('portal_memberdata', IMemberDataTool)


class CleanupTemp:
    """Used to cleanup _v_temps at the end of the request."""
    def __init__(self, tool):
        self._tool = tool

    def __del__(self):
        try:
            del self._tool._v_temps
        except (AttributeError, KeyError):
            # The object has already been deactivated.
            pass
Пример #29
0
    def vcs_view(self, REQUEST, RESPONSE):
        """vCalendar output
        """
        RESPONSE.setHeader('Content-Type', 'text/x-vCalendar')
        RESPONSE.setHeader('Content-Disposition',
                           'attachment; filename="%s.vcs"' % self.getId())
        out = StringIO()
        out.write(VCS_HEADER % {
            'prodid': PRODID,
        })
        out.write(self.getVCal())
        out.write(VCS_FOOTER)
        return n2rn(out.getvalue())


InitializeClass(CalendarSupportMixin)


def vformat(s):
    # return string with escaped commas, colons and semicolons
    return s.strip().replace(',', '\,').replace(':', '\:').replace(';', '\;')


def n2rn(s):
    return s.replace('\n', '\r\n')


def rfc2445dt(dt):
    # return UTC in RFC2445 format YYYYMMDDTHHMMSSZ
    return dt.HTML4().replace('-', '').replace(':', '')
Пример #30
0
        """ Create a column
        
            @param hide Hide column from displaying
        """
        Column.__init__(self, label, default, label_msgid)
        self.visible = visible

    security.declarePublic('getMacro')

    def getMacro(self):
        """ Return macro used to render this column in view/edit """
        return "referencedatagrid_hidden_cell"


# Initializes class security
InitializeClass(HiddenColumn)


class BlockColumn(Column):
    """ Column with possibility to block the cell data from changing,
        based on the value of the row data.
    """
    security = ClassSecurityInfo()

    def __init__(self,
                 label,
                 default=None,
                 label_msgid=None,
                 column_on_class=None,
                 column_off_class=None,
                 columns=[],