merge stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 02 Oct 2009 08:57:55 +0200
branchstable
changeset 3549 63718638352e
parent 3548 4cf5a360952e (diff)
parent 3545 242b07b6d820 (current diff)
child 3550 f9bdcfeb12ee
merge
--- a/entity.py	Thu Oct 01 17:15:46 2009 +0200
+++ b/entity.py	Fri Oct 02 08:57:55 2009 +0200
@@ -924,8 +924,12 @@
         :return: the list of indexable word of this entity
         """
         from indexer.query_objects import tokenize
+        # take care to cases where we're modyfying the schema
+        pending = self.req.transaction_data.setdefault('pendingrdefs', set())
         words = []
         for rschema in self.e_schema.indexable_attributes():
+            if (self.e_schema, rschema) in pending:
+                continue
             try:
                 value = self.printable_value(rschema, format='text/plain')
             except TransformError:
--- a/server/migractions.py	Thu Oct 01 17:15:46 2009 +0200
+++ b/server/migractions.py	Fri Oct 02 08:57:55 2009 +0200
@@ -626,6 +626,10 @@
         if card == '1':
             rql += ', NOT X %s NULL' % oldname
         self.rqlexec(rql, ask_confirm=self.verbosity>=2)
+        # XXX if both attributes fulltext indexed, should skip fti rebuild
+        # XXX if old attribute was fti indexed but not the new one old value
+        # won't be removed from the index (this occurs on other kind of
+        # fulltextindexed change...)
         self.cmd_drop_attribute(etype, oldname, commit=commit)
 
     def cmd_add_entity_type(self, etype, auto=True, commit=True):
--- a/server/schemahooks.py	Thu Oct 01 17:15:46 2009 +0200
+++ b/server/schemahooks.py	Fri Oct 02 08:57:55 2009 +0200
@@ -812,14 +812,15 @@
     """
     subjschema, rschema, objschema = session.schema.schema_by_eid(rdefeid)
     pendings = session.transaction_data.get('pendingeids', ())
+    pendingrdefs = session.transaction_data.setdefault('pendingrdefs', set())
     # first delete existing relation if necessary
     if rschema.is_final():
         rdeftype = 'CWAttribute'
+        pendingrdefs.add((subjschema, rschema))
     else:
         rdeftype = 'CWRelation'
+        pendingrdefs.add((subjschema, rschema, objschema))
         if not (subjschema.eid in pendings or objschema.eid in pendings):
-            pending = session.transaction_data.setdefault('pendingrdefs', set())
-            pending.add((subjschema, rschema, objschema))
             session.execute('DELETE X %s Y WHERE X is %s, Y is %s'
                             % (rschema, subjschema, objschema))
     execute = session.unsafe_execute
--- a/server/serverconfig.py	Thu Oct 01 17:15:46 2009 +0200
+++ b/server/serverconfig.py	Fri Oct 02 08:57:55 2009 +0200
@@ -163,7 +163,7 @@
           }),
         # pyro server.serverconfig
         ('pyro-host',
-         {'type' : 'int',
+         {'type' : 'string',
           'default': None,
           'help': 'Pyro server host, if not detectable correctly through \
 gethostname(). It may contains port information using <host>:<port> notation, \
--- a/server/test/data/migratedapp/schema.py	Thu Oct 01 17:15:46 2009 +0200
+++ b/server/test/data/migratedapp/schema.py	Fri Oct 02 08:57:55 2009 +0200
@@ -88,7 +88,7 @@
 class Personne(EntityType):
     nom    = String(fulltextindexed=True, required=True, maxsize=64)
     prenom = String(fulltextindexed=True, maxsize=64)
-    civility   = String(maxsize=1, default='M')
+    civility   = String(maxsize=1, default='M', fulltextindexed=True)
     promo  = String(vocabulary=('bon','pasbon'))
     titre  = String(fulltextindexed=True, maxsize=128)
     adel   = String(maxsize=128)
--- a/server/test/data/schema.py	Thu Oct 01 17:15:46 2009 +0200
+++ b/server/test/data/schema.py	Fri Oct 02 08:57:55 2009 +0200
@@ -82,7 +82,7 @@
 class Personne(EntityType):
     nom    = String(fulltextindexed=True, required=True, maxsize=64)
     prenom = String(fulltextindexed=True, maxsize=64)
-    sexe   = String(maxsize=1, default='M')
+    sexe   = String(maxsize=1, default='M', fulltextindexed=True)
     promo  = String(vocabulary=('bon','pasbon'))
     titre  = String(fulltextindexed=True, maxsize=128)
     adel   = String(maxsize=128)