[grassyknoll commit] r984 - in branches/unhork/grassyknoll: collection/backends/lucene collection/backends/sql tests t...

0 views
Skip to first unread message

codesite...@google.com

unread,
Jan 6, 2009, 3:29:23 PM1/6/09
to grassykno...@googlegroups.com
Author: jemfinch
Date: Tue Jan 6 10:25:45 2009
New Revision: 984

Modified:

branches/unhork/grassyknoll/collection/backends/lucene/LuceneCollection.py
branches/unhork/grassyknoll/collection/backends/sql/TableMaker.py
branches/unhork/grassyknoll/tests/test_Smarts.py
branches/unhork/grassyknoll/tests/test_backends/SqlCollectionTests.py
branches/unhork/grassyknoll/tests/test_backends/test_LuceneCollection.py

Log:
Issue #159: Removed default __id__ sets in backends.


Modified:
branches/unhork/grassyknoll/collection/backends/lucene/LuceneCollection.py
==============================================================================
---
branches/unhork/grassyknoll/collection/backends/lucene/LuceneCollection.py
(original)
+++
branches/unhork/grassyknoll/collection/backends/lucene/LuceneCollection.py
Tue Jan 6 10:25:45 2009
@@ -340,9 +340,4 @@
assigned type. Any extra kwargs passed to constructor will be used as
defaults for
"""
- def __init__(self, **kwargs):
- # XXX this should die entirely
- super(LuceneNorman, self).__init__(**kwargs)
- self.__id__ = SmartFieldNorman.idField()
-
FieldType = SmartFieldNorman

Modified: branches/unhork/grassyknoll/collection/backends/sql/TableMaker.py
==============================================================================
--- branches/unhork/grassyknoll/collection/backends/sql/TableMaker.py
(original)
+++ branches/unhork/grassyknoll/collection/backends/sql/TableMaker.py Tue
Jan 6 10:25:45 2009
@@ -77,6 +77,7 @@
@type name: list of lists of string

>>> table=Table('pants')
+ >>> table.setIdField()
>>> table.size=Column(int, indexed=True)
>>> table.color=Column(unicode, indexed=True)
>>> table.bought_on=Column(datetime.date, optional=True)
@@ -111,7 +112,6 @@
super(Table, self).__init__()
self.name = name
self.multi_indexes = []
- self.__id__ = Column('VARCHAR(255)', primary_key=True,
optional=False)

def __setattr__(self, name, value):
if isinstance(value, Column):

Modified: branches/unhork/grassyknoll/tests/test_Smarts.py
==============================================================================
--- branches/unhork/grassyknoll/tests/test_Smarts.py (original)
+++ branches/unhork/grassyknoll/tests/test_Smarts.py Tue Jan 6 10:25:45
2009
@@ -15,6 +15,7 @@
memory_location = ObjectTemplate(path=None)

norman = LuceneNorman()
+norman.setIdField()
norman.size = SmartFieldNorman(store=True)
norman.color = SmartFieldNorman(store=True)


Modified:
branches/unhork/grassyknoll/tests/test_backends/SqlCollectionTests.py
==============================================================================
--- branches/unhork/grassyknoll/tests/test_backends/SqlCollectionTests.py
(original)
+++ branches/unhork/grassyknoll/tests/test_backends/SqlCollectionTests.py
Tue Jan 6 10:25:45 2009
@@ -14,11 +14,13 @@
import NSFCollectionTests
# Simple tests.
simple_table = TableMaker.Table('main')
+simple_table.setIdField()
simple_table.size = TableMaker.Column(int)
simple_table.color = TableMaker.Column(str)

# Shakespeare tests.
shakes_table = TableMaker.Table('main')
+shakes_table.setIdField()
shakes_table.act = TableMaker.Column(str)
shakes_table.play = TableMaker.Column(str)
shakes_table.scene = TableMaker.Column(str)
@@ -27,6 +29,7 @@

## nsf_table: describes how to store documents in SqliteCollection backend
##
nsf_table=TableMaker.Table('nsf')
+nsf_table.setIdField()

# unicode columns
nsf_table.Fld_Applictn = TableMaker.Column(unicode)

Modified:
branches/unhork/grassyknoll/tests/test_backends/test_LuceneCollection.py
==============================================================================
---
branches/unhork/grassyknoll/tests/test_backends/test_LuceneCollection.py
(original)
+++
branches/unhork/grassyknoll/tests/test_backends/test_LuceneCollection.py
Tue Jan 6 10:25:45 2009
@@ -14,6 +14,7 @@
memory_location = ObjectTemplate(path=None)

norman = LuceneNorman()
+norman.setIdField()
norman.size = SmartFieldNorman(store=True)
norman.color = SmartFieldNorman(store=True)

@@ -105,6 +106,7 @@
shakes_norman.contents = Unicode()

shakes_storage_norman = LuceneNorman()
+shakes_storage_norman.setIdField()
shakes_storage_norman.act = SmartFieldNorman(store=True)
shakes_storage_norman.play = SmartFieldNorman(store=True)
shakes_storage_norman.title = SmartFieldNorman(store=True)
@@ -149,6 +151,7 @@

## NSFLuceneNorman: describes how to store documents in LuceneCollection
backend ##
NSFLuceneNorman = LuceneNorman(unknown='delete')
+NSFLuceneNorman.setIdField()

# non-text and limited value fields are not tokenized
NSFLuceneNorman.Start_Date = SmartFieldNorman(store=True,
index='untokenized')

Reply all
Reply to author
Forward
0 new messages