Python3 fixes: constraint, media, system
This commit is contained in:
parent
1da71c72a9
commit
6ae2590f50
9 changed files with 32 additions and 155 deletions
|
@ -1,30 +1,11 @@
|
|||
#
|
||||
# Copyright (c) 2008 Helmut Merz helmutm@cy55.de
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
# loops.constraint.base
|
||||
|
||||
"""
|
||||
Constraint definitions for restricting concepts and predicates available
|
||||
""" Constraint definitions for restricting concepts and predicates available
|
||||
for assignment as children or as concepts to resources.
|
||||
|
||||
$Id$
|
||||
"""
|
||||
|
||||
from zope.cachedescriptors.property import Lazy
|
||||
from zope.interface import implements
|
||||
from zope.interface import implementer
|
||||
from zope.traversing.api import getName
|
||||
|
||||
from loops.common import AdapterBase, adapterAttributes, contextAttributes
|
||||
|
@ -40,13 +21,12 @@ hasConstraint = 'hasconstraint'
|
|||
hasChildConstraint = 'haschildconstraint'
|
||||
|
||||
|
||||
@implementer(IStaticConstraint)
|
||||
class StaticConstraint(AdapterBase):
|
||||
|
||||
_contextAttributes = contextAttributes(AdapterBase, 'relationType', 'cardinality')
|
||||
_adapterAttributes = adapterAttributes(AdapterBase, 'predicates', 'types')
|
||||
|
||||
implements(IStaticConstraint)
|
||||
|
||||
def getPredicates(self):
|
||||
return self.context.getChildren([isPredicate])
|
||||
def setPredicates(self, value):
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
"""
|
||||
Set up a loops site for testing.
|
||||
# loops.constraint.testsetup
|
||||
|
||||
$Id$
|
||||
""" Set up a loops site for testing.
|
||||
"""
|
||||
|
||||
import os
|
||||
from zope import component
|
||||
from zope.app.catalog.interfaces import ICatalog
|
||||
from zope.app.catalog.field import FieldIndex
|
||||
from zope.catalog.interfaces import ICatalog
|
||||
from zope.catalog.field import FieldIndex
|
||||
|
||||
from loops import util
|
||||
from loops.concept import Concept
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
loops - Linked Objects for Organization and Processing Services
|
||||
===============================================================
|
||||
|
||||
($Id$)
|
||||
|
||||
|
||||
Media Asset Management
|
||||
======================
|
||||
|
|
|
@ -1,23 +1,6 @@
|
|||
#
|
||||
# Copyright (c) 2014 Helmut Merz helmutm@cy55.de
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
# loops.media.asset
|
||||
|
||||
"""
|
||||
Media asset file adapter.
|
||||
""" Media asset file adapter.
|
||||
|
||||
Original authors: Johann Schimpf, Erich Seifert.
|
||||
"""
|
||||
|
@ -28,7 +11,7 @@ import os
|
|||
|
||||
from zope import component
|
||||
from zope.cachedescriptors.property import Lazy
|
||||
from zope.interface import implements
|
||||
from zope.interface import implementer
|
||||
|
||||
from cybertools.media.asset import MediaAssetFile
|
||||
from cybertools.storage.interfaces import IExternalStorage
|
||||
|
@ -44,13 +27,12 @@ transformPrefix = 'asset_transform.'
|
|||
TypeInterfaceSourceList.typeInterfaces += (IMediaAsset,)
|
||||
|
||||
|
||||
@implementer(IMediaAsset)
|
||||
class MediaAsset(MediaAssetFile, ExternalFileAdapter):
|
||||
""" Concept adapter for extracting metadata from assets and for creating
|
||||
transformation variants.
|
||||
"""
|
||||
|
||||
implements(IMediaAsset)
|
||||
|
||||
_adapterAttributes = ExternalFileAdapter._adapterAttributes + ('modified',)
|
||||
_contextAttributes = list(IMediaAsset)
|
||||
|
||||
|
@ -109,7 +91,7 @@ class MediaAsset(MediaAssetFile, ExternalFileAdapter):
|
|||
pass
|
||||
try:
|
||||
return datetime.fromtimestamp(os.path.getmtime(dp))
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
getLogger('loops.media.asset.MediaAsset').warn(e)
|
||||
return None
|
||||
|
||||
|
|
|
@ -4,8 +4,6 @@ loops - Linked Objects for Organization and Processing Services
|
|||
|
||||
loops System Management.
|
||||
|
||||
($Id$)
|
||||
|
||||
|
||||
Setting up a loops Site and Utilities
|
||||
=====================================
|
||||
|
@ -39,11 +37,11 @@ In addition to the application site we need a loops system management site.
|
|||
>>> systemRoot = site['loops.system']
|
||||
|
||||
>>> sorted(sysConcepts)
|
||||
[u'domain', u'file', u'hasType', u'job', u'note', u'predicate',
|
||||
u'standard', u'textdocument', u'type']
|
||||
['domain', 'file', 'hasType', 'job', 'note', 'predicate',
|
||||
'standard', 'textdocument', 'type']
|
||||
|
||||
>>> list(systemRoot.getRecordManager().keys())
|
||||
[u'jobs']
|
||||
['jobs']
|
||||
|
||||
|
||||
Portal Links
|
||||
|
|
|
@ -1,28 +1,9 @@
|
|||
#
|
||||
# Copyright (c) 2010 Helmut Merz helmutm@cy55.de
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
# loops.system.job
|
||||
|
||||
"""
|
||||
Recording changes to loops objects.
|
||||
|
||||
$Id$
|
||||
""" Recording changes to loops objects.
|
||||
"""
|
||||
|
||||
from zope.interface import implements
|
||||
from zope.interface import implementer
|
||||
from zope.cachedescriptors.property import Lazy
|
||||
from zope.component import adapter
|
||||
|
||||
|
@ -33,10 +14,9 @@ from loops.system.interfaces import IJobRecord, IJobRecords
|
|||
from loops import util
|
||||
|
||||
|
||||
@implementer(IJobRecords)
|
||||
class JobRecords(BaseRecordManager):
|
||||
|
||||
implements(IJobRecords)
|
||||
|
||||
storageName = 'jobs'
|
||||
|
||||
def __init__(self, context):
|
||||
|
@ -56,9 +36,8 @@ class JobRecords(BaseRecordManager):
|
|||
return None
|
||||
|
||||
|
||||
@implementer(IJobRecord)
|
||||
class JobRecord(Track):
|
||||
|
||||
implements(IJobRecord)
|
||||
|
||||
typeName = 'JobRecord'
|
||||
|
||||
|
|
|
@ -1,29 +1,9 @@
|
|||
#
|
||||
# Copyright (c) 2010 Helmut Merz helmutm@cy55.de
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
# loops.system.setup
|
||||
|
||||
"""
|
||||
Automatic setup of a loops site for the system package.
|
||||
|
||||
$Id$
|
||||
""" Automatic setup of a loops site for the system package.
|
||||
"""
|
||||
|
||||
from zope.component import adapts
|
||||
from zope.interface import implements, Interface
|
||||
|
||||
from cybertools.tracking.btree import TrackingStorage
|
||||
from loops.concept import Concept
|
||||
|
|
|
@ -1,28 +1,9 @@
|
|||
#
|
||||
# Copyright (c) 2010 Helmut Merz helmutm@cy55.de
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
# loops.system.site.link
|
||||
|
||||
"""
|
||||
Interfaces for linking to other pages on a portal page.
|
||||
|
||||
$Id$
|
||||
""" Interfaces for linking to other pages on a portal page.
|
||||
"""
|
||||
|
||||
from zope.interface import implements
|
||||
from zope.interface import implementer
|
||||
from zope import interface, component, schema
|
||||
|
||||
from loops.common import AdapterBase
|
||||
|
@ -34,8 +15,7 @@ from loops.util import _
|
|||
TypeInterfaceSourceList.typeInterfaces += (ILink,)
|
||||
|
||||
|
||||
@implementer(ILink)
|
||||
class Link(AdapterBase):
|
||||
|
||||
implements(ILink)
|
||||
|
||||
_contextAttributes = list(ILink)
|
||||
|
|
|
@ -1,34 +1,15 @@
|
|||
#
|
||||
# Copyright (c) 2010 Helmut Merz helmutm@cy55.de
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
# loops.system.sync.browser
|
||||
|
||||
"""
|
||||
view class(es) for import/export.
|
||||
|
||||
$Id$
|
||||
""" view class(es) for import/export.
|
||||
"""
|
||||
|
||||
from cStringIO import StringIO
|
||||
from io import StringIO
|
||||
from logging import getLogger
|
||||
import os
|
||||
import time
|
||||
from urllib import urlopen, urlencode
|
||||
from urllib.parse import urlencode
|
||||
from urllib.request import urlopen
|
||||
from zope import component
|
||||
from zope.interface import Interface, implements
|
||||
from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
|
||||
from zope.cachedescriptors.property import Lazy
|
||||
from zope.traversing.api import getName, getPath
|
||||
|
|
Loading…
Add table
Reference in a new issue