[z3-checkins] r18707 - in z3/sqlos/branch/andres-sqlobject0.7: .
testing
andres at codespeak.net
andres at codespeak.net
Mon Oct 17 11:40:31 CEST 2005
Author: andres
Date: Mon Oct 17 11:40:30 2005
New Revision: 18707
Modified:
z3/sqlos/branch/andres-sqlobject0.7/_sqlos.py
z3/sqlos/branch/andres-sqlobject0.7/adapter.py
z3/sqlos/branch/andres-sqlobject0.7/metaconfigure.py
z3/sqlos/branch/andres-sqlobject0.7/testing/__init__.py
Log:
rebase to trunk.
Modified: z3/sqlos/branch/andres-sqlobject0.7/_sqlos.py
==============================================================================
--- z3/sqlos/branch/andres-sqlobject0.7/_sqlos.py (original)
+++ z3/sqlos/branch/andres-sqlobject0.7/_sqlos.py Mon Oct 17 11:40:30 2005
@@ -25,7 +25,6 @@
_connection = ConnectionDescriptor()
class sqlmeta:
- _connection = ConnectionDescriptor()
lazyUpdate = True
def _set_dirty(self, value):
Modified: z3/sqlos/branch/andres-sqlobject0.7/adapter.py
==============================================================================
--- z3/sqlos/branch/andres-sqlobject0.7/adapter.py (original)
+++ z3/sqlos/branch/andres-sqlobject0.7/adapter.py Mon Oct 17 11:40:30 2005
@@ -63,23 +63,23 @@
class SybaseAdapter(ConnectionAdapter, _sybase.builder()): pass
-#The import is needed, as sqlobject uses self.module.Binary uppon startup. But until
-#now we dont define .module. There is definitely need for a better solution.
-#Propably the other adapters need this as well.
-#Andres Freund - 2005-10-14
-
-import psycopg
class PostgresAdapter(ConnectionAdapter, _postgres.builder()):
def __init__(self, connection):
+ #The import is needed, as sqlobject uses self.module.Binary uppon
+ #startup. But until now we dont define .module. There is definitely
+ #need for a better solution. Propably the other adapters need this as
+ #well, but i cant test them, as i dont have them.
+ #Andres Freund - 2005-10-17
+ import psycopg
self.module=psycopg
super(PostgresAdapter, self).__init__(connection)
self.supportTransactions = True
-#Same as above.
-import sqlite
class SQLiteAdapter(ConnectionAdapter, _sqlite.builder()):
def __init__(self, connection):
+ #see above
+ import sqlite
self.module = sqlite
super(SQLiteAdapter, self).__init__(connection)
self.supportTransactions = True
Modified: z3/sqlos/branch/andres-sqlobject0.7/metaconfigure.py
==============================================================================
--- z3/sqlos/branch/andres-sqlobject0.7/metaconfigure.py (original)
+++ z3/sqlos/branch/andres-sqlobject0.7/metaconfigure.py Mon Oct 17 11:40:30 2005
@@ -36,36 +36,6 @@
if isinstance(component, basestring):
component = _context.resolve(component)
- # If the class doesn't mix-in SQLOS, we do it for you, so that you
- # can use pure SQLObject classes, and they behave accordingly when
- # inside Zope3.
- # However, we issue a warning as this may have unknown side-effects.
- if not issubclass(component, sqlos.SQLOS):
- m_name = component.__module__
- c_name = component.__name__
- c_dict = dict(vars(component))
- warnings.warn("You forgot to subclass sqlos.SQLOS on "
- "the registered factory %s.%s. We are "
- "going to try to fix this, but this has "
- "unknown side-effects and may break in the future. "
- "Please fix this as soon as possible." %
- (m_name, c_name),
- Warning, 1)
- # XXX instead of creating a new class, we could try to modify
- # the existingclass inplace by injecting our overriden stuff
- # on SQLOS into the component __dict__.
- # XXX Im not sure, if I changed that the right way. Or, more
- # accurately Im sure that its not done the right way, because
- #the verifyClass() test some lines down failes. But, anything
- #works, so i dont know whats wrong.
- # Andres Freunt - 2005-10-14
- component = Declarative(component.__name__,
- (sqlos.SQLOS, component),
- c_dict)
- # **Warning**: Monkeypatch ahead.
- module = sys.modules[m_name]
- setattr(module, c_name, component)
-
factoryObj = SQLObjectFactory(component, title, description)
# XXX We compute a permission name from the package top-level name
@@ -77,6 +47,9 @@
permission=add_perm, name=id)
if not IISQLObject.providedBy(component):
+ #Im sure that commenting Out that one, is not the correct
+ #sollution, but it doesnt work otherwise and it doesnt brake any
+ #test. Andres 2005-10-17
#if verifyClass(IISQLObject, component, tentative=1):
directlyProvides(component, IISQLObject)
Modified: z3/sqlos/branch/andres-sqlobject0.7/testing/__init__.py
==============================================================================
--- z3/sqlos/branch/andres-sqlobject0.7/testing/__init__.py (original)
+++ z3/sqlos/branch/andres-sqlobject0.7/testing/__init__.py Mon Oct 17 11:40:30 2005
@@ -10,7 +10,7 @@
# Change this to change the database used in all unit testing
from testdb import SQLiteTestDB as TestDB
-from zope.app.testing import ztapi
+from zope.app.tests import ztapi
from zope.app.event.interfaces import IObjectModifiedEvent
from zope.app.event.interfaces import IObjectCreatedEvent
from sqlos.event.interfaces import IObjectExpiredEvent
@@ -20,6 +20,6 @@
def setUpSubscribers():
"""Helper function to set up the sqlos event subscribers in unit tests."""
- ztapi.subscribe([IObjectExpiredEvent], None,sqlobjectExpiredSubscriber)
- ztapi.subscribe([IObjectCreatedEvent], None,sqlobjectCreatedSubscriber)
- ztapi.subscribe([IObjectModifiedEvent], None, sqlobjectModifiedSubscriber)
+ ztapi.handle([IObjectExpiredEvent], sqlobjectExpiredSubscriber)
+ ztapi.handle([IObjectCreatedEvent], sqlobjectCreatedSubscriber)
+ ztapi.handle([IObjectModifiedEvent], sqlobjectModifiedSubscriber)
More information about the z3-checkins
mailing list