Index: /quintagroup.seoptimizer/trunk/docs/HISTORY.txt
===================================================================
--- /quintagroup.seoptimizer/trunk/docs/HISTORY.txt	(revision 1307)
+++ /quintagroup.seoptimizer/trunk/docs/HISTORY.txt	(revision 1308)
@@ -1,4 +1,11 @@
 Changelog
 =========
+
+2.0.10 (unreleased)
+------------------
+
+- Resolved metatags duplication
+  [liebster]
+
 
 2.0.9 (2009-09-10)
@@ -7,4 +14,5 @@
 - Fixed bugs in metatags viewlet
   [liebster]
+
 
 2.0.8 (2009-07-28)
Index: /quintagroup.seoptimizer/trunk/quintagroup/seoptimizer/__init__.py
===================================================================
--- /quintagroup.seoptimizer/trunk/quintagroup/seoptimizer/__init__.py	(revision 1307)
+++ /quintagroup.seoptimizer/trunk/quintagroup/seoptimizer/__init__.py	(revision 1308)
@@ -1,4 +1,107 @@
 from AccessControl import allow_module
+from util import SortedDict
+from Acquisition import aq_inner
+from DateTime import DateTime
+
+from Products.CMFCore.utils import getToolByName
 
 allow_module('quintagroup.seoptimizer.util')
 qSEO_globals = globals()
+
+
+try:
+    from Products.CMFPlone.PloneTool import PloneTool, METADATA_DCNAME
+    _present = hasattr(PloneTool, "listMetaTags")
+except ImportError:
+    _present = False
+
+
+
+if _present:
+    old_lmt = PloneTool.listMetaTags
+
+    def listMetaTags(self, context):
+        """Lists meta tags helper.
+
+        Creates a mapping of meta tags -> values for the listMetaTags script.
+        """
+        result = {}
+        site_props = getToolByName(self, 'portal_properties').site_properties
+        use_all = site_props.getProperty('exposeDCMetaTags', None)
+
+        if not use_all:
+            metadata_names = {'Description': METADATA_DCNAME['Description']}
+        else:
+            metadata_names = METADATA_DCNAME
+
+        for accessor, key in metadata_names.items():
+            method = getattr(aq_inner(context).aq_explicit, accessor, None)
+            if not callable(method):
+                continue
+
+            # Catch AttributeErrors raised by some AT applications
+            try:
+                value = method()
+            except AttributeError:
+                value = None
+
+            if not value:
+                # No data
+                continue
+            if accessor == 'Publisher' and value == 'No publisher':
+                # No publisher is hardcoded (TODO: still?)
+                continue
+            if isinstance(value, (list, tuple)):
+                # convert a list to a string
+                value = ', '.join(value)
+
+#          Exclusion meta tag description and keywords
+#            # Special cases
+#            if accessor == 'Description':
+#                result['description'] = value
+#            elif accessor == 'Subject':
+#                result['keywords'] = value
+
+            if use_all:
+                result[key] = value
+
+        if use_all:
+            created = context.CreationDate()
+
+            try:
+                effective = context.EffectiveDate()
+                if effective == 'None':
+                    effective = None
+                if effective:
+                    effective = DateTime(effective)
+            except AttributeError:
+                effective = None
+
+            try:
+                expires = context.ExpirationDate()
+                if expires == 'None':
+                    expires = None
+                if expires:
+                    expires = DateTime(expires)
+            except AttributeError:
+                expires = None
+
+            # Filter out DWIMish artifacts on effective / expiration dates
+            if effective is not None and \
+               effective > FLOOR_DATE and \
+               effective != created:
+                eff_str = effective.Date()
+            else:
+                eff_str = ''
+
+            if expires is not None and expires < CEILING_DATE:
+                exp_str = expires.Date()
+            else:
+                exp_str = ''
+
+            if exp_str or exp_str:
+                result['DC.date.valid_range'] = '%s - %s' % (eff_str, exp_str)
+
+        return result
+
+    PloneTool.listMetaTags = listMetaTags
Index: /quintagroup.seoptimizer/trunk/quintagroup/seoptimizer/browser/configure.zcml
===================================================================
--- /quintagroup.seoptimizer/trunk/quintagroup/seoptimizer/browser/configure.zcml	(revision 1307)
+++ /quintagroup.seoptimizer/trunk/quintagroup/seoptimizer/browser/configure.zcml	(revision 1308)
@@ -12,5 +12,5 @@
         />
        
-    <browser:viewlet
+    <!--browser:viewlet
         name="quintagroup.seoptimizer.http_equiv"
         manager="plone.app.layout.viewlets.interfaces.IHtmlHead"
@@ -18,7 +18,7 @@
         layer=".interfaces.IPloneSEOLayer"
         permission="zope2.View"
-        />
+        /-->
 
-    <browser:viewlet
+    <!--browser:viewlet
         name="quintagroup.seoptimizer.base"
         manager="plone.app.layout.viewlets.interfaces.IHtmlHead"
