def import_file(filename, plominodb): filepath = join(DIRPATH, filename) plominodb.importDesignFromXML(open(filepath).read()) # If the import file has a pd b, allow it import AccessControl # obfuscate pd b module to fly under git pre-commit hook's radar AccessControl.ModuleSecurityInfo('pd' 'b').declarePublic('set_trace') AccessControl.ModuleSecurityInfo('ipd' 'b').declarePublic('set_trace')
# -*- coding: utf-8 -*- """Init and utils.""" import json import AccessControl from DateTime import DateTime from zope.component.hooks import getSite from Products.CMFCore.utils import getToolByName from zope.i18nmessageid import MessageFactory _ = MessageFactory('collective.downloadtracker') # Allow access to increase_download_count() from Script (Python) AccessControl.ModuleSecurityInfo('collective.downloadtracker')\ .declarePublic('add_download_record') def getActiveUserName(): """ Return the username of the current user, or None. """ portal = getSite() mt = getToolByName(portal, 'portal_membership') if mt.isAnonymousUser(): # the user has not logged in return None else: member = mt.getAuthenticatedMember() username = member.getUserName() return username def add_download_record(file):
import AccessControl AccessControl.ModuleSecurityInfo('pdb').declarePublic('set_trace')
from . import monkeypatch # noqa import AccessControl AccessControl.ModuleSecurityInfo("pdb").declarePublic("set_trace")