diff --git a/README.txt b/README.txt index 4781468..6e1d6d5 100755 --- a/README.txt +++ b/README.txt @@ -737,7 +737,9 @@ on data provided in this form: >>> component.provideAdapter(NameChooser) >>> request = TestRequest(form={'title': u'Test Note', - ... 'form.type': u'.loops/concepts/note'}) + ... 'form.type': u'.loops/concepts/note', + ... 'contentType': u'text/restructured', + ... 'linkUrl': u'http://'}) >>> view = NodeView(m112, request) >>> cont = CreateObject(view, request) >>> cont.update() @@ -802,7 +804,7 @@ The new technique uses the ``fields`` and ``data`` attributes... linkText textline False None >>> view.data - {'linkUrl': u'http://', 'contentType': 'text/restructured', 'data': u'', + {'linkUrl': u'http://', 'contentType': u'text/restructured', 'data': u'', 'linkText': u'', 'title': u'Test Note'} The object is changed via a FormController adapter created for diff --git a/classifier/base.py b/classifier/base.py index 58dcc37..a71d12e 100644 --- a/classifier/base.py +++ b/classifier/base.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2007 Helmut Merz helmutm@cy55.de +# Copyright (c) 2015 Helmut Merz helmutm@cy55.de # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -18,8 +18,6 @@ """ Adapters and others classes for analyzing resources. - -$Id$ """ from itertools import tee @@ -41,6 +39,7 @@ from loops.resource import Resource from loops.setup import addAndConfigureObject from loops.type import TypeInterfaceSourceList +logger = getLogger('Classifier') TypeInterfaceSourceList.typeInterfaces += (IClassifier,) @@ -102,15 +101,15 @@ class Classifier(AdapterBase): if resource not in resources: concept.assignResource(resource, predicate) message = u'Assigning: %s %s %s' + self.log(message % (resource.title, predicate.title, concept.title), 5) else: message = u'Already assigned: %s %s %s' - self.log(message % (resource.title, predicate.title, concept.title), 4) + self.log(message % (resource.title, predicate.title, concept.title), 4) def log(self, message, level=5): if level >= self.logLevel: #print 'Classifier %s:' % getName(self.context), message - getLogger('Classifier').info( - u'%s: %s' % (getName(self.context), message)) + logger.info(u'%s: %s' % (getName(self.context), message)) class Extractor(object): diff --git a/classifier/browser.py b/classifier/browser.py index 3ef92a5..e0fc935 100644 --- a/classifier/browser.py +++ b/classifier/browser.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2007 Helmut Merz helmutm@cy55.de +# Copyright (c) 2015 Helmut Merz helmutm@cy55.de # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -18,17 +18,20 @@ """ View class(es) for resource classifiers. - -$Id$ """ +from logging import getLogger +import transaction from zope import interface, component from zope.app.pagetemplate import ViewPageTemplateFile from zope.cachedescriptors.property import Lazy +from zope.traversing.api import getName from loops.browser.concept import ConceptView from loops.common import adapted +logger = getLogger('ClassifierView') + class ClassifierView(ConceptView): @@ -42,12 +45,18 @@ class ClassifierView(ConceptView): if 'update' in self.request.form: cta = adapted(self.context) if cta is not None: - for r in collectResources(self.context): + for idx, r in enumerate(collectResources(self.context)): + if idx % 1000 == 0: + logger.info('Committing, resource # %s' % idx) + transaction.commit() cta.process(r) + logger.info('Finished processing') + transaction.commit() return True def collectResources(concept, checkedConcepts=None, result=None): + logger.info('Start collecting resources for %s' % getName(concept)) if result is None: result = [] if checkedConcepts is None: @@ -59,4 +68,5 @@ def collectResources(concept, checkedConcepts=None, result=None): if c not in checkedConcepts: checkedConcepts.append(c) collectResources(c, checkedConcepts, result) + logger.info('Collected %s resources' % len(result)) return result diff --git a/locales/de/LC_MESSAGES/loops.mo b/locales/de/LC_MESSAGES/loops.mo index ed80ed5..2d67f48 100644 Binary files a/locales/de/LC_MESSAGES/loops.mo and b/locales/de/LC_MESSAGES/loops.mo differ diff --git a/locales/de/LC_MESSAGES/loops.po b/locales/de/LC_MESSAGES/loops.po index 4c82808..5c3bd65 100644 --- a/locales/de/LC_MESSAGES/loops.po +++ b/locales/de/LC_MESSAGES/loops.po @@ -3,7 +3,7 @@ msgstr "" "Project-Id-Version: 0.13.1\n" "POT-Creation-Date: 2007-05-22 12:00 CET\n" -"PO-Revision-Date: 2015-06-06 12:00 CET\n" +"PO-Revision-Date: 2015-09-22 12:00 CET\n" "Last-Translator: Helmut Merz \n" "Language-Team: loops developers \n" "MIME-Version: 1.0\n" @@ -597,9 +597,6 @@ msgstr "Informationen über dieses Objekt" msgid "Information about this object." msgstr "Informationen über dieses Objekt." -msgid "Send a link to this object by email." -msgstr "Einen Link zu diesem Objekt per E-Mail versenden." - msgid "Edit with external editor." msgstr "Mit 'External Editor' bearbeiten." @@ -1416,3 +1413,27 @@ msgstr "Zeitraum" msgid "Technology" msgstr "Technik" + +# send mail + +msgid "Send a link to this object by email." +msgstr "Einen Link zu diesem Objekt per E-Mail versenden." + +msgid "Send Link by Email" +msgstr "Link per E-Mail versenden" + +msgid "Mail Subject" +msgstr "Betreff" + +msgid "Mail Body" +msgstr "Text" + +msgid "Recipients" +msgstr "Empfänger" + +msgid "Additional Recipients" +msgstr "Weitere Empfänger" + +msgid "Send email" +msgstr "E-Mail senden" + diff --git a/organize/browser/party.py b/organize/browser/party.py index afcf656..6e8a3d4 100644 --- a/organize/browser/party.py +++ b/organize/browser/party.py @@ -175,6 +175,10 @@ class SendEmailForm(NodeView): @Lazy def subject(self): + optionKey = 'organize.sendmail_subject' + option = self.globalOptions(optionKey) or self.typeOptions(optionKey) + if option: + return option[0] menu = self.context.getMenu() zdc = IZopeDublinCore(menu) zdc.languageInfo = self.languageInfo @@ -185,6 +189,8 @@ class SendEmailForm(NodeView): class SendEmail(FormController): + bccToSender = False + def checkPermissions(self): return (not self.isAnonymous and super(SendEmail, self).checkPermissions()) @@ -201,7 +207,10 @@ class SendEmail(FormController): msg = MIMEText(message.encode('utf-8'), 'plain', 'utf-8') msg['Subject'] = subject.encode('utf-8') msg['From'] = sender - msg['To'] = ', '.join(r.strip() for r in recipients if r.strip()) + recipients = [r.strip() for r in recipients if r.strip()] + msg['To'] = ', '.join(recipients) + if self.bccToSender: + recipients.append(sender) mailhost = component.getUtility(IMailDelivery, 'Mail') mailhost.send(sender, recipients, msg.as_string()) return True diff --git a/organize/browser/view_macros.pt b/organize/browser/view_macros.pt index 551933a..bee5d4c 100644 --- a/organize/browser/view_macros.pt +++ b/organize/browser/view_macros.pt @@ -125,14 +125,15 @@
- +
- +