]> git.parisson.com Git - telemeta.git/commitdiff
move dublincore classes into models module
authorolivier <>
Wed, 1 Apr 2009 15:01:37 +0000 (15:01 +0000)
committerolivier <>
Wed, 1 Apr 2009 15:01:37 +0000 (15:01 +0000)
telemeta/dublincore.py [deleted file]
telemeta/models/dublincore.py [new file with mode: 0644]
telemeta/models/media.py

diff --git a/telemeta/dublincore.py b/telemeta/dublincore.py
deleted file mode 100644 (file)
index e3062d3..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-# Copyright (C) 2007 Samalyse SARL
-# All rights reserved.
-#
-# This software is licensed as described in the file COPYING, which
-# you should have received as part of this distribution. The terms
-# are also available at http://svn.parisson.org/telemeta/TelemetaLicense.
-#
-# Author: Olivier Guilyardi <olivier@samalyse.com>
-
-class Resource(object):
-    "Represent a Dublin Core resource"
-
-    elements = []
-
-    def __init__(self, *args):
-        self.elements = args  
-
-    def flatten(self):
-        """Convert the resource to a dictionary with element names as keys.
-
-        Warnings: 
-        - refinements are lost during this conversion,
-        - if there are several occurences of the same element, only the first is 
-        used, others are lost.
-        - all values are converted to strings
-        """
-        result = {}
-        for element in self.elements:
-            if not result.has_key(element.name):
-                result[element.name] = unicode(element.value)
-        return result
-
-class Element(object):
-    "Represent a Dublin Core element"
-
-    def __init__(self, name, field=None, value=None, refinement=None):
-        self.name = name
-        self.value = value
-        self.refinement = refinement
-        self.field = field
-        
diff --git a/telemeta/models/dublincore.py b/telemeta/models/dublincore.py
new file mode 100644 (file)
index 0000000..e3062d3
--- /dev/null
@@ -0,0 +1,41 @@
+# Copyright (C) 2007 Samalyse SARL
+# All rights reserved.
+#
+# This software is licensed as described in the file COPYING, which
+# you should have received as part of this distribution. The terms
+# are also available at http://svn.parisson.org/telemeta/TelemetaLicense.
+#
+# Author: Olivier Guilyardi <olivier@samalyse.com>
+
+class Resource(object):
+    "Represent a Dublin Core resource"
+
+    elements = []
+
+    def __init__(self, *args):
+        self.elements = args  
+
+    def flatten(self):
+        """Convert the resource to a dictionary with element names as keys.
+
+        Warnings: 
+        - refinements are lost during this conversion,
+        - if there are several occurences of the same element, only the first is 
+        used, others are lost.
+        - all values are converted to strings
+        """
+        result = {}
+        for element in self.elements:
+            if not result.has_key(element.name):
+                result[element.name] = unicode(element.value)
+        return result
+
+class Element(object):
+    "Represent a Dublin Core element"
+
+    def __init__(self, name, field=None, value=None, refinement=None):
+        self.name = name
+        self.value = value
+        self.refinement = refinement
+        self.field = field
+        
index cecf20c2ae3359ca8fa15d8f71894250233ad8e8..fd4f7cfa8a4e471e4d65dbc6031807a7189e3471 100644 (file)
@@ -16,7 +16,7 @@ import re
 
 import telemeta
 from telemeta.core import *
-from telemeta import dublincore as dc
+from telemeta.models import dublincore as dc
 from telemeta.models.query import MediaItemManager, MediaItemQuerySet, \
   MediaCollectionManager, MediaCollectionQuerySet