Changeset 7811 for main/waeup.kofa/trunk/src/waeup/kofa/utils
- Timestamp:
- 8 Mar 2012, 19:00:51 (13 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/utils
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/utils/api.txt
r4973 r7811 1 :mod:`waeup. sirp.utils` -- misc. helpers1 :mod:`waeup.kofa.utils` -- misc. helpers 2 2 **************************************** 3 3 4 .. module:: waeup. sirp.utils4 .. module:: waeup.kofa.utils 5 5 6 6 Components and other stuff of general interest. … … 9 9 ========== 10 10 11 The :mod:`waeup. sirp.utils` module provides the following submodules:11 The :mod:`waeup.kofa.utils` module provides the following submodules: 12 12 13 13 .. toctree:: -
main/waeup.kofa/trunk/src/waeup/kofa/utils/batching.py
r7649 r7811 16 16 ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 17 ## 18 """ SIRPcomponents for batch processing.18 """KOFA components for batch processing. 19 19 20 20 Batch processors eat CSV files to add, update or remove large numbers … … 31 31 from zope.interface import Interface 32 32 from zope.schema import getFields 33 from waeup. sirp.interfaces import (33 from waeup.kofa.interfaces import ( 34 34 IBatchProcessor, FatalCSVError, DuplicationError, IObjectConverter) 35 35 -
main/waeup.kofa/trunk/src/waeup/kofa/utils/batching.txt
r6824 r7811 1 :mod:`waeup. sirp.utils.batching` -- Batch processing1 :mod:`waeup.kofa.utils.batching` -- Batch processing 2 2 **************************************************** 3 3 … … 188 188 All we need, is a batch processor now. 189 189 190 >>> from waeup. sirp.utils.batching import BatchProcessor190 >>> from waeup.kofa.utils.batching import BatchProcessor 191 191 >>> class CaveProcessor(BatchProcessor): 192 192 ... util_name = 'caveprocessor' -
main/waeup.kofa/trunk/src/waeup/kofa/utils/converters.py
r7709 r7811 27 27 from zope.interface import Interface 28 28 from zope.publisher.browser import TestRequest 29 from waeup. sirp.interfaces import IObjectConverter29 from waeup.kofa.interfaces import IObjectConverter 30 30 31 31 class ExtendedCheckBoxWidget(CheckBoxWidget): -
main/waeup.kofa/trunk/src/waeup/kofa/utils/converters.txt
r7321 r7811 1 :mod:`waeup. sirp.utils.converters` -- Converters1 :mod:`waeup.kofa.utils.converters` -- Converters 2 2 ************************************************ 3 3 4 .. module:: waeup. sirp.utils.converters4 .. module:: waeup.kofa.utils.converters 5 5 6 6 Converters for :mod:`zope.schema` based data. … … 10 10 11 11 .. :NOdoctest: 12 .. :NOlayer: waeup. sirp.testing.SIRPUnitTestLayer12 .. :NOlayer: waeup.kofa.testing.KOFAUnitTestLayer 13 13 14 14 … … 21 21 'non-values'. Current setting is: 22 22 23 >>> from waeup. sirp.utils.converters import NONE_STRING_VALUE23 >>> from waeup.kofa.utils.converters import NONE_STRING_VALUE 24 24 >>> NONE_STRING_VALUE 25 25 '' … … 32 32 ======== 33 33 34 The :mod:`waeup. sirp.utils.converters` module is basically a collection of34 The :mod:`waeup.kofa.utils.converters` module is basically a collection of 35 35 adapters for field types of :mod:`zope.schema`. 36 36 … … 48 48 `zope.schema.Choice` or similar. 49 49 50 .. method:: provides(waeup. sirp.interfaces.ISchemaTypeConverter)50 .. method:: provides(waeup.kofa.interfaces.ISchemaTypeConverter) 51 51 52 52 .. method:: _convertValueFromString(string) … … 111 111 .. method:: adapts(zope.schema.IText) 112 112 113 .. method:: provides(waeup. sirp.interfaces.ISchemaTypeConverter)113 .. method:: provides(waeup.kofa.interfaces.ISchemaTypeConverter) 114 114 115 115 .. method:: fromString(string[, strict=True]) … … 150 150 .. method:: adapts(zope.schema.IBool) 151 151 152 .. method:: provides(waeup. sirp.interfaces.ISchemaTypeConverter)152 .. method:: provides(waeup.kofa.interfaces.ISchemaTypeConverter) 153 153 154 154 .. method:: fromString(string[, strict=True]) … … 191 191 .. method:: adapts(zope.schema.IInt) 192 192 193 .. method:: provides(waeup. sirp.interfaces.ISchemaTypeConverter)193 .. method:: provides(waeup.kofa.interfaces.ISchemaTypeConverter) 194 194 195 195 .. method:: fromString(string[, strict=True]) … … 232 232 .. method:: adapts(zope.schema.IChoice) 233 233 234 .. method:: provides(waeup. sirp.interfaces.ISchemaTypeConverter)234 .. method:: provides(waeup.kofa.interfaces.ISchemaTypeConverter) 235 235 236 236 .. method:: fromString(string[, strict=False]) … … 272 272 ---------------------- 273 273 274 .. autoclass:: waeup. sirp.utils.converters.DateConverter274 .. autoclass:: waeup.kofa.utils.converters.DateConverter 275 275 :members: 276 276 :inherited-members: … … 294 294 :class:`TextConverter` instance: 295 295 296 >>> from waeup. sirp.utils.converters import TextConverter296 >>> from waeup.kofa.utils.converters import TextConverter 297 297 >>> converter = TextConverter(field) 298 298 299 299 Or we can just grab a registered adapter: 300 300 301 >>> from waeup. sirp.interfaces import ISchemaTypeConverter301 >>> from waeup.kofa.interfaces import ISchemaTypeConverter 302 302 >>> converter = ISchemaTypeConverter(field) 303 303 … … 305 305 306 306 >>> converter 307 <waeup. sirp.utils.converters.TextConverter object at 0x...>307 <waeup.kofa.utils.converters.TextConverter object at 0x...> 308 308 309 309 Now we can convert strings to this type: … … 382 382 :class:`BoolConverter` instance: 383 383 384 >>> from waeup. sirp.utils.converters import BoolConverter384 >>> from waeup.kofa.utils.converters import BoolConverter 385 385 >>> converter = BoolConverter(field) 386 386 387 387 Or we can just grab a registered adapter: 388 388 389 >>> from waeup. sirp.interfaces import ISchemaTypeConverter389 >>> from waeup.kofa.interfaces import ISchemaTypeConverter 390 390 >>> converter = ISchemaTypeConverter(field) 391 391 … … 393 393 394 394 >>> converter 395 <waeup. sirp.utils.converters.BoolConverter object at 0x...>395 <waeup.kofa.utils.converters.BoolConverter object at 0x...> 396 396 397 397 Now we can convert strings to this type: … … 494 494 :class:`IntConverter` instance: 495 495 496 >>> from waeup. sirp.utils.converters import IntConverter496 >>> from waeup.kofa.utils.converters import IntConverter 497 497 >>> converter = IntConverter(field) 498 498 499 499 Or we can just grab a registered adapter: 500 500 501 >>> from waeup. sirp.interfaces import ISchemaTypeConverter501 >>> from waeup.kofa.interfaces import ISchemaTypeConverter 502 502 >>> converter = ISchemaTypeConverter(field) 503 503 … … 505 505 506 506 >>> converter 507 <waeup. sirp.utils.converters.IntConverter object at 0x...>507 <waeup.kofa.utils.converters.IntConverter object at 0x...> 508 508 509 509 Now we can convert strings to this type: … … 597 597 :class:`ChoiceConverter` instance: 598 598 599 >>> from waeup. sirp.utils.converters import ChoiceConverter599 >>> from waeup.kofa.utils.converters import ChoiceConverter 600 600 >>> converter = ChoiceConverter(field) 601 601 602 602 Or we can just grab a registered adapter: 603 603 604 >>> from waeup. sirp.interfaces import ISchemaTypeConverter604 >>> from waeup.kofa.interfaces import ISchemaTypeConverter 605 605 >>> converter = ISchemaTypeConverter(field) 606 606 … … 608 608 609 609 >>> converter 610 <waeup. sirp.utils.converters.ChoiceConverter object at 0x...>610 <waeup.kofa.utils.converters.ChoiceConverter object at 0x...> 611 611 612 612 Now we can convert strings to this type: … … 672 672 '1' 673 673 674 >>> from waeup. sirp.interfaces import SimpleSIRPVocabulary674 >>> from waeup.kofa.interfaces import SimpleKOFAVocabulary 675 675 >>> field = Choice( 676 676 ... title = u'Favourite Dish', 677 677 ... default = 0, 678 ... vocabulary = Simple SIRPVocabulary(678 ... vocabulary = SimpleKOFAVocabulary( 679 679 ... ('N/A', 0), ('Pizza', 1), 680 680 ... ('Cake', 2), ('Muffins', 3)), … … 730 730 731 731 We get a converter for this field in the usual way. The 732 :meth:`waeup. sirp.utils.converters.fromString()` method will return one of732 :meth:`waeup.kofa.utils.converters.fromString()` method will return one of 733 733 the objects if we feed it with ``'Wilma'`` or ``'Fred'``: 734 734 … … 763 763 :class:`IntConverter` instance: 764 764 765 >>> from waeup. sirp.utils.converters import DateConverter765 >>> from waeup.kofa.utils.converters import DateConverter 766 766 >>> converter = DateConverter(field) 767 767 768 768 Or we can just grab a registered adapter: 769 769 770 >>> from waeup. sirp.interfaces import ISchemaTypeConverter770 >>> from waeup.kofa.interfaces import ISchemaTypeConverter 771 771 >>> converter = ISchemaTypeConverter(field) 772 772 … … 774 774 775 775 >>> converter 776 <waeup. sirp.utils.converters.DateConverter object at 0x...>776 <waeup.kofa.utils.converters.DateConverter object at 0x...> 777 777 778 778 Now we can convert strings to this type: -
main/waeup.kofa/trunk/src/waeup/kofa/utils/helpers.py
r7359 r7811 16 16 ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 17 ## 18 """General helper functions for SIRP.18 """General helper functions for KOFA. 19 19 """ 20 20 import os … … 151 151 instances of certain classes when called. 152 152 153 In :mod:`waeup. sirp` we use factories extensively for153 In :mod:`waeup.kofa` we use factories extensively for 154 154 batching. While processing a batch some importer looks up a 155 155 factory to create real-world instances that then get filled with … … 163 163 164 164 >>> import grok 165 >>> from waeup. sirp.utils.helpers import FactoryBase165 >>> from waeup.kofa.utils.helpers import FactoryBase 166 166 >>> class MyObject(object): 167 167 ... # Some class we want to get instances of. … … 169 169 >>> class MyObjectFactory(FactoryBase): 170 170 ... # This is the factory for MyObject instances 171 ... grok.name(u'waeup. sirp.factory.MyObject')171 ... grok.name(u'waeup.kofa.factory.MyObject') 172 172 ... factory = MyObject 173 173 … … 176 176 called. The given name must even be unique amongst all utilities 177 177 registered during runtime. While you can pick any name you like 178 you might want to prepend ``waeup. sirp.factory.`` to the name178 you might want to prepend ``waeup.kofa.factory.`` to the name 179 179 string to make sure it does not clash with names of other 180 180 utilities one day. … … 183 183 freshly defined factory. This executes all the component 184 184 registration stuff we don't want to do ourselves. In daily use 185 this is done automatically on startup of a :mod:`waeup. sirp`185 this is done automatically on startup of a :mod:`waeup.kofa` 186 186 system. 187 187 188 >>> grok.testing.grok('waeup. sirp.utils.helpers')188 >>> grok.testing.grok('waeup.kofa.utils.helpers') 189 189 >>> grok.testing.grok_component( 190 190 ... 'MyObjectFactory', MyObjectFactory … … 197 197 198 198 >>> from zope.component import createObject 199 >>> obj = createObject('waeup. sirp.factory.MyObject')199 >>> obj = createObject('waeup.kofa.factory.MyObject') 200 200 >>> isinstance(obj, MyObject) 201 201 True … … 207 207 >>> from zope.component.interfaces import IFactory 208 208 >>> factory = getUtility( 209 ... IFactory, name='waeup. sirp.factory.MyObject'209 ... IFactory, name='waeup.kofa.factory.MyObject' 210 210 ... ) 211 211 >>> isinstance(factory, MyObjectFactory) … … 251 251 HTML code: 252 252 253 >>> from waeup. sirp.utils.helpers import ReST2HTML253 >>> from waeup.kofa.utils.helpers import ReST2HTML 254 254 >>> source = ''' 255 255 ... Headline -
main/waeup.kofa/trunk/src/waeup/kofa/utils/helpers.txt
r7496 r7811 1 :mod:`waeup. sirp.utils.helpers` -- Helpers for SIRP1 :mod:`waeup.kofa.utils.helpers` -- Helpers for KOFA 2 2 *************************************************** 3 3 4 .. module:: waeup. sirp.utils.helpers5 6 Helper functions for SIRP.4 .. module:: waeup.kofa.utils.helpers 5 6 Helper functions for KOFA. 7 7 8 8 .. :doctest: … … 21 21 >>> os.chdir(new_location) 22 22 23 >>> from waeup. sirp.utils.helpers import remove_file_or_directory23 >>> from waeup.kofa.utils.helpers import remove_file_or_directory 24 24 >>> open('blah', 'wb').write('nonsense') 25 25 >>> 'blah' in os.listdir('.') … … 72 72 >>> open(os.path.join('src', 'blah'), 'wb').write('nonsense') 73 73 74 >>> from waeup. sirp.utils.helpers import copy_filesystem_tree74 >>> from waeup.kofa.utils.helpers import copy_filesystem_tree 75 75 >>> result = copy_filesystem_tree('src', 'dst') 76 76 … … 179 179 returned with all preceeding/following stuff stripped: 180 180 181 >>> from waeup. sirp.utils.helpers import get_inner_HTML_part181 >>> from waeup.kofa.utils.helpers import get_inner_HTML_part 182 182 >>> print get_inner_HTML_part("""<html> 183 183 ... <head> -
main/waeup.kofa/trunk/src/waeup/kofa/utils/importexport.py
r7321 r7811 22 22 from cStringIO import StringIO 23 23 from zope.interface import Interface 24 from waeup. sirp.interfaces import (ISIRPObject, ISIRPExporter,25 I SIRPXMLExporter, ISIRPXMLImporter)24 from waeup.kofa.interfaces import (IKOFAObject, IKOFAExporter, 25 IKOFAXMLExporter, IKOFAXMLImporter) 26 26 27 27 def readFile(f): … … 40 40 41 41 class Exporter(grok.Adapter): 42 """Export a SIRPobject as pickle.42 """Export a KOFA object as pickle. 43 43 44 44 This all-purpose exporter exports attributes defined in schemata 45 45 and contained objects (if the exported thing is a container). 46 46 """ 47 grok.context(I SIRPObject)48 grok.provides(I SIRPExporter)47 grok.context(IKOFAObject) 48 grok.provides(IKOFAExporter) 49 49 50 50 def __init__(self, context): … … 61 61 62 62 class XMLExporter(grok.Adapter): 63 """Export a SIRPobject as XML.63 """Export a KOFA object as XML. 64 64 65 65 This all-purpose exporter exports XML representations of pickable … … 67 67 """ 68 68 grok.context(Interface) 69 grok.provides(I SIRPXMLExporter)69 grok.provides(IKOFAXMLExporter) 70 70 71 71 def __init__(self, context): 72 72 self.context = context 73 73 74 74 def export(self, filepath=None): 75 75 pickled_obj = cPickle.dumps(self.context) … … 84 84 85 85 class XMLImporter(grok.Adapter): 86 """Import a SIRPobject from XML.86 """Import a KOFA object from XML. 87 87 """ 88 88 grok.context(Interface) 89 grok.provides(I SIRPXMLImporter)89 grok.provides(IKOFAXMLImporter) 90 90 91 91 def __init__(self, context): 92 92 self.context = context 93 93 94 94 def doImport(self, filepath): 95 95 xml = None -
main/waeup.kofa/trunk/src/waeup/kofa/utils/importexport.txt
r7321 r7811 6 6 7 7 .. :doctest: 8 .. :layer: waeup. sirp.testing.SIRPUnitTestLayer8 .. :layer: waeup.kofa.testing.KOFAUnitTestLayer 9 9 10 10 As imports and exports of data are a cruical point when doing updates … … 60 60 an exporter:: 61 61 62 >>> from waeup. sirp.interfaces import ISIRPXMLExporter63 >>> exporter = I SIRPXMLExporter(mycave)62 >>> from waeup.kofa.interfaces import IKOFAXMLExporter 63 >>> exporter = IKOFAXMLExporter(mycave) 64 64 >>> exporter 65 <waeup. sirp.utils.importexport.XMLExporter object at 0x...>65 <waeup.kofa.utils.importexport.XMLExporter object at 0x...> 66 66 67 67 All exporters provide an ``export(<obj>)`` method:: … … 101 101 Now we create an importer for that object: 102 102 103 >>> from waeup. sirp.interfaces import ISIRPXMLImporter104 >>> importer = I SIRPXMLImporter(mycave)103 >>> from waeup.kofa.interfaces import IKOFAXMLImporter 104 >>> importer = IKOFAXMLImporter(mycave) 105 105 106 106 Importing from filenames -
main/waeup.kofa/trunk/src/waeup/kofa/utils/logger.py
r7651 r7811 19 19 Convenience stuff for logging. 20 20 21 Main component of :mod:`waeup. sirp.utils.logging` is a mix-in class22 :class:`waeup. sirp.utils.logging.Logger`. Classes derived (also) from21 Main component of :mod:`waeup.kofa.utils.logging` is a mix-in class 22 :class:`waeup.kofa.utils.logging.Logger`. Classes derived (also) from 23 23 that mix-in provide a `logger` attribute that returns a regular Python 24 24 logger logging to a rotating log file stored in the datacenter storage … … 30 30 The `logger_name` tells under which name the logger should be 31 31 registered Python-wise. This is usually a dotted name string like 32 ``waeup. sirp.${sitename}.mycomponent`` which should be unique. If you32 ``waeup.kofa.${sitename}.mycomponent`` which should be unique. If you 33 33 pick a name already used by another component, trouble is ahead. The 34 34 ``${sitename}`` chunk of the name can be set literally like this. The … … 46 46 your `logger_name` and `logger_filename` attribute and off you go:: 47 47 48 from waeup. sirp.utils.logger import Logger48 from waeup.kofa.utils.logger import Logger 49 49 50 50 class MyComponent(object, Logger): 51 51 # Yes that's a complete working class 52 logger_name = 'waeup. sirp.${sitename}.mycomponent52 logger_name = 'waeup.kofa.${sitename}.mycomponent 53 53 logger_filename = 'mycomponent.log' 54 54 … … 67 67 68 68 The datacenter and its storage are created automatically when you 69 create a :class:`waeup. sirp.app.University`. This also means that69 create a :class:`waeup.kofa.app.University`. This also means that 70 70 logging with the `Logger` mix-in will work only inside so-called sites 71 71 (`University` instances put into ZODB are such `sites`). … … 80 80 from zope.component import queryUtility 81 81 from zope.interface import Interface, Attribute, implements 82 from waeup. sirp.interfaces import (82 from waeup.kofa.interfaces import ( 83 83 IDataCenter, IDataCenterStorageMovedEvent, ILoggerCollector) 84 from waeup. sirp.utils.helpers import get_current_principal84 from waeup.kofa.utils.helpers import get_current_principal 85 85 86 86 #: Default logfile size (5 KB) … … 152 152 153 153 #: The Python logger name used when 154 #: logging. ``'waeup. sirp.${sitename}'`` by default. You can use the154 #: logging. ``'waeup.kofa.${sitename}'`` by default. You can use the 155 155 #: ``${sitename}`` placeholder in that string, which will be 156 156 #: replaced by the actual used site name. 157 logger_name = 'waeup. sirp.${sitename}'157 logger_name = 'waeup.kofa.${sitename}' 158 158 implements(ILogger) 159 159 … … 378 378 return 379 379 380 from waeup. sirp.interfaces import IUniversity380 from waeup.kofa.interfaces import IUniversity 381 381 @grok.subscribe(IUniversity, grok.IObjectRemovedEvent) 382 382 def handle_site_removed(obj, event): -
main/waeup.kofa/trunk/src/waeup/kofa/utils/tests/test_batching.py
r7196 r7811 27 27 from zope.component.interfaces import IFactory 28 28 from zope.interface import Interface, implements 29 from waeup. sirp.app import University30 from waeup. sirp.testing import FunctionalLayer, FunctionalTestCase29 from waeup.kofa.app import University 30 from waeup.kofa.testing import FunctionalLayer, FunctionalTestCase 31 31 32 32 optionflags = ( … … 71 71 stoneville = dict 72 72 73 from waeup. sirp.utils.batching import BatchProcessor73 from waeup.kofa.utils.batching import BatchProcessor 74 74 class CaveProcessor(BatchProcessor): 75 75 util_name = 'caveprocessor' -
main/waeup.kofa/trunk/src/waeup/kofa/utils/tests/test_converters.py
r7649 r7811 31 31 Interface, implements, invariant, Invalid, implementedBy) 32 32 33 from waeup. sirp.app import University34 from waeup. sirp.testing import FunctionalLayer, FunctionalTestCase35 from waeup. sirp.university import Faculty36 from waeup. sirp.utils.converters import IObjectConverter37 from waeup. sirp.utils.helpers import attrs_to_fields38 from waeup. sirp.interfaces import SimpleSIRPVocabulary39 40 colors = Simple SIRPVocabulary(33 from waeup.kofa.app import University 34 from waeup.kofa.testing import FunctionalLayer, FunctionalTestCase 35 from waeup.kofa.university import Faculty 36 from waeup.kofa.utils.converters import IObjectConverter 37 from waeup.kofa.utils.helpers import attrs_to_fields 38 from waeup.kofa.interfaces import SimpleKOFAVocabulary 39 40 colors = SimpleKOFAVocabulary( 41 41 ('Red', u'red'), 42 42 ('Green', u'green'), 43 43 ('Blue', u'blue'), 44 44 ) 45 car_nums = Simple SIRPVocabulary(45 car_nums = SimpleKOFAVocabulary( 46 46 ('None', 0), 47 47 ('One', 1), -
main/waeup.kofa/trunk/src/waeup/kofa/utils/tests/test_doctests.py
r7196 r7811 18 18 """Register doctests from utils subpackage. 19 19 """ 20 from waeup. sirp.testing import get_doctest_suite20 from waeup.kofa.testing import get_doctest_suite 21 21 22 22 def test_suite(): -
main/waeup.kofa/trunk/src/waeup/kofa/utils/tests/test_helpers.py
r7196 r7811 27 27 from zope.security.testing import Principal, Participation 28 28 from zope.security.management import newInteraction, endInteraction 29 from waeup. sirp.utils import helpers29 from waeup.kofa.utils import helpers 30 30 31 31 from zope.interface import Interface, implements -
main/waeup.kofa/trunk/src/waeup/kofa/utils/tests/test_logger.py
r7651 r7811 17 17 ## 18 18 19 # Tests for waeup. sirp.utils.logger19 # Tests for waeup.kofa.utils.logger 20 20 import logging 21 21 import os … … 25 25 from zope.component.hooks import setSite, clearSite 26 26 from zope.interface.verify import verifyClass, verifyObject 27 from waeup. sirp.app import University28 from waeup. sirp.testing import FunctionalLayer, FunctionalTestCase29 30 from waeup. sirp.utils.logger import (27 from waeup.kofa.app import University 28 from waeup.kofa.testing import FunctionalLayer, FunctionalTestCase 29 30 from waeup.kofa.utils.logger import ( 31 31 Logger, MAX_BYTES, BACKUP_COUNT, ILoggerCollector, LoggerCollector, 32 32 ILogger) -
main/waeup.kofa/trunk/src/waeup/kofa/utils/utils.py
r7744 r7811 16 16 ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 17 ## 18 """General helper utilities for SIRP.18 """General helper utilities for KOFA. 19 19 """ 20 20 import os … … 23 23 from zope.i18n import translate 24 24 from random import SystemRandom as r 25 from waeup. sirp.interfaces import ISIRPUtils26 from waeup. sirp.interfaces import MessageFactory as _27 from waeup. sirp.smtp import send_mail as send_mail_internally25 from waeup.kofa.interfaces import IKOFAUtils 26 from waeup.kofa.interfaces import MessageFactory as _ 27 from waeup.kofa.smtp import send_mail as send_mail_internally 28 28 29 29 def send_mail(from_name,from_addr,rcpt_name,rcpt_addr,subject,body,config): 30 """Wrapper for the real SMTP functionality in :mod:`waeup. sirp.smtp`.30 """Wrapper for the real SMTP functionality in :mod:`waeup.kofa.smtp`. 31 31 32 32 Merely here to stay compatible with lots of calls to this place. … … 37 37 return True 38 38 39 class SIRPUtils(grok.GlobalUtility):39 class KOFAUtils(grok.GlobalUtility): 40 40 """A collection of parameters and methods subject to customization. 41 41 """ 42 grok.implements(I SIRPUtils)42 grok.implements(IKOFAUtils) 43 43 # This the only place where we define the portal language 44 44 # which is used for the translation of system messages … … 131 131 'd':portal, 132 132 'e':body}) 133 body = translate(text, 'waeup. sirp',133 body = translate(text, 'waeup.kofa', 134 134 target_language=self.PORTAL_LANGUAGE) 135 135 return send_mail( … … 161 161 Returns True or False to indicate successful operation. 162 162 """ 163 subject = 'Your SIRPcredentials'163 subject = 'Your KOFA credentials' 164 164 text = _(u"""Dear ${a}, 165 165 … … 193 193 'f':login_url}) 194 194 195 body = translate(text, 'waeup. sirp',195 body = translate(text, 'waeup.kofa', 196 196 target_language=self.PORTAL_LANGUAGE) 197 197 return send_mail(
Note: See TracChangeset for help on using the changeset viewer.