Ignore:
Timestamp:
9 May 2012, 13:39:02 (13 years ago)
Author:
uli
Message:
  • Make IDataCenter a bit more useful.
  • Cut overlong lines.
  • pyflakes.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/interfaces.py

    r8361 r8394  
    2222from datetime import datetime
    2323from hurry.file.interfaces import IFileRetrieval
    24 from hurry.workflow.interfaces import IWorkflow, IWorkflowInfo
     24from hurry.workflow.interfaces import IWorkflowInfo
    2525from zc.sourcefactory.basic import BasicSourceFactory
    2626from zope import schema
     
    3030from zope.component.interfaces import IObjectEvent
    3131from zope.container.interfaces import INameChooser
    32 from zope.interface import Interface, Attribute, implements
     32from zope.interface import Interface, Attribute
    3333from zope.schema.interfaces import IObject
    3434from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm
     
    218218    APP_CATS_DICT = Attribute("Dict of application categories")
    219219    SEMESTER_DICT = Attribute("Dict of semesters or trimesters")
    220     INT_PHONE_PREFIXES = Attribute("Dict of international phone number prefixes")
     220    INT_PHONE_PREFIXES = Attribute(
     221        "Dict of international phone number prefixes")
    221222
    222223    def sendContactForm(
     
    274275        """Mangle `value` extracted from `obj` or suobjects thereof.
    275276
    276         This is called by export before actually writing to the result file.
     277        This is called by export before actually writing to the result
     278        file.
    277279        """
    278280
     
    280282        """Export iterables as rows in a CSV file.
    281283
    282         If `filepath` is not given, a string with the data should be returned.
     284        If `filepath` is not given, a string with the data should be
     285        returned.
    283286
    284287        What kind of iterables are acceptable depends on the specific
     
    289292        """Export all items in `site` as CSV file.
    290293
    291         if `filepath` is not given, a string with the data should be returned.
     294        if `filepath` is not given, a string with the data should be
     295        returned.
    292296        """
    293297
     
    616620    """A data center.
    617621
    618     TODO : declare methods, at least those needed by pages.
    619     """
    620     pass
     622    A data center manages files (uploads, downloads, etc.).
     623
     624    Beside providing the bare paths needed to keep files, it also
     625    provides some helpers to put results of batch processing into
     626    well-defined final locations (with well-defined filenames).
     627
     628    The main use-case is managing of site-related files, i.e. files
     629    for import, export etc.
     630
     631    DataCenters are _not_ meant as storages for object-specific files
     632    like passport photographs and similar.
     633
     634    It is up to the datacenter implementation how to organize data
     635    (paths) inside its storage path.
     636    """
     637    storage = schema.Bytes(
     638        title = u'Path to directory where everything is kept.'
     639        )
     640
     641    deleted_path = schema.Bytes(
     642        title = u'Path were data about deleted objects should be stored.'
     643        )
     644
     645    def getFiles(sort='name'):
     646        """Get a list of files stored in `storage` sorted by basename.
     647        """
     648    def setStoragePath(path, move=False, overwrite=False):
     649        """Set the path where to store files.
     650
     651        If `move` is True, move over files from the current location
     652        to the new one.
     653
     654        If `overwrite` is also True, overwrite any already existing
     655        files of same name in target location.
     656
     657        Triggers a DataCenterStorageMovedEvent.
     658        """
     659
     660    def distProcessedFiles(successful, source_path, finished_file,
     661                           pending_file, mode='create', move_orig=True):
     662        """Distribute processed files over final locations.
     663        """
     664
    621665
    622666class IDataCenterFile(Interface):
     
    10541098    identifier = schema.TextLine(
    10551099        title = _(u'Unique Identifier'),
    1056         description = _(u'User Name, Student or Applicant Id, Matriculation or Registration Number'),
     1100        description = _(
     1101            u'User Name, Student or Applicant Id, Matriculation or '
     1102            u'Registration Number'),
    10571103        required = True,
    10581104        readonly = False,
Note: See TracChangeset for help on using the changeset viewer.