[z3-checkins] r25751 - in z3/sqlos/trunk/src/sqlos: . auth

jinty at codespeak.net jinty at codespeak.net
Thu Apr 13 01:05:58 CEST 2006


Author: jinty
Date: Thu Apr 13 01:05:56 2006
New Revision: 25751

Removed:
   z3/sqlos/trunk/src/sqlos/annotations.py
   z3/sqlos/trunk/src/sqlos/attributeannotations.py
   z3/sqlos/trunk/src/sqlos/auth/
Modified:
   z3/sqlos/trunk/src/sqlos/configure.zcml
Log:
Rip out sqlos.auth, sqlos.annotations and sqlos.attributeannotations as they were competely untested, prbably broken and nobody stepped up to do anything about it.

Deleted: /z3/sqlos/trunk/src/sqlos/annotations.py
==============================================================================
--- /z3/sqlos/trunk/src/sqlos/annotations.py	Thu Apr 13 01:05:56 2006
+++ (empty file)
@@ -1,18 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004 Enfold Systems LLC. All rights reserved.
-#
-# This software is distributed under the terms of the Zope Public
-# License (ZPL) v2.1. See COPYING.txt for more information.
-#
-##############################################################################
-"""
-$Id: adapter.py 5212 2004-06-21 18:09:05Z philikon $
-"""
-from sqlobject import *
-
-class Annotations(SQLObject):
-
-    location = StringCol('location', length=255, notNull=1)
-    key = StringCol('key', length=255, notNull=1)
-    value = StringCol('value', notNull=0)

Deleted: /z3/sqlos/trunk/src/sqlos/attributeannotations.py
==============================================================================
--- /z3/sqlos/trunk/src/sqlos/attributeannotations.py	Thu Apr 13 01:05:56 2006
+++ (empty file)
@@ -1,135 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004 Enfold Systems LLC. All rights reserved.
-#
-# This software is distributed under the terms of the Zope Public
-# License (ZPL) v2.1. See COPYING.txt for more information.
-#
-##############################################################################
-"""
-$Id: adapter.py 5212 2004-06-21 18:09:05Z philikon $
-"""
-
-import pickle
-
-from sqlobject import *
-from zope.app.interfaces.annotation import IAnnotations
-from zope.app import zapi
-from zope.proxy import removeAllProxies
-from zope.interface import implements
-from zope.app.interfaces.location import ILocation
-from zope.app.location import Location
-
-from sqlos import getFactory
-
-
-class AnnotationProxy(object):
-
-    def __init__(self, parent, key, context):
-        self.__parent = parent
-        self.__key = key
-        self.__context = context
-
-    def __getattr__(self, name):
-        if name in ('_AnnotationProxy__parent',
-                    '_AnnotationProxy__key',
-                    '_AnnotationProxy__context'):
-            return object.__getattribute__(self, name)
-        return getattr(self.__context, name)
-
-    def __setattr__(self, name, value):
-        if name in ('_AnnotationProxy__parent',
-                    '_AnnotationProxy__key',
-                    '_AnnotationProxy__context'):
-            object.__setattr__(self, name, value)
-        else:
-            setattr(self.__context, name, value)
-            self.__parent[self.__key] = self.__context
-
-    def __setitem__(self, name, value):
-        if name in ('_AnnotationProxy__parent',
-                    '_AnnotationProxy__key',
-                    '_AnnotationProxy__context'):
-            object.__setattr__(self, name, value)
-        else:
-            self.__context[name] = value
-            self.__parent[self.__key] = self.__context
-
-
-class AnnotationSource(Location):
-
-    def __init__(self, context):
-        self.context = context
-        self.location = "%s/%s" % (zapi.getName(zapi.getParent(context)),
-                                   zapi.getName(context))
-        self.__parent__ = context
-        self.__name__ = '__annotations_source__'
-        self.className = 'Annotations'
-
-    def __getitem__(self, name):
-        factory = getFactory(self.className)
-        clause = "location = %r and key = %r" % (str(self.location),
-                                                 str(name))
-        result = factory.select(clause = clause)
-        if not len(result):
-            raise KeyError, name
-        return AnnotationProxy(self, name, pickle.loads(result[0].value))
-
-    def get(self, name, default):
-        try:
-            item = self[name]
-        except KeyError:
-            return default
-        return item
-
-    def __setitem__(self, name, value):
-        factory = getFactory(self.className)
-        clause = "location = %r and key = %r" % (str(self.location),
-                                                 str(name))
-        result = factory.select(clause = clause)
-        if not len(result):
-            item = factory.new(location=self.location,
-                               key=name,
-                               value=None)
-        else:
-            item = result[0]
-
-        assert pickle.loads(pickle.dumps(value)) == value
-        value = pickle.dumps(value)
-        item.value = value
-
-
-class SQLAttributeAnnotations:
-    """
-    Store annotations in the annotations table, keyed by
-    table_name/id on a IAttributeAnnotatable object.
-    """
-
-    implements(IAnnotations)
-
-    def __init__(self, obj):
-        self.wrapped_obj = obj
-        self.unwrapped_obj = removeAllProxies(obj)
-
-    def __getitem__(self, key):
-        annotations = AnnotationSource(self.wrapped_obj)
-        if annotations is None:
-            raise KeyError, key
-        return annotations[key]
-
-    def __setitem__(self, key, value):
-        if ILocation.providedBy(value):
-            value.__parent__ = self.unwrapped_obj
-
-        annotations = AnnotationSource(self.wrapped_obj)
-        annotations[key] = value
-
-    def get(self, key, default=None):
-        annotations = AnnotationSource(self.wrapped_obj)
-        return annotations.get(key, default)
-
-    def __getattr__(self, name):
-        # this method is for getting methods and attributes of the
-        # mapping object used to store annotations.
-        annotations = AnnotationSource(self.wrapped_obj)
-        return getattr(annotations, name)

Modified: z3/sqlos/trunk/src/sqlos/configure.zcml
==============================================================================
--- z3/sqlos/trunk/src/sqlos/configure.zcml	(original)
+++ z3/sqlos/trunk/src/sqlos/configure.zcml	Thu Apr 13 01:05:56 2006
@@ -3,8 +3,6 @@
            xmlns:browser="http://namespaces.zope.org/browser"
            i18n_domain="sqlos">
 
-  <include package=".auth" />
-
   <!-- ISQLObjectContainer Views -->
 
   <content class=".container.SQLObjectContainer">
@@ -56,21 +54,6 @@
       attribute="contents"
       />
 
-  <!--   Disable for now -->
-
-  <!--   <adapter -->
-  <!--       factory=" -->
-  <!-- 	       sqlos.attributeannotations.SQLAttributeAnnotations" -->
-  <!--       provides="zope.app.interfaces.annotation.IAnnotations" -->
-  <!--       for="sqlos.interfaces.ISQLObject" /> -->
-
-  <!--   <adapter -->
-  <!--       factory=" -->
-  <!-- 	       sqlos.attributeannotations.SQLAttributeAnnotations" -->
-  <!--       provides="zope.app.interfaces.annotation.IAnnotations" -->
-  <!--       for="sqlos.interfaces.ISQLAttributeAnnotatable" /> -->
-
-
   <class class=".adapter.MySQLAdapter">
     <require
         permission="zope.Public"


More information about the z3-checkins mailing list