Changeset 191

Show
Ignore:
Timestamp:
Sun Sep 3 21:28:39 2006
Author:
Brian
Message:

Several fixes for client scripts that work with the server.

Files:

Legend:

Unmodified
Added
Removed
Modified
  • server/trunk/update/client/Prepare for Merge with Server.py

    r174 r191  
    20 20 # Change log:  
    21 21 # 060825 - first version of script  
      22 # 060903 - move the original task report row out of the range we are saying is the servers  
    22 23  
    23 24 def DoCall():  
     
    51 52     Data.Other['ServerKey'] = server_key  # sent to server w/ requests  
    52 53  
      54     # change the number of report row 4 so that it will be added  
      55     if Data.Database['ReportRow'].has_key(4):  
      56         change = Data.Database['ReportRow'][4].copy()  
      57         del change['ID']  
      58         change['Table'] = 'ReportRow'  
      59         newid = Data.Update(change)['ID']  
      60         #  
      61         id = Data.SearchByColumn(Data.Database['Report'], {'FirstRow': 4}, True)  
      62         if id:  
      63             change = {'Table': 'Report', 'ID': id, 'FirstRow': newid}  
      64             Data.Update(change)  
      65         #  
      66         id = Data.SearchByColumn(Data.Database['ReportRow'], {'NextRow': 4}, True)  
      67         if id:  
      68             change = {'Table': 'ReportRow', 'ID': id, 'FirstRow': newid}  
      69             Data.Update(change)  
      70         #  
      71 #       del Data.Database['ReportRow'][4]  
      72  
    53 73     # setup required picture of the server keys  
    54 74     # I am basing this on a save file from version 0.6 beta 3  
     
    65 85         next['_ReportRow'] = 71  # may be a problem, I don't want to keep #4  
    66 86         next['_ReportType'] = 13  # use server's report types  
      87         next['_TableAlias'] = 2  # use the server's alias table  <- THIS IS STILL AN ISSUE  
      88         # do I need to prep any of the aliases as changes? To do so, I would have to know which the server already has.  
    67 89  
    68 90 DoCall()  
  • server/trunk/update/client/Share Changes with Server.py

    r189 r191  
    33 33 # 060825 - Alex - merge/delete duplicated records  
    34 34 # 060831 - prevent deprecation message in log file; check for server ip address  
      35 # 060903 - fix de-dup of column types; adjust foreign keys in report's SelectValue  
    35 36  
    36 37 debug = 1  
     
    179 180                             else:  
    180 181                                 table = cname[:-2]  
      182                         elif tname == 'Report' and cname == 'SelectValue':  
      183                             selcol = row.get('SelectColumn')  
      184                             if selcol and len(selcol) > 2 and selcol[-2:] == 'ID':  
      185                                 table = selcol[:-2]  # this works for 'ProjectID', what other values can be here?  
      186                                 if debug: print "Changed SelectValue %s from %d" % (selcol, value)  
      187                             else:  
      188                                 continue  
    181 189                         else:  # not a foreign key  
    182 190                             continue  
     
    359 367         DupNames('ReportType', 'Name')  # prevent duplicate report type names  
    360 368  
      369         # apply de-dup of report types to column types  
      370         # must be done here so column types can be de-dup'ed  
      371         if debug: print "changeids: ", changeids  
      372         for k, v in Data.Database['ColumnType'].iteritems():  
      373             rtid = v.get('ReportTypeID')  
      374             if ('ReportType', rtid) in changeids:  # it is a dup  
      375                 change = {'Table': 'ColumnType', 'ID': k,  
      376                     'ReportTypeID': changeids[('ReportType', rtid)]}  
      377                 Data.Update(change, 0)   # We want these changes to be picked up by FindChanges  
      378                 if debug: print "adjusting fk in ColumnType at ReportTypeID from %d to %d" % (rtid, changeids[('ReportType', rtid)])  
      379  
    361 380         # prevent duplicate links  
    362 381         def DupPair(table, columna, columnb):  
     
    411 430                         else:  
    412 431                             table = cname[:-2]  
      432                     elif tname == 'Report' and cname == 'SelectValue':  
      433                         selcol = row.get('SelectColumn')  
      434                         if selcol and len(selcol) > 2 and selcol[-2:] == 'ID':  
      435                             table = selcol[:-2]  # this works for 'ProjectID', what other values can be here?  
      436                             if debug: print "Changed %s from %d" % (selcol, value)  
      437                         else:  
      438                             continue  
    413 439                     else:  # not a foreign key  
    414 440                         continue  
     
    418 444                 if change:  
    419 445                     if debug: print "changing a foreign key"  
    420                       change['Table'] = table  
      446                     change['Table'] = tname  
    420 446                     change['ID'] = rid  
    421 447                     Data.Update(change, 0)   # We want these changes to be picked up by FindChanges