from zope.interface import Interface from zope import schema from zope.schema.vocabulary import SimpleVocabulary from collective.ATClamAV import ATClamAVMessageFactory as _ clamdConnectionType = SimpleVocabulary.fromItems(( (_(u"Local UNIX Socket"), 'socket'), (_(u"Network"), 'net'))) class IAVScannerSettings(Interface): """ Schema for the ClamAV settings """ clamav_connection = schema.Choice( title=_(u"Connection type to clamd"), description=_(u"Choose whether clamd is accessible through local " "UNIX sockets or network."), vocabulary=clamdConnectionType) clamav_socket = schema.ASCIILine( title=_(u"Clamd local socket file"), description=_(u"If connected to clamd through local UNIX sockets, " "the path to the local socket file."), default = '/var/run/clamd', required = True) clamav_host = schema.ASCIILine(title=_(u"Scanner host"), description=_(u"If connected to clamd through the network, " "the host running clamd."), default = 'localhost',
from collective.ATClamAV import ATClamAVMessageFactory as _ from zope.interface import Interface from zope import schema from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm from zope.schema.interfaces import IContextSourceBinder from Products.CMFCore.utils import getToolByName from Products.CMFDefault.formlib.schema import SchemaAdapterBase from Products.CMFPlone.interfaces import IPloneSiteRoot from zope.component import adapts from zope.interface import implements clamdConnectionType = SimpleVocabulary( [SimpleTerm(value=_(u"Local UNIX Socket"), title=_(u'socket')), SimpleTerm(value=_(u"Network"), title=_(u'net'))]) class IClamAVControlPanel(Interface): clamav_connection = schema.Choice( title=_(u"Connection type to clamd"), description=_(u"Choose whether clamd is accessible through local " "UNIX sockets or network."), vocabulary=clamdConnectionType) clamav_socket = schema.ASCIILine( title=_(u"Clamd local socket file"), description=_(u"If connected to clamd through local UNIX sockets, "