@@ -26,7 +26,7 @@
         layer=".interfaces.IPloneSEOLayer"
         permission="zope2.View"
-        />
+        /-->
 
-    <browser:viewlet
+    <!--browser:viewlet
         name="quintagroup.seoptimizer.generator"
         manager="plone.app.layout.viewlets.interfaces.IHtmlHead"
@@ -34,5 +34,5 @@
         layer=".interfaces.IPloneSEOLayer"
         permission="zope2.View"
-        />
+        /-->
 
     <browser:viewlet
Index: /quintagroup.seoptimizer/trunk/quintagroup/seoptimizer/browser/viewlets.py
===================================================================
--- /quintagroup.seoptimizer/trunk/quintagroup/seoptimizer/browser/viewlets.py	(revision 1307)
+++ /quintagroup.seoptimizer/trunk/quintagroup/seoptimizer/browser/viewlets.py	(revision 1308)
@@ -49,32 +49,32 @@
                 return u"%s\n%s"%(qseo_title, qseo_comments)
 
-class HTTPEquiv(ViewletBase):
-    
-    def charset( self ):
-        context = self.context.aq_inner
-        site_properties = getToolByName( context, 'portal_properties').site_properties
-        return site_properties.getProperty('default_charset', 'utf-8')
-    
-    def render( self ):
-        return """<meta http-equiv="Content-Type" content="text/html; charset=%s" />"""%self.charset()
-         
-class BaseUrlViewlet( ViewletBase ):
-    """
-       simpel viewlet for base href rendering
-    """
-    def renderBase( self ):
-        # returns correct base href
-        context = self.context.aq_inner
-        isFolder = getattr(context.aq_explicit, 'isPrincipiaFolderish', 0)
-        base_url = context.absolute_url()
-
-        # when accessing via WEBDAV you're not allowed to access aq_explicit
-        try:
-            return isFolder and '%s/'%base_url or base_url
-        except (Unauthorized, 'Unauthorized'):
-            pass
-
-    def render( self ):
-        return """<base href="%s" /><!--[if lt IE 7]></base><![endif]-->"""% self.renderBase()
+#class HTTPEquiv(ViewletBase):
+#    
+#    def charset( self ):
+#        context = self.context.aq_inner
+#        site_properties = getToolByName( context, 'portal_properties').site_properties
+#        return site_properties.getProperty('default_charset', 'utf-8')
+#    
+#    def render( self ):
+#        return """<meta http-equiv="Content-Type" content="text/html; charset=%s" />"""%self.charset()
+#         
+#class BaseUrlViewlet( ViewletBase ):
+#    """
+#       simpel viewlet for base href rendering
+#    """
+#    def renderBase( self ):
+#        # returns correct base href
+#        context = self.context.aq_inner
+#        isFolder = getattr(context.aq_explicit, 'isPrincipiaFolderish', 0)
+#        base_url = context.absolute_url()
+#
+#        # when accessing via WEBDAV you're not allowed to access aq_explicit
+#        try:
+#            return isFolder and '%s/'%base_url or base_url
+#        except (Unauthorized, 'Unauthorized'):
+#            pass
+#
+#    def render( self ):
+#        return """<base href="%s" /><!--[if lt IE 7]></base><![endif]-->"""% self.renderBase()
 
 class MetaTagsViewlet( ViewletBase ):
@@ -92,5 +92,5 @@
 
         metaTags = SortedDict()
-        metaTags.update(pu.listMetaTags(context))
+        #metaTags.update(pu.listMetaTags(context))
         metadataList = [
             ('seo_description', 'description'),
@@ -100,5 +100,5 @@
 
         if exposeDCMetaTags:
-            metadataList.append(('qSEO_Distribution', 'DC.distribution'))
+            metadataList.append(('seo_distribution', 'DC.distribution'))
 
         seo_context = getMultiAdapter((self.context, self.request), name='seo_context')
Index: /quintagroup.seoptimizer/trunk/quintagroup/seoptimizer/profiles/default/viewlets.xml
===================================================================
--- /quintagroup.seoptimizer/trunk/quintagroup/seoptimizer/profiles/default/viewlets.xml	(revision 1307)
+++ /quintagroup.seoptimizer/trunk/quintagroup/seoptimizer/profiles/default/viewlets.xml	(revision 1308)
@@ -2,8 +2,8 @@
 <object>
   <order manager="plone.htmlhead" skinname="*">
-    <viewlet name="quintagroup.seoptimizer.http_equiv" />
+    <!--viewlet name="quintagroup.seoptimizer.http_equiv" /-->
     <viewlet name="plone.htmlhead.title" />
-    <viewlet name="quintagroup.seoptimizer.base" />
-    <viewlet name="quintagroup.seoptimizer.generator" />
+    <!--viewlet name="quintagroup.seoptimizer.base" /-->
+    <!--viewlet name="quintagroup.seoptimizer.generator" /-->
     <viewlet name="quintagroup.seoptimizer.metatags" />
     <viewlet name="quintagroup.seoptimizer.canonicalurl" />
