Changeset 126

Show
Ignore:
Timestamp:
Sat Jul 8 21:32:12 2006
Author:
Brian
Message:

Added way to tell server about new table aliases.

Files:

Legend:

Unmodified
Added
Removed
Modified
  • server/trunk/update/server/Data.py

    r114 r126  
    939 939         if len(undo) > 2:  
    940 940             CheckChange(undo)  
      941  
      942         if change['Table'] == 'ForeignKey':  # add alias to table if needed  
      943             for k, v in change:  
      944                 if k in ('Table', 'ID', 'zzStatus'): continue  # these don't define foreign keys  
      945                 if k.count('/') != 1: continue  # format is tablename/columnname  
      946                 part = k.split('/')[1]  # get the column name  
      947                 if len(part) < 3 or part[-2:] != 'ID': continue  # these would be invalid foreign keys  
      948                 if not v or v not in Database: continue  # can't define an alias to non existent table  
      949                 alias = part[:-2]  
      950                 if alias not in Database or Database[alias] != Database[v]:  
      951                     Database[alias] = Database[v]  # define alias  
    941 952     else:  
    942 953         record = {}  
  • server/trunk/update/server/ganttpv_update_server.py

    r92 r126  
    254 254     for k, v in rows_needed.iteritems():  
    255 255 #        if k in ('NextID', 'Prerequisite', 'PriorMeasurement'): continue  # allow other for now  
    256           if k in ('NextID', 'Other', 'Prerequisite', 'PriorMeasurement'): continue  
    257           if not isinstance(k, basestring): continue  
    258           if v < 0 or not (isinstance(v, int)): continue  # ignore invalid values  
      256         if k in ('NextID', 'Other', 'Prerequisite', 'PriorMeasurement', 'ResourceGroup'): continue  
      257         if not isinstance(k, basestring): continue  # table name must be a string  
      258         if v < 0 or not (isinstance(v, int)): continue  # ignore invalid values  
      259  
      260         # if client has added a new table, add it here  
      261         # -- problem - how do we know if the client has added an alias? fixed in Data.Update  
      262         # -- how will all of the other clients know? fixed in Data.Update  
    259 263         if not Data.NextID.has_key(k):  
    260 264             Data.NextID[k] = 1