Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 11th, 2012  |  syntax: None  |  size: 2.41 KB  |  hits: 14  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. """Definition of the video content type
  2. """
  3.  
  4. from zope.interface import implements
  5.  
  6. from Products.Archetypes import atapi
  7. #from Products.ATContentTypes.content import base
  8. """
  9. cambio realizado de base a file y iatfile
  10. """
  11. from Products.ATContentTypes.content import file
  12. from Products.ATContentTypes.interface.file import IATFile
  13. from Products.ATContentTypes.content import schemata
  14. #-*-Import of FileSystemStorage-*-
  15. from iw.fss.FileSystemStorage import FileSystemStorage
  16.  
  17. # -*- Message Factory Imported Here -*-
  18. from cenditel.multimedia import multimediaMessageFactory as _
  19.  
  20. from cenditel.multimedia.interfaces import Ivideo
  21. from cenditel.multimedia.config import PROJECTNAME
  22.  
  23. #videoSchema = schemata.ATContentTypeSchema.copy() + atapi.Schema((
  24. """
  25. cambio realizado en el schema, ahora usa File
  26. """
  27.  
  28. videoSchema= file.ATFileSchema.copy() + atapi.Schema((
  29.     # -*- Your Archetypes field definitions here ... -*-
  30.    atapi.StringField("title",
  31.                 required=True,
  32.                 searchable=True,
  33.                 storage=atapi.AnnotationStorage(),
  34.                 widget=atapi.StringWidget(label=_(u"title"))
  35.                 ),
  36.    atapi.TextField("description",
  37.                 required=False,
  38.                 searchable=True,
  39.                 storage=atapi.AnnotationStorage(),
  40.                 widget=atapi.RichWidget(label=_(u"description"))
  41.                 ),
  42.                
  43.    #IATFile.FileField("video",
  44.     #            required=True,
  45.      #           searchable=False,
  46.       #          storage=FileSystemStorage(),
  47.                 #storage=atapi.AnnotationStorage(),
  48.        #         widget=IATFile.FileWidget(label=_(u"video"))
  49.         #        ),
  50.                
  51. ))
  52.  
  53. # Set storage on fields copied from ATContentTypeSchema, making sure
  54. # they work well with the python bridge properties.
  55.  
  56. videoSchema['title'].storage = atapi.AnnotationStorage()
  57. videoSchema['description'].storage = atapi.AnnotationStorage()
  58.  
  59. schemata.finalizeATCTSchema(videoSchema, moveDiscussion=False)
  60.  
  61.  
  62. class video(file.ATFile):
  63.     """It is a Video File to be show in the site"""
  64.     implements(IATFile, Ivideo)
  65.     _at_rename_after_creation = True
  66.     meta_type = "video"
  67.     schema = videoSchema
  68.  
  69.     title = atapi.ATFieldProperty('title')
  70.     description = atapi.ATFieldProperty('description')
  71.  
  72.     # -*- Your ATSchema to Python Property Bridges Here ... -*-
  73.  
  74. atapi.registerType(video, PROJECTNAME)