source: main/waeup.sirp/branches/henrik-bootstrap/src/waeup/sirp/interfaces.py @ 9676

Last change on this file since 9676 was 7457, checked in by Henrik Bettermann, 13 years ago

Beautify user pages.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 26.0 KB
Line 
1## $Id: interfaces.py 7457 2012-01-12 12:25:33Z henrik $
2##
3## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann
4## This program is free software; you can redistribute it and/or modify
5## it under the terms of the GNU General Public License as published by
6## the Free Software Foundation; either version 2 of the License, or
7## (at your option) any later version.
8##
9## This program is distributed in the hope that it will be useful,
10## but WITHOUT ANY WARRANTY; without even the implied warranty of
11## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12## GNU General Public License for more details.
13##
14## You should have received a copy of the GNU General Public License
15## along with this program; if not, write to the Free Software
16## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17##
18import os
19import re
20from datetime import datetime
21from hurry.file.interfaces import IFileRetrieval
22from hurry.workflow.interfaces import IWorkflow, IWorkflowInfo
23from zc.sourcefactory.basic import BasicSourceFactory
24from zope import schema
25from zope.pluggableauth.interfaces import IPrincipalInfo
26from zope.security.interfaces import IGroupClosureAwarePrincipal as IPrincipal
27from zope.component import getUtility
28from zope.component.interfaces import IObjectEvent
29from zope.container.interfaces import INameChooser
30from zope.interface import Interface, Attribute, implements
31from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm
32
33CREATED = 'created'
34ADMITTED = 'admitted'
35CLEARANCE = 'clearance started'
36REQUESTED = 'clearance requested'
37CLEARED = 'cleared'
38PAID = 'school fee paid'
39RETURNING = 'returning'
40REGISTERED = 'courses registered'
41VALIDATED = 'courses validated'
42
43default_frontpage = u'' + open(os.path.join(
44        os.path.dirname(__file__), 'frontpage.rst'), 'rb').read()
45
46def SimpleSIRPVocabulary(*terms):
47    """A well-buildt vocabulary provides terms with a value, token and
48       title for each term
49    """
50    return SimpleVocabulary([
51            SimpleTerm(value, value, title) for title, value in terms])
52
53def year_range():
54    curr_year = datetime.now().year
55    return range(curr_year - 4, curr_year + 5)
56
57def academic_sessions():
58    curr_year = datetime.now().year
59    year_range = range(curr_year - 10, curr_year + 2)
60    return [('%s/%s' % (year,year+1), year) for year in year_range]
61
62academic_sessions_vocab = SimpleSIRPVocabulary(*academic_sessions())
63
64registration_states_vocab = SimpleSIRPVocabulary(
65    ('created', CREATED),
66    ('admitted', ADMITTED),
67    ('clearance started', CLEARANCE),
68    ('clearance requested', REQUESTED),
69    ('cleared', CLEARED),
70    ('school fee paid', PAID),
71    ('returning', RETURNING),
72    ('courses registered', REGISTERED),
73    ('courses validated', VALIDATED),
74    )
75
76# Define a valiation method for email addresses
77class NotAnEmailAddress(schema.ValidationError):
78    __doc__ = u"Invalid email address"
79
80check_email = re.compile(
81    r"[a-zA-Z0-9._%-]+@([a-zA-Z0-9-]+.)*[a-zA-Z]{2,4}").match
82
83def validate_email(value):
84    if not check_email(value):
85        raise NotAnEmailAddress(value)
86    return True
87
88class FatalCSVError(Exception):
89    """Some row could not be processed.
90    """
91    pass
92
93class DuplicationError(Exception):
94    """An exception that can be raised when duplicates are found.
95
96    When raising :exc:`DuplicationError` you can, beside the usual
97    message, specify a list of objects which are duplicates. These
98    values can be used by catching code to print something helpful or
99    similar.
100    """
101    def __init__(self, msg, entries=[]):
102        self.msg = msg
103        self.entries = entries
104
105    def __str__(self):
106        return '%r' % self.msg
107
108class RoleSource(BasicSourceFactory):
109    """A source for site roles.
110    """
111    def getValues(self):
112        # late import: in interfaces we should not import local modules
113        from waeup.sirp.permissions import get_waeup_role_names
114        return get_waeup_role_names()
115
116    def getTitle(self, value):
117        # late import: in interfaces we should not import local modules
118        from waeup.sirp.permissions import get_all_roles
119        roles = dict(get_all_roles())
120        if value in roles.keys():
121            title = roles[value].title
122            if '.' in title:
123                title = title.split('.', 2)[1]
124        return title
125
126class CaptchaSource(BasicSourceFactory):
127    """A source for captchas.
128    """
129    def getValues(self):
130        captchas = ['No captcha', 'Testing captcha', 'ReCaptcha']
131        try:
132            # we have to 'try' because IConfiguration can only handle
133            # interfaces from w.s.interface.
134            from waeup.sirp.browser.interfaces import ICaptchaManager
135        except:
136            return captchas
137        return sorted(getUtility(ICaptchaManager).getAvailCaptchas().keys())
138
139    def getTitle(self, value):
140        return value
141
142class ISIRPUtils(Interface):
143    """A collection of methods which are subject to customization.
144    """
145    def sendContactForm(
146          from_name,from_addr,rcpt_name,rcpt_addr,
147          from_username,usertype,portal,body,subject):
148        """Send an email with data provided by forms.
149        """
150
151class ISIRPObject(Interface):
152    """A SIRP object.
153
154    This is merely a marker interface.
155    """
156
157class IUniversity(ISIRPObject):
158    """Representation of a university.
159    """
160
161
162class ISIRPContainer(ISIRPObject):
163    """A container for SIRP objects.
164    """
165
166class ISIRPContained(ISIRPObject):
167    """An item contained in an ISIRPContainer.
168    """
169
170class ISIRPExporter(Interface):
171    """An exporter for objects.
172    """
173    def export(obj, filepath=None):
174        """Export by pickling.
175
176        Returns a file-like object containing a representation of `obj`.
177
178        This is done using `pickle`. If `filepath` is ``None``, a
179        `cStringIO` object is returned, that contains the saved data.
180        """
181
182class ISIRPXMLExporter(Interface):
183    """An XML exporter for objects.
184    """
185    def export(obj, filepath=None):
186        """Export as XML.
187
188        Returns an XML representation of `obj`.
189
190        If `filepath` is ``None``, a StringIO` object is returned,
191        that contains the transformed data.
192        """
193
194class ISIRPXMLImporter(Interface):
195    """An XML import for objects.
196    """
197    def doImport(filepath):
198        """Create Python object from XML.
199
200        Returns a Python object.
201        """
202
203class IBatchProcessor(Interface):
204    """A batch processor that handles mass-operations.
205    """
206    name = schema.TextLine(
207        title = u'Importer name'
208        )
209
210    mode = schema.Choice(
211        title = u'Import mode',
212        values = ['create', 'update', 'remove']
213        )
214
215    def doImport(path, headerfields, mode='create', user='Unknown',
216                 logger=None):
217        """Read data from ``path`` and update connected object.
218
219        `headerfields` is a list of headerfields as read from the file
220        to import.
221
222        `mode` gives the import mode to use (``'create'``,
223        ``'update'``, or ``'remove'``.
224
225        `user` is a string describing the user performing the
226        import. Normally fetched from current principal.
227
228        `logger` is the logger to use during import.
229        """
230
231class IContactForm(ISIRPObject):
232    """A contact form.
233    """
234
235    email_from = schema.ASCIILine(
236        title = u'Email Address:',
237        default = None,
238        required = True,
239        constraint=validate_email,
240        )
241
242    email_to = schema.ASCIILine(
243        title = u'Email to:',
244        default = None,
245        required = True,
246        constraint=validate_email,
247        )
248
249    subject = schema.TextLine(
250        title = u'Subject:',
251        required = True,)
252
253    fullname = schema.TextLine(
254        title = u'Full Name:',
255        required = True,)
256
257    body = schema.Text(
258        title = u'Text:',
259        required = True,)
260
261class ISIRPPrincipalInfo(IPrincipalInfo):
262    """Infos about principals that are users of SIRP SIRP.
263    """
264    email = Attribute("The email address of a user")
265    phone = Attribute("The phone number of a user")
266
267
268class ISIRPPrincipal(IPrincipal):
269    """A principle for SIRP SIRP.
270
271    This interface extends zope.security.interfaces.IPrincipal and
272    requires also an `id` and other attributes defined there.
273    """
274
275    email = schema.TextLine(
276        title = u'Email',
277        description = u'',
278        required=False,)
279
280    phone = schema.TextLine(
281        title = u'Phone',
282        description = u'',
283        required=False,)
284
285class IUserAccount(ISIRPObject):
286    """A user account.
287    """
288    name = schema.TextLine(
289        title = u'User ID',
290        description = u'Login name of user',
291        required = True,)
292
293    title = schema.TextLine(
294        title = u'Full Name',
295        required = False,)
296
297    description = schema.Text(
298        title = u'Description/Notice',
299        required = False,)
300
301    email = schema.ASCIILine(
302        title = u'Email',
303        default = None,
304        required = True,
305        constraint=validate_email,
306        )
307
308    phone = schema.TextLine(
309        title = u'Phone',
310        default = None,
311        required = True,
312        )
313
314    roles = schema.List(
315        title = u'Portal roles',
316        value_type = schema.Choice(source=RoleSource()))
317
318class IPasswordValidator(Interface):
319    """A password validator utility.
320    """
321
322    def validate_password(password, password_repeat):
323        """Validates a password by comparing it with
324        control password and checking some other requirements.
325        """
326
327
328class IUsersContainer(ISIRPObject):
329    """A container for users (principals).
330
331    These users are used for authentication purposes.
332    """
333
334    def addUser(name, password, title=None, description=None):
335        """Add a user.
336        """
337
338    def delUser(name):
339        """Delete a user if it exists.
340        """
341
342class ILocalRolesAssignable(Interface):
343    """The local roles assignable to an object.
344    """
345    def __call__():
346        """Returns a list of dicts.
347
348        Each dict contains a ``name`` referring to the role assignable
349        for the specified object and a `title` to describe the range
350        of users to which this role can be assigned.
351        """
352
353class IConfigurationContainer(ISIRPObject):
354    """A container for session configuration objects.
355    """
356
357    name = schema.TextLine(
358        title = u'Name of University',
359        default = u'Sample University',
360        required = True,
361        )
362
363    acronym = schema.TextLine(
364        title = u'Abbreviated Title of University',
365        default = u'WAeUP.SIRP',
366        required = True,
367        )
368
369    title = schema.TextLine(
370        title = u'Title of Frontpage',
371        default = u'Welcome to the Student Information and Registration ' +
372                  u'Portal of Sample University',
373        required = False,
374        )
375
376    skin = schema.Choice(
377        title = u'Skin',
378        default = u'gray waeup theme',
379        vocabulary = 'waeup.sirp.browser.theming.ThemesVocabulary',
380        required = True,
381        )
382
383    frontpage = schema.Text(
384        title = u'Content in reST format',
385        required = False,
386        default = default_frontpage,
387        )
388
389    accommodation_session = schema.Choice(
390        title = u'Accommodation Booking Session',
391        source = academic_sessions_vocab,
392        default = datetime.now().year,
393        required = False,
394        readonly = False,
395        )
396
397    accommodation_states = schema.List(
398        title = u'Allowed States for Accommodation Booking',
399        value_type = schema.Choice(
400            vocabulary = registration_states_vocab,
401            ),
402        default = [],
403        )
404
405    name_admin = schema.TextLine(
406        title = u'Name of Administrator',
407        default = u'Administrator',
408        required = False,
409        )
410
411    email_admin = schema.ASCIILine(
412        title = u'Email Address of Administrator',
413        default = 'contact@waeup.org',
414        required = False,
415        constraint=validate_email,
416        )
417
418    email_subject = schema.TextLine(
419        title = u'Subject of Email to Administrator',
420        default = u'SIRP Contact',
421        required = False,
422        )
423
424    smtp_server = schema.TextLine(
425        title = u'Adress of SMTP Server',
426        default = u'localhost',
427        required = False,
428        )
429
430    smtp_requires_login = schema.Bool(
431        title = u'Server requires login',
432        default = False,
433        )
434
435    smtp_username = schema.TextLine(
436        title = u'Username for SMTP Account',
437        default = None,
438        required = False,
439        )
440
441    smtp_password = schema.Password(
442        title = u'Password for SMTP Account',
443        default = None,
444        required = False,
445        )
446
447    captcha = schema.Choice(
448        title = u'Captcha used for applicant registration pages',
449        source = CaptchaSource(),
450        default = u'No captcha',
451        required = True,
452        )
453
454class ISessionConfiguration(ISIRPObject):
455    """A session configuration object.
456    """
457
458    academic_session = schema.Choice(
459        title = u'Academic Session',
460        source = academic_sessions_vocab,
461        default = None,
462        required = True,
463        readonly = True,
464        )
465
466    school_fee_base = schema.Int(
467        title = u'School Fee',
468        default = 0,
469        )
470
471    surcharge_1 = schema.Int(
472        title = u'Surcharge 1',
473        default = 0,
474        )
475
476    surcharge_2 = schema.Int(
477        title = u'Surcharge 2',
478        default = 0,
479        )
480
481    surcharge_3 = schema.Int(
482        title = u'Surcharge 3',
483        default = 0,
484        )
485
486    clearance_fee = schema.Int(
487        title = u'Clearance Fee',
488        default = 0,
489        )
490
491    booking_fee = schema.Int(
492        title = u'Booking Fee',
493        default = 0,
494        )
495
496    acceptance_fee = schema.Int(
497        title = u'Acceptance Fee',
498        default = 0,
499        )
500
501    def getSessionString():
502        """Returns the session string from the vocabulary.
503        """
504
505
506class ISessionConfigurationAdd(ISessionConfiguration):
507    """A session configuration object in add mode.
508    """
509
510    academic_session = schema.Choice(
511        title = u'Academic Session',
512        source = academic_sessions_vocab,
513        default = None,
514        required = True,
515        readonly = False,
516        )
517
518ISessionConfigurationAdd['academic_session'].order =  ISessionConfiguration[
519    'academic_session'].order
520
521class IDataCenter(ISIRPObject):
522    """A data center.
523
524    TODO : declare methods, at least those needed by pages.
525    """
526    pass
527
528class IDataCenterFile(Interface):
529    """A data center file.
530    """
531
532    name = schema.TextLine(
533        title = u'Filename')
534
535    size = schema.TextLine(
536        title = u'Human readable file size')
537
538    uploaddate = schema.TextLine(
539        title = u'Human readable upload datetime')
540
541    lines = schema.Int(
542        title = u'Number of lines in file')
543
544    def getDate():
545        """Get creation timestamp from file in human readable form.
546        """
547
548    def getSize():
549        """Get human readable size of file.
550        """
551
552    def getLinesNumber():
553        """Get number of lines of file.
554        """
555
556class IDataCenterStorageMovedEvent(IObjectEvent):
557    """Emitted, when the storage of a datacenter changes.
558    """
559
560class IObjectUpgradeEvent(IObjectEvent):
561    """Can be fired, when an object shall be upgraded.
562    """
563
564class ILocalRoleSetEvent(IObjectEvent):
565    """A local role was granted/revoked for a principal on an object.
566    """
567    role_id = Attribute(
568        "The role id that was set.")
569    principal_id = Attribute(
570        "The principal id for which the role was granted/revoked.")
571    granted = Attribute(
572        "Boolean. If false, then the role was revoked.")
573
574class IQueryResultItem(Interface):
575    """An item in a search result.
576    """
577    url = schema.TextLine(
578        title = u'URL that links to the found item')
579    title = schema.TextLine(
580        title = u'Title displayed in search results.')
581    description = schema.Text(
582        title = u'Longer description of the item found.')
583
584class ISIRPPluggable(Interface):
585    """A component that might be plugged into a SIRP SIRP app.
586
587    Components implementing this interface are referred to as
588    'plugins'. They are normally called when a new
589    :class:`waeup.sirp.app.University` instance is created.
590
591    Plugins can setup and update parts of the central site without the
592    site object (normally a :class:`waeup.sirp.app.University` object)
593    needing to know about that parts. The site simply collects all
594    available plugins, calls them and the plugins care for their
595    respective subarea like the applicants area or the datacenter
596    area.
597
598    Currently we have no mechanism to define an order of plugins. A
599    plugin should therefore make no assumptions about the state of the
600    site or other plugins being run before and instead do appropriate
601    checks if necessary.
602
603    Updates can be triggered for instance by the respective form in
604    the site configuration. You normally do updates when the
605    underlying software changed.
606    """
607    def setup(site, name, logger):
608        """Create an instance of the plugin.
609
610        The method is meant to be called by the central app (site)
611        when it is created.
612
613        `site`:
614           The site that requests a setup.
615
616        `name`:
617           The name under which the plugin was registered (utility name).
618
619        `logger`:
620           A standard Python logger for the plugins use.
621        """
622
623    def update(site, name, logger):
624        """Method to update an already existing plugin.
625
626        This might be called by a site when something serious
627        changes. It is a poor-man replacement for Zope generations
628        (but probably more comprehensive and better understandable).
629
630        `site`:
631           The site that requests an update.
632
633        `name`:
634           The name under which the plugin was registered (utility name).
635
636        `logger`:
637           A standard Python logger for the plugins use.
638        """
639
640class IAuthPluginUtility(Interface):
641    """A component that cares for authentication setup at site creation.
642
643    Utilities providing this interface are looked up when a Pluggable
644    Authentication Utility (PAU) for any
645    :class:`waeup.sirp.app.University` instance is created and put
646    into ZODB.
647
648    The setup-code then calls the `register` method of the utility and
649    expects a modified (or unmodified) version of the PAU back.
650
651    This allows to define any authentication setup modifications by
652    submodules or third-party modules/packages.
653    """
654
655    def register(pau):
656        """Register any plugins wanted to be in the PAU.
657        """
658
659    def unregister(pau):
660        """Unregister any plugins not wanted to be in the PAU.
661        """
662
663class IObjectConverter(Interface):
664    """Object converters are available as simple adapters, adapting
665       interfaces (not regular instances).
666
667    """
668
669    def fromStringDict(self, data_dict, context, form_fields=None):
670        """Convert values in `data_dict`.
671
672        Converts data in `data_dict` into real values based on
673        `context` and `form_fields`.
674
675        `data_dict` is a mapping (dict) from field names to values
676        represented as strings.
677
678        The fields (keys) to convert can be given in optional
679        `form_fields`. If given, form_fields should be an instance of
680        :class:`zope.formlib.form.Fields`. Suitable instances are for
681        example created by :class:`grok.AutoFields`.
682
683        If no `form_fields` are given, a default is computed from the
684        associated interface.
685
686        The `context` can be an existing object (implementing the
687        associated interface) or a factory name. If it is a string, we
688        try to create an object using
689        :func:`zope.component.createObject`.
690
691        Returns a tuple ``(<FIELD_ERRORS>, <INVARIANT_ERRORS>,
692        <DATA_DICT>)`` where
693
694        ``<FIELD_ERRORS>``
695           is a list of tuples ``(<FIELD_NAME>, <ERROR>)`` for each
696           error that happened when validating the input data in
697           `data_dict`
698
699        ``<INVARIANT_ERRORS>``
700           is a list of invariant errors concerning several fields
701
702        ``<DATA_DICT>``
703           is a dict with the values from input dict converted.
704
705        If errors happen, i.e. the error lists are not empty, always
706        an empty ``<DATA_DICT>`` is returned.
707
708        If ``<DATA_DICT>` is non-empty, there were no errors.
709        """
710
711class IObjectHistory(Interface):
712
713    messages = schema.List(
714        title = u'List of messages stored',
715        required = True,
716        )
717
718    def addMessage(message):
719        """Add a message.
720        """
721
722class ISIRPWorkflowInfo(IWorkflowInfo):
723    """A :class:`hurry.workflow.workflow.WorkflowInfo` with additional
724       methods for convenience.
725    """
726    def getManualTransitions():
727        """Get allowed manual transitions.
728
729        Get a sorted list of tuples containing the `transition_id` and
730        `title` of each allowed transition.
731        """
732
733class ISiteLoggers(Interface):
734
735    loggers = Attribute("A list or generator of registered SIRPLoggers")
736
737    def register(name, filename=None, site=None, **options):
738        """Register a logger `name` which logs to `filename`.
739
740        If `filename` is not given, logfile will be `name` with
741        ``.log`` as filename extension.
742        """
743
744    def unregister(name):
745        """Unregister a once registered logger.
746        """
747
748class ILogger(Interface):
749    """A logger cares for setup, update and restarting of a Python logger.
750    """
751
752    logger = Attribute("""A :class:`logging.Logger` instance""")
753
754
755    def __init__(name, filename=None, site=None, **options):
756        """Create a SIRP logger instance.
757        """
758
759    def setup():
760        """Create a Python :class:`logging.Logger` instance.
761
762        The created logger is based on the params given by constructor.
763        """
764
765    def update(**options):
766        """Update the logger.
767
768        Updates the logger respecting modified `options` and changed
769        paths.
770        """
771
772class ILoggerCollector(Interface):
773
774    def getLoggers(site):
775        """Return all loggers registered for `site`.
776        """
777
778    def registerLogger(site, logging_component):
779        """Register a logging component residing in `site`.
780        """
781
782    def unregisterLogger(site, logging_component):
783        """Unregister a logger.
784        """
785
786#
787# External File Storage and relatives
788#
789class IFileStoreNameChooser(INameChooser):
790    """See zope.container.interfaces.INameChooser for base methods.
791    """
792    def checkName(name, attr=None):
793        """Check whether an object name is valid.
794
795        Raises a user error if the name is not valid.
796        """
797
798    def chooseName(name, attr=None):
799        """Choose a unique valid file id for the object.
800
801        The given name may be taken into account when choosing the
802        name (file id).
803
804        chooseName is expected to always choose a valid file id (that
805        would pass the checkName test) and never raise an error.
806
807        If `attr` is not ``None`` it might been taken into account as
808        well when generating the file id. Usual behaviour is to
809        interpret `attr` as a hint for what type of file for a given
810        context should be stored if there are several types
811        possible. For instance for a certain student some file could
812        be the connected passport photograph or some certificate scan
813        or whatever. Each of them has to be stored in a different
814        location so setting `attr` to a sensible value should give
815        different file ids returned.
816        """
817
818class IExtFileStore(IFileRetrieval):
819    """A file storage that stores files in filesystem (not as blobs).
820    """
821    root = schema.TextLine(
822        title = u'Root path of file store.',
823        )
824
825    def getFile(file_id):
826        """Get raw file data stored under file with `file_id`.
827
828        Returns a file descriptor open for reading or ``None`` if the
829        file cannot be found.
830        """
831
832    def getFileByContext(context, attr=None):
833        """Get raw file data stored for the given context.
834
835        Returns a file descriptor open for reading or ``None`` if no
836        such file can be found.
837
838        Both, `context` and `attr` might be used to find (`context`)
839        and feed (`attr`) an appropriate file name chooser.
840
841        This is a convenience method.
842        """
843
844    def deleteFile(file_id):
845        """Delete file stored under `file_id`.
846
847        Remove file from filestore so, that it is not available
848        anymore on next call to getFile for the same file_id.
849
850        Should not complain if no such file exists.
851        """
852
853    def deleteFileByContext(context, attr=None):
854        """Delete file for given `context` and `attr`.
855
856        Both, `context` and `attr` might be used to find (`context`)
857        and feed (`attr`) an appropriate file name chooser.
858
859        This is a convenience method.
860        """
861
862    def createFile(filename, f):
863        """Create file given by f with filename `filename`
864
865        Returns a hurry.file.File-based object.
866        """
867
868class IFileStoreHandler(Interface):
869    """Filestore handlers handle specific files for file stores.
870
871    If a file to store/get provides a specific filename, a file store
872    looks up special handlers for that type of file.
873
874    """
875    def pathFromFileID(store, root, filename):
876        """Turn file id into path to store.
877
878        Returned path should be absolute.
879        """
880
881    def createFile(store, root, filename, file_id, file):
882        """Return some hurry.file based on `store` and `file_id`.
883
884        Some kind of callback method called by file stores to create
885        file objects from file_id.
886
887        Returns a tuple ``(raw_file, path, file_like_obj)`` where the
888        ``file_like_obj`` should be a HurryFile, a SIRPImageFile or
889        similar. ``raw_file`` is the (maybe changed) input file and
890        ``path`` the relative internal path to store the file at.
891
892        Please make sure the ``raw_file`` is opened for reading and
893        the file descriptor set at position 0 when returned.
894
895        This method also gets the raw input file object that is about
896        to be stored and is expected to raise any exceptions if some
897        kind of validation or similar fails.
898        """
899
900class IPDF(Interface):
901    """A PDF representation of some context.
902    """
903
904    def __call__(view=None):
905        """Create a bytestream representing a PDF from context.
906
907        If `view` is passed in additional infos might be rendered into
908        the document.
909        """
Note: See TracBrowser for help on using the repository browser.