Esempio n. 1
0
    Countries = atapi.ATFieldProperty('Countries')

    Categories = atapi.ATFieldProperty('Categories')

    Genre = atapi.ATFieldProperty('Genre')

    video_file = atapi.ATFieldProperty('video_file')


    def plumiVideoDuration(self):
      """ Get the duration of the uploaded video file """
      strDuration = ''
      try:
        filename = self.video_file.getBlob().committed()
        if filename:
            videoMetaData = extract(filename)
            tdelta = videoMetaData.get('duration')
            seconds = tdelta.seconds
            hours, remainder = divmod(seconds, 3600)
            minutes, seconds = divmod(remainder, 60)            
            if hours > 0:
                strDuration += "%.2d:" % hours                
            strDuration += "%.2d:%.2d" % (minutes,seconds)
      except:
        pass
        
      return strDuration
          

atapi.registerType(PlumiVideo, PROJECTNAME)
Esempio n. 2
0
        ),
    ))

# Set storage on fields copied from ATContentTypeSchema, making sure
# they work well with the python bridge properties.

TransparencySectionSchema["title"].storage = atapi.AnnotationStorage()
TransparencySectionSchema["description"].storage = atapi.AnnotationStorage()

schemata.finalizeATCTSchema(TransparencySectionSchema, moveDiscussion=False)


@implementer(ITransparencySection)
class TransparencySection(base.ATCTContent):
    """Content-type for sections"""

    meta_type = "TransparencySection"
    schema = TransparencySectionSchema

    title = atapi.ATFieldProperty("title")
    description = atapi.ATFieldProperty("description")

    # -*- Your ATSchema to Python Property Bridges Here ... -*-

    def image_url(self):
        return str(
            self.restrictedTraverse("@@images").scale("image", scale="mini"))


atapi.registerType(TransparencySection, PROJECTNAME)
except ImportError:
    from Products.Archetypes import atapi

OpenDataFolderSchema = schemata.ATContentTypeSchema.copy() + atapi.Schema((
    # -*- Your Archetypes field definitions here ... -*-
))

# Set storage on fields copied from ATContentTypeSchema, making sure
# they work well with the python bridge properties.

OpenDataFolderSchema["title"].storage = atapi.AnnotationStorage()
OpenDataFolderSchema["description"].storage = atapi.AnnotationStorage()

schemata.finalizeATCTSchema(OpenDataFolderSchema, moveDiscussion=False)


@implementer(IOpenDataFolder)
class OpenDataFolder(base.ATCTContent):
    """Content-type for sections"""

    meta_type = "OpenDataFolder"
    schema = OpenDataFolderSchema

    title = atapi.ATFieldProperty("title")
    description = atapi.ATFieldProperty("description")

    # -*- Your ATSchema to Python Property Bridges Here ... -*-


atapi.registerType(OpenDataFolder, PROJECTNAME)
    implements(IPlumiCallOut)

    meta_type = "PlumiCallOut"

    schema = PlumiCallOutSchema
    schema.changeSchemataForField('location', 'default') 
    schema.moveField('bodyText', after='description')
    schema.moveField('location', after='bodyText')
    schema.changeSchemataForField('expirationDate', 'default') 
    schema.moveField('expirationDate', after='closingDate')

    title = atapi.ATFieldProperty('title')
    description = atapi.ATFieldProperty('description')
    # -*- Your ATSchema to Python Property Bridges Here ... -*-
    websiteURL = atapi.ATFieldProperty('websiteURL')

    location = atapi.ATFieldProperty('location')

    calloutImageCaption = atapi.ATFieldProperty('calloutImageCaption')

    calloutImage = atapi.ATFieldProperty('calloutImage')

    bodyText = atapi.ATFieldProperty('bodyText')

    submissionCategories = atapi.ATFieldProperty('submissionCategories')

    closingDate = atapi.ATFieldProperty('closingDate')


atapi.registerType(PlumiCallOut, PROJECTNAME)