Changeset 216

Show
Ignore:
Timestamp:
Sat Sep 30 10:56:06 2006
Author:
Alexander
Message:

Server: numerous small but useful fixes

Files:

Legend:

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

    r182 r216  
    37 37 import datetime  
    38 38 import os  
      39 import sys  
    39 40 import random  
    40 41 import cPickle  
     
    48 49 server_name = "GanttPV Server"  # unique - use letters, digits, and spaces only  
    49 50                                 # if omitted, server will not publish via zero config  
    50   # server_ip = "192.168.0.3"  # server location - change to actual address  
    51   server_ip = "10.46.22.35"  # server location - change to actual address  
      51 server_ip = "192.168.0.3"  # server location - change to actual address  
      52 # server_ip = "10.46.22.35"  # server location - change to actual address  
    52 53 server_port = 8001  
    53 54 # this key is required to add databases to server  
     
    55 56  
    56 57 # directories  
    57   current = "current"  # all currently served databases  
    58   backup = "backup"  # all backups  
      58 Path = os.path.abspath(sys.argv[0])  
      59 Path = os.path.dirname(Path)  
      60 current = os.path.join(Path, "current")  # all currently served databases  
      61 backup = os.path.join(Path, "backup")  # all backups  
    59 62  
    60 63 SessionsFile = ""  
     
    663 666 # Local changes could be added to the change list when setundo is called.  
    664 667  
      668 def SaveLocalChanges():  
      669     """ Use the UndoStack to capture the server's own changes. """  
      670  
      671     delta = {}  
      672     while Data.UndoStack:  
      673         undo = Data.UndoStack.pop()  
      674         if not isinstance(undo, dict):  
      675             continue  
      676         key = (undo['Table'], undo['ID'])  
      677         if key in delta:  
      678             delta[key].update(undo)  # use the earliest version  
      679         else:  
      680             delta[key] = undo  
      681  
      682     updates = GetUpdates()  
      683     for (table, id), undo in delta.iteritems():  
      684         change = {}  
      685         for k, v in undo.iteritems():  
      686             change['_' + k] = v  
      687             change[k] = Data.Database[table][id][k]  
      688         updates.append(change)  
      689  
    665 690 def SetUndo(s):  # equivalent of Data.SetUndo  
    666 691     autogantt = Data.Option.get('AutoGantt')  
     
    668 693     UpdateGantt = UpdateCalendar or (Data.ChangedSchedule and autogantt)  
    669 694  
      695     Data.UndoStack = []  
    670 696     if UpdateCalendar:  
    671 697         Data.SetupDateConv(); Data.ChangedCalendar = False  
     
    676 702         Data.AdjustReportRows(); Data.ChangedRow = False  
    677 703     Data.ChangedData = True  # file needs to be saved  
      704     # SaveLocalChanges()  
    678 705  
    679 706 # avoid some xmlrpc problems with Nones  
  • server/trunk/update/server/ganttpv_show_keys.py

    r182 r216  
    24 24 import Data  
    25 25 import os  
      26 import sys  
    26 27  
    27 28 clientnames = ("OwnerKey", "EditKey", "ViewKey")  
     
    69 70             ShowKeys()  
    70 71  
    71   DoEachDb('current')  
      72 Path = os.path.abspath(sys.argv[0])  
      73 Path = os.path.dirname(Path)  
      74 current = os.path.join(Path, "current")  
      75 DoEachDb(current)  
  • server/trunk/update/server/HTML.py

    r207 r216  
    295 295     db = parms.get('DB')  
    296 296     db_link = '<a class="index" href="ganttpv_report.py">Database Index</a>'  
      297     webname = Data.Other.get('WebName') or 'Project Database'  
    297 298  
    298 299     fp.write(header1)  
    299       fp.write(MakeString(_("Project Database - Web Report Index")))  
      300     fp.write(MakeString(_("%s - Web Report Index") % webname))  
    299 300     fp.write(header2 % ("", db_link))  
    300 301     fp.write('<h3>')  
    301       fp.write(MakeString(_("Web Reports in Project Database")))  
      302     fp.write(MakeString(_("Web Reports in %s") % webname))  
    301 302     fp.write('</h3>\r')  
    302 303     fp.write(header2a)  
  • server/trunk/update/client/Download Database from Server.py

    r189 r216  
    24 24 # 060830 - prevent deprecation message in log file  
    25 25  
      26 def hint(s):  
      27     try:  
      28         Data.Hint("%s: %s" % (scriptname, s))  
      29     except AttributeError:  
      30         self.SetStatusText(s)  
      31  
    26 32 def DoCall():  
    27 33     import warnings  
     
    68 74  
    69 75     try:  
    70           result = server. get_database(parms)  
    71    
      76         result = server.get_database(parms)  
    72 77     except xmlrpclib.Error, v:  
    73 78         print "Refresh Server ERROR", v  
    74 79         return  
    75 80  
      81     if not result:  
      82         hint("The server did not accept our key.")  
      83         return  
      84  
    76 85     normal, aliases, exceptions = result  
    77 86     if debug: print "normal\n", normal, "aliases\n", aliases, "exceptions\n", exceptions