Example #1
0
class IRSSTileData(IPersistentCoverTile):

    feeds = List(
        title=u("Feeds"),
        unique=True,
        value_type=URI(title=u('URL')),
    )

    items_to_show = Int(title=u("Number of items to show"), )

    max_per_feed = Int(title=u("Maximum number of items from a given feed"), )

    blacklist = List(
        title=u("Blacklisted words"),
        unique=True,
        value_type=ASCII(title=u('Word')),
        required=False,
        missing_value=[],
    )

    whitelist = List(
        title=u("Whitelisted words"),
        unique=True,
        value_type=ASCII(title=u('Word')),
        required=False,
        missing_value=[],
    )
Example #2
0
class IStubMailerDirective(IMailerDirective):
    from_addr = ASCII(
        title=u"From Address",
        description=u"All outgoing emails will use this email address",
        required=True,
    )
    to_addr = ASCII(
        title=u"To Address",
        description=(u"All outgoing emails will be redirected to this email "
                     u"address"),
        required=True,
    )
    mailer = ASCII(
        title=u"Mailer to use",
        description=u"""\
                Which registered mailer to use, such as configured with
                the smtpMailer or sendmailMailer directives""",
        required=False,
        default='smtp',
    )
    rewrite = Bool(
        title=u"Rewrite headers",
        description=u"""\
                    If true, headers are rewritten in addition to the
                    destination address in the envelope. May me required
                    to bypass spam filters.""",
        required=False,
        default=False,
    )
class IMailMessage(Interface):

    # This needs to be converted to unicode on input
    from_addr = TextLine(
        title = _(u"From"),
        description = _(u"The address the mail was sent from"),
        required = True,)

    # This needs to be converted to unicode on input
    subject = TextLine(
        title = _(u"Subject"),
        description = _(u"The subject of the email"),
        default = u"No Subject",
        required = False,)

    date = Datetime(
        title = _(u"Date"),
        description = _(u"The date the mail was sent"),
        required = True,)

    body = Text(
        title = _(u"Body"),
        description = _(u"The mail message body"),
        default = u'',
        required = False,)

    message_id = ASCII(
        title = _(u"Message Id"),
        description = _(u"The message id of this message."),
        default = '',
        required = False,)

    in_reply_to = ASCII(
        title = _(u"Reply To"),
        description = _(u"The message id that this mail is in reply to."),
        default = '',
        required = False,)

    references = Tuple(
        title = _(u"References"),
        description = _(u"Any message ids that this mail refers to."),
        value_type = ASCII(title=_(u"Reference"),),
        default = (),
        required = False,)

    other_headers = Tuple(
        title = _(u"Headers"),
        description = _(u"List of selected other headers: (key, value) pairs"),
        value_type = Tuple(
                           title = _(u"Header"),
                           value_type = ASCII(),
                           min_length = 2,
                           max_length = 2,),
        default = (),
        required = False,
        )
Example #4
0
class IDirectoryMailBoxDirective(Interface):
    """Configure a mail box which interfaces to a directory of raw files."""
    directory = ASCII(
        title=u"Directory",
        description=u"The directory containing the raw mail files.",
        required=True,
    )
Example #5
0
class IMailSchema(Interface):
    """Combined schema for the adapter lookup.
    """

    smtp_host = TextLine(title=_(u'label_smtp_server', default=u'SMTP server'),
                         description=_(
                             u"help_smtp_server",
                             default=u"The address of your local "
                             "SMTP (outgoing e-mail) server. Usually "
                             "'localhost', unless you use an "
                             "external server to send e-mail."),
                         default=u'localhost',
                         required=True)

    smtp_port = Int(title=_(u'label_smtp_port', default=u'SMTP port'),
                    description=_(
                        u"help_smtp_port",
                        default=u"The port of your local SMTP "
                        "(outgoing e-mail) server. Usually '587' or '25'."),
                    default=25,
                    required=True)

    smtp_userid = TextLine(title=_(u'label_smtp_userid',
                                   default=u'ESMTP username'),
                           description=_(
                               u"help_smtp_userid",
                               default=u"Username for authentication "
                               "to your e-mail server. Not required "
                               "unless you are using ESMTP."),
                           default=None,
                           required=False)

    smtp_pass = Password(title=_(u'label_smtp_pass',
                                 default=u'ESMTP password'),
                         description=_(u"help_smtp_pass",
                                       default=u"The password for the ESMTP "
                                       "user account."),
                         default=None,
                         required=False)

    email_from_name = TextLine(title=_(u"Site 'From' name"),
                               description=_(u"Plone generates e-mail using "
                                             "this name as the e-mail "
                                             "sender."),
                               default=None,
                               required=True)

    email_from_address = ASCII(title=_(u"Site 'From' address"),
                               description=_(u"Plone generates e-mail using "
                                             "this address as the e-mail "
                                             "return address. It is also "
                                             "used as the destination "
                                             "address for the site-wide "
                                             "contact form and the 'Send test "
                                             "e-mail' feature."),
                               default=None,
                               required=True)
