class SiteRoot(ptahcms.ApplicationRoot): """ Application model which subclasses ptahcms.ApplicationRoot """ __type__ = ptahcms.Type( 'ptah_minicms-app', title='CMS Site Root', description='A root for the ptah_minicms Application')
class Folder(ptahcms.Container): """ A Folder model which subclasses ptahcms.Container """ __type__ = ptahcms.Type( 'folder', title = 'Folder', description = 'A folder which can contain other items.', permission = AddFolder)
class Content2(cms.Node): __tablename__ = 'test_model_base' __table_args__ = {'extend_existing': True} __id__ = sqla.Column('id', sqla.Integer, sqla.ForeignKey('ptahcms_nodes.id'), primary_key=True) __type__ = cms.Type('content2') title = sqla.Column(sqla.Unicode, default='')
class File(ptahcms.Content): """ A File model that subclasses ptahcms.Content """ __tablename__ = 'ptah_minicms_files' __type__ = ptahcms.Type( 'file', title='File', description='A file in the site.', permission=AddFile, addview='addfile.html', ) blobref = sqla.Column(sqla.Unicode, info={ 'title': 'Data', 'field_type': 'file', 'uri': True }) @ptahcms.action(permission=ptahcms.ModifyContent) def update(self, **data): """ Update file content. """ fd = data.get('blobref') if fd: blob = ptah.resolve(self.blobref) if blob is None: blob = ptahcms.blobStorage.create(self) self.blobref = blob.__uri__ blob.write(fd['fp'].read()) blob.updateMetadata(filename=fd['filename'], mimetype=fd['mimetype']) self.title = data['title'] self.description = data['description'] @ptahcms.action(permission=ptahcms.View) def data(self): """ Download data. """ blob = ptah.resolve(self.blobref) if blob is None: raise ptahcms.NotFound() return { 'mimetype': blob.mimetype, 'filename': blob.filename, 'data': blob.read() }
class CustomApplication2(ptahcms.ApplicationRoot): __type__ = ptahcms.Type('customapp', 'Custom app')
class TestApplicationRoot(cms.ApplicationRoot): __type__ = cms.Type('app')
class ApplicationRoot(ptahcms.ApplicationRoot): __type__ = ptahcms.Type('app')
class Container(ptahcms.Container): __type__ = ptahcms.Type('container', 'Test Container') __uri_factory__ = ptah.UriFactory('cms-container')
class Content(ptahcms.Content): __type__ = ptahcms.Type('content', 'Test Content') __uri_factory__ = ptah.UriFactory('cms-content')
class Content1(cms.Content): __type__ = cms.Type('content1')
class ApplicationRoot(ptahcms.ApplicationRoot): __type__ = ptahcms.Type('traverserapp')
class MyContainer(ptahcms.Container): __type__ = ptahcms.Type('container', 'Container')
class MyContent(ptahcms.Content): __type__ = ptahcms.Type('mycontent', 'MyContent')