Beispiel #1
0
    def test_mold_views_hidden(self):
        # register temporary generator and note.

        ctxobj = self.portal.exposure['2'].file2

        sm = zope.component.getSiteManager()
        sm.registerUtility(adapter.EditedNoteAnnotatorFactory, 
            IExposureFileAnnotator, name='edited_note_viewless')
        EditedNoteViewlessFactory = note_factory(
            content.EditedNote, 'edited_note_viewless')
        sm.registerAdapter(EditedNoteViewlessFactory, 
            (IExposureFile,), content.IEditedNote,
            name='edited_note_viewless')

        request = TestRequest()
        fields = {'views': [('edited_note_viewless', {'note': u'value'})]}

        views, hidden_views = util._mold_views(ctxobj, request, fields)
        self.assertEqual(views, ['edited_note_viewless'])
        self.assertEqual(hidden_views, ['edited_note_viewless'])
Beispiel #2
0
import zope.interface
import zope.component
from zope.schema import fieldproperty

from pmr2.app.annotation.interfaces import IExposureFileEditableNote
from pmr2.app.annotation.note import ExposureFileNoteBase
from pmr2.app.annotation.note import ExposureFileEditableNoteBase
from pmr2.app.annotation import note_factory

from pmr2.virtuoso.interfaces import IVirtuosoNote


class VirtuosoNote(ExposureFileNoteBase):
    """
    For storage of metadata.
    """

    zope.interface.implements(IVirtuosoNote, IExposureFileEditableNote)

    metadata = fieldproperty.FieldProperty(IVirtuosoNote['metadata'])
    exclude_nav = fieldproperty.FieldProperty(IVirtuosoNote['exclude_nav'])

VirtuosoNoteFactory = note_factory(VirtuosoNote, 'virtuoso_rdf')
Beispiel #3
0
    zope.interface.implements(IExposureFileAnnotator, 
                              IExposureFileEditAnnotator)
    title = u'Filename'
    description = u'Simple note for filename selection testing.'
    for_interface = IFilenameNote


RDFTurtleAnnotatorFactory = named_factory(RDFTurtleAnnotator)
RDFn3AnnotatorFactory = named_factory(RDFn3Annotator)
RDFxmlAnnotatorFactory = named_factory(RDFxmlAnnotator)
# the four test annotation factories
Base64NoteAnnotatorFactory = named_factory(Base64NoteAnnotator)
Rot13NoteAnnotatorFactory = named_factory(Rot13NoteAnnotator)
EditedNoteAnnotatorFactory = named_factory(EditedNoteAnnotator)
PostEditedNoteAnnotatorFactory = named_factory(PostEditedNoteAnnotator)
FilenameNoteAnnotatorFactory = named_factory(FilenameNoteAnnotator)


RDFTurtleNoteFactory = note_factory(RawTextNote, 'rdfturtle')
RDFn3NoteFactory = note_factory(RawTextNote, 'rdfn3')
RDFxmlNoteFactory = note_factory(RawTextNote, 'rdfxml')
# the four test note factories
Base64NoteFactory = note_factory(RawTextNote, 'base64')
Rot13NoteFactory = note_factory(RawTextNote, 'rot13')
EditedNoteFactory = note_factory(EditedNote, 'edited_note')
PostEditedNoteFactory = note_factory(PostEditedNote, 'post_edited_note')
FilenameNoteFactory = note_factory(FilenameNote, 'filename_note')


RDFGroupNoteFactory = note_factory(GroupedNote, 'rdf')
Beispiel #4
0
from pmr2.app.factory import named_factory
from pmr2.app.annotation import note_factory
from pmr2.app.annotation.interfaces import *
from pmr2.app.annotation.annotator import ExposureFileAnnotatorBase

from cellml.pmr2.note import CellMLCodegenNote


class DummyCodegenAnnotator(ExposureFileAnnotatorBase):
    zope.interface.implements(IExposureFileAnnotator)
    title = u'Dummy Code'
    description = u'A dummy code generator'
    
    def generate(self):
        return (
            ('code', {
                'C': 'printf("this is a test\\n");',
                'Python': 'print "this is a test"',
            }),
        )

DummyCodegenAnnotatorFactory = named_factory(DummyCodegenAnnotator)
DummyCodegenNoteFactory = note_factory(CellMLCodegenNote, 'dummy_code')
Beispiel #5
0
import zope.interface
import zope.component
from zope.schema import fieldproperty
    
from pmr2.app.annotation.interfaces import IExposureFileEditableNote
from pmr2.app.annotation.note import ExposureFileEditableNoteBase
from pmr2.app.annotation import note_factory
      
from pmr2.omex.interfaces import IOmexNote
      
      
class OmexNote(ExposureFileEditableNoteBase):
  
    zope.interface.implements(IOmexNote, IExposureFileEditableNote)
      
    path = fieldproperty.FieldProperty(IOmexNote['path'])
    
OmexNoteFactory = note_factory(OmexNote, 'omex')
    content_types, constructors, ftis = atapi.process_types(atapi.listTypes('pmr2.annotation.citation'), 'pmr2.annotation.citation')

    cmfutils.ContentInit(
        'pmr2.annotation.citation Content',
        content_types = content_types,
        permission = ADD_CONTENT_PERMISSION,
        extra_constructors = constructors,
        fti = ftis,
        ).initialize(context)

from z3c.form.field import Fields
from z3c.form.interfaces import INPUT_MODE
from plone.app.z3cform.wysiwyg.widget import WysiwygFieldWidget

from pmr2.app.annotation import note_factory
from pmr2.app.settings import settings_factory
from pmr2.annotation.citation.interfaces import IPluginSettings
from note import *

LicenseCitationNoteFactory = note_factory(LicenseCitationNote,
                                          'license_citation')

fields = Fields(IPluginSettings, prefix='license_citation')
fields['license_citation.citation_instruction'].widgetFactory[INPUT_MODE] = \
    WysiwygFieldWidget

PluginSettingsFactory = settings_factory(PluginSettings, 
                                         'license_citation',
                                         u'License and Citation Settings',
                                         fields,)