Example #6
0
class ISignedMessage(Interface):
    """A message that's possibly signed with an OpenPGP key.

    If the message wasn't signed, all attributes will be None.
    """
    def __getitem__(name):
        """Returns the message header with the given name."""

    signedMessage = Attribute("The part that was signed, represented "
                              "as an email.Message.")

    signedContent = ASCII(title=_("Signed Content"),
                          description=_("The text that was signed."))

    signature = ASCII(title=_("Signature"),
                      description=_("The OpenPGP signature used to sign "
                                    "the message."))

    parsed_string = Attribute(
        "The string that was parsed to create the SignedMessage.")
Example #7
0
class IRegisterClassDirective(Interface):
    """registerClass directive schema.

    Register content with Zope 2.
    """

    class_ = GlobalObject(
        title=u'Instance Class',
        description=u'Dotted name of the class that is registered.',
        required=True)

    meta_type = ASCII(
        title=u'Meta Type',
        description=u'A human readable unique identifier for the class.',
        required=True)

    permission = Permission(
        title=u'Add Permission',
        description=u'The permission for adding objects of this class.',
        required=True)

    addview = ASCII(
        title=u'Add View ID',
        description=u'The ID of the add view used in the ZMI. Consider this '
        u'required unless you know exactly what you do.',
        default=None,
        required=False)

    icon = ASCII(title=u'Icon ID',
                 description=u'The ID of the icon used in the ZMI.',
                 default=None,
                 required=False)

    global_ = Bool(
        title=u'Global scope?',
        description=u'If "global" is False the class is only available in '
        u'containers that explicitly allow one of its interfaces.',
        default=True,
        required=False)
Example #8
0
class IMboxMailerDirective(IMailerDirective):
    filename = ASCII(
        title=u'File name',
        description=u'Unix mbox file to store outgoing emails in',
        required=True,
    )
    overwrite = Bool(
        title=u'Overwrite',
        description=u'Whether to overwrite the existing mbox file or not',
        required=False,
        default=False,
    )
    mailer = ASCII(
        title=u"Chained mailer to which messages are forwarded",
        description=u"""\
            Optional mailer to forward messages to, such as those configured
            with smtpMailer, sendmailMailer, or testMailer directives.  When
            not given, the message is not forwarded but only stored in the
            mbox file.""",
        required=False,
        default=None,
    )
Example #9
0
class IPOP3MailBoxDirective(Interface):
    """Configure a mail box which interfaces to a POP3 server."""
    host = ASCII(
        title=u"Host",
        description=u"Host name of the POP3 server.",
        required=True,
    )

    user = ASCII(
        title=u"User",
        description=u"User name to connect to the POP3 server with.",
        required=True,
    )

    password = ASCII(
        title=u"Password",
        description=u"Password to connect to the POP3 server with.",
        required=True,
    )

    ssl = Bool(title=u"SSL",
               description=u"Use SSL.",
               required=False,
               default=False)
Example #10
0
class IRating(Interface):
    """An object representing a user rating, the rating attributes
    are immutable.  The object itself should be a Float, though there
    is no IFloat to be inherited from other than the schema field."""

    userid = ASCII(
        title=_(u"User Id"),
        description=_(u"The id of the user who set the rating"),
        required=False,
        readonly=True,
    )

    timestamp = Datetime(
        title=_(u"Time Stamp"),
        description=_(u"The date and time the rating was made (UTC)"),
        required=True,
        readonly=True)
Example #11
0
class IMailingList(Interface):
    """
       A de facto interface for some MailBoxer-y things, includes the
       basic public features, minus those that are useful primarily
       for smtp2zope.py
    """

    title = TextLine(
        title=_(u"Title"),
        description=_(u'mailing_list_title', u""),
        required=True,
    )

    description = Text(title=_(u"Description"),
                       description=_(u"A description of the mailing list."),
                       default=u'',
                       required=False)

    mailto = ASCII(
        title=_(u"List Address"),
        description=_(u"Main address for the mailing list."),
        required=True,
        constraint=check_mailto,
    )

    manager_email = Attribute(
        "The published address which general inquiries about the "
        "list will be sent to.  Usually [email protected].")

    managers = Tuple(
        title=_(u"Managers"),
        description=_(u"The people who maintain the list.  Managers can "
                      "edit list settings and can edit the list of allowed "
                      "senders / subscribers.  Managers receive moderation "
                      "requests, general inquiries and any bounced mail."),
        default=(),
        required=True,
        value_type=TextLine(title=_(u"Manager"), ),
    )

    list_type = Choice(
        title=_(u"List Type"),
        description=_(u"The policy that defines the behavior of the list."),
        vocabulary='List Types',
        default=PublicListTypeDefinition,
        required=True)

    archived = Choice(
        title=_(u"Archival method"),
        description=_(u"When archiving is enabled, all messages sent to "
                      "the list will be saved on the server.  You may "
                      "choose whether to archive just the message text, "
                      "or include attachments."),
        vocabulary="Archive Options",
        default=0,
        required=True,
    )

    private_archives = Choice(
        title=_(u"Privacy"),
        description=_(u"You can choose whether to allow list non-members "
                      "to view the list's archives, or restrict the archives "
                      "to logged-in subscribers."),
        vocabulary="Archive Privacy Options",
        default=False,
        required=True,
    )

    # These methods really belong in an adapter(s), but because we are using
    # MailBoxer they are part of the content object.

    def addMail(message_string):
        """
           Parses a mail message into a string and stores it in the archive
           as an IMailMessage.  Returns the resulting mail message object.
        """

    def checkMail(request):
        """
           Extracts a message from an HTTP request checks its validity.
           Returns None if the mail passes validation, otherwise it returns
           a string describing the error.  Expects a request variable 'Mail'
           containing the mail message with headers.
        """

    def requestMail(request):
        """
           Extracts an (un)subscribe request message from an HTTP request and
           processes it.  Expects a request variable 'Mail' containing the
           mail message with headers.
        """

    def processMail(request):
        """
           Extracts a message from an HTTP request and processes it for the
           mailing list.  Checks the validity of the sender and whether
           moderation is needed.  Expects a request variable 'Mail' containing
           the mail message with headers
        """

    def moderateMail(request):
        """
           Processes an HTTP request for information on what to do with a
           specific mail message in the moderation queue.  Expects the request
           to contain an 'action' ('approve' or 'discard'), a 'pin' used to
           authenticate the moderator, and an 'mid' which is the id of the
           mail object in the moderation queue.  Expects a request variable
           'Mail' containing the mail message with headers
        """

    def bounceMail(request):
        """
           Extracts a bounce message from an HTTP request and processes it to
           note any subscriber addresses that resulted in bounces.
        """

    def resetBounces(addresses):
        """
           Remove specified email addresses from the list of recipients with
           bounced messages.
        """

    def sendCommandRequestMail(address, subject, body):
        """
Example #12
0
class IGrokForm(IGrokView):
    """Grok form API, inspired by zope.formlib's IFormBaseCustomization.

    We explicitly don't inherit from IFormBaseCustomization because
    that would imply ISubPage with another definition of update() and
    render() than IGrokView has.
    """

    prefix = ASCII(
        constraint=reConstraint(
            '[a-zA-Z][a-zA-Z0-9_]*([.][a-zA-Z][a-zA-Z0-9_]*)*',
            "Must be a sequence of not-separated identifiers"),
        description=u"""Page-element prefix

        All named or identified page elements in a subpage should have
        names and identifiers that begin with a subpage prefix
        followed by a dot.
        """,
        readonly=True,
        )

    def setPrefix(prefix):
        """Update the subpage prefix
        """

    label = Attribute("A label to display at the top of a form")

    status = Attribute(
        """An update status message

        This is normally generated by success or failure handlers.
        """)

    errors = Attribute("Sequence of errors encountered during validation")

    form_result = Attribute("Return from action result method")

    form_reset = Attribute(
        """Boolean indicating whether the form needs to be reset
        """)

    form_fields = Attribute(
        """The form's form field definitions

        This attribute is used by many of the default methods.
        """)

    widgets = Attribute(
        """The form's widgets

        - set by setUpWidgets

        - used by validate
        """)

    def setUpWidgets(ignore_request=False):
        """Set up the form's widgets.

        The default implementation uses the form definitions in the
        form_fields attribute and setUpInputWidgets.

        The function should set the widgets attribute.
        """

    def validate(action, data):
        """The default form validator

        If an action is submitted and the action doesn't have it's own
        validator then this function will be called.
        """

    template = Attribute("Template used to display the form")

    def resetForm():
        """Reset any cached data because underlying content may have changed
        """

    def error_views():
        """Return views of any errors.

        The errors are returned as an iterable.
        """

    def applyData(obj, **data):
        """Save form data to an object.