dabo Commit
Revision 4625
Date: 2008-10-30 08:21:51 -0700 (Thu, 30 Oct 2008)
Author: Paul
Trac: http://svn.dabodev.com/trac/dabo/changeset/4625

Changed:
D   branches/paul_ss/dabo/biz/RemoteBizobj.py
U   branches/paul_ss/dabo/biz/__init__.py
U   branches/paul_ss/dabo/biz/dBizobj.py
U   branches/paul_ss/dabo/dApp.py
U   branches/paul_ss/dabo/dException.py
U   branches/paul_ss/dabo/db/dCursorMixin.py
D   branches/paul_ss/dabo/db/dbWeb.py
D   branches/paul_ss/dabo/lib/RemoteConnector.py
U   branches/paul_ss/dabo/lib/__init__.py
U   branches/paul_ss/dabo/lib/connParser.py
D   branches/paul_ss/dabo/lib/dejavuJSON.py
D   branches/paul_ss/dabo/lib/manifest.py

Log:
Reverted revisions 4552 and 4547 from my release branch.


Diff:
Deleted: branches/paul_ss/dabo/biz/RemoteBizobj.py

Modified: branches/paul_ss/dabo/biz/__init__.py
===================================================================
--- branches/paul_ss/dabo/biz/__init__.py       2008-10-30 15:07:20 UTC (rev 
4624)
+++ branches/paul_ss/dabo/biz/__init__.py       2008-10-30 15:21:51 UTC (rev 
4625)
@@ -20,8 +20,6 @@
 
 """
 from dBizobj import dBizobj
-from RemoteBizobj import RemoteBizobj
-
 from dAutoBizobj import dAutoBizobj
 from dAutoBizobj import autoCreateTables
 from dAutoBizobj import autoCreateTables

Modified: branches/paul_ss/dabo/biz/dBizobj.py
===================================================================
--- branches/paul_ss/dabo/biz/dBizobj.py        2008-10-30 15:07:20 UTC (rev 
4624)
+++ branches/paul_ss/dabo/biz/dBizobj.py        2008-10-30 15:21:51 UTC (rev 
4625)
@@ -8,8 +8,8 @@
 from dabo.dLocalize import _
 import dabo.dException as dException
 from dabo.dObject import dObject
-from dabo.lib.RemoteConnector import _RemoteConnector as remote
 
+
 NO_RECORDS_PK = "75426755-2f32-4d3d-86b6-9e2a1ec47f2c"  ## Can't use None
 
 
@@ -111,10 +111,6 @@
                        self.createCursor()
 
 
-       def _getConnection(self):
-               return self._connection
-
-
        def getTempCursor(self):
                """Occasionally it is useful to be able to run ad-hoc queries 
against
                the database. For these queries, where the results are not 
meant to
@@ -175,7 +171,6 @@
                        crs.requery()
                        self.first()
                self.afterCreateCursor(crs)
-               return crs
 
 
        def _getCursorClass(self, main, secondary):
@@ -266,7 +261,6 @@
                self.afterLast()
 
 
-       @remote
        def beginTransaction(self):
                """Attempts to begin a transaction at the database level, and 
returns
                True/False depending on its success. 
@@ -277,7 +271,6 @@
                return ret
 
 
-       @remote
        def commitTransaction(self):
                """Attempts to commit a transaction at the database level, and 
returns
                True/False depending on its success. 
@@ -288,7 +281,6 @@
                return ret
 
 
-       @remote
        def rollbackTransaction(self):
                """Attempts to rollback a transaction at the database level, 
and returns
                True/False depending on its success. 
@@ -335,7 +327,6 @@
                                del(dabo._bizTransactionToken)
 
 
-       @remote
        def saveAll(self, startTransaction=True):
                """Saves all changes to the bizobj and children."""
                cursor = self._CurrentCursor
@@ -371,7 +362,6 @@
                                dabo.errorLog.write(_("Failed to set RowNumber. 
Error: %s") % e)
 
 
-       @remote
        def save(self, startTransaction=True):
                """Save any changes that have been made in the current row.
 
@@ -495,7 +485,6 @@
                self.afterDeleteAllChildren()
 
 
-       @remote
        def delete(self, startTransaction=True, inLoop=False):
                """Delete the current row of the data set."""
                cursor = self._CurrentCursor
@@ -586,24 +575,6 @@
                return self._CurrentCursor.executeSafe(sql, params)
 
 
-       def getDataDiff(self, allRows=False):
-               """Get a dict that is keyed on the hash value of this bizobj, 
with the value
-               being  a list of record changes. Default behavior is to only 
consider the
-               current row; you can change that by passing allRows=True. Each 
changed 
-               row will be present in the diff, with its PK and any columns 
whose values
-               have changed. If there are any related child bizobjs, their 
diffs will be
-               added to the dict under the key 'children' so that they can be 
processed
-               accordingly.
-               """
-               diff = {hash(self): 
self._CurrentCursor.getDataDiff(allRows=allRows)}
-               kids = []
-               for child in self.__children:
-                       kids.append(child.getDataDiff(allRows=True))
-               if kids:
-                       diff["children"] = kids
-               return diff
-
-
        def getChangedRows(self, includeNewUnchanged=False):
                """ Returns a list of row numbers for which isChanged() returns 
True. The
                changes may therefore not be in the record itself, but in a 
dependent child
@@ -815,7 +786,6 @@
                        self.UserSQL = sql
 
 
-       @remote
        def requery(self):
                """ Requery the data set.
 
@@ -1313,7 +1283,7 @@
                if self.KeyField is None:
                        raise dException.dException, _("No key field defined 
for table: ") + self.DataSource
                cc = self._CurrentCursor
-               return cc.getFieldVal(self.KeyField)
+               return cc.getFieldVal(cc.KeyField)
 
 
        def getParentPK(self):
@@ -1428,7 +1398,7 @@
                callback(self._rowTemplate % ("%s%s" % (xml, kidXML)), level)
 
 
-       def getDataSet(self, flds=(), rowStart=0, rows=None, 
returnInternals=False):
+       def getDataSet(self, flds=(), rowStart=0, rows=None):
                """ Get the entire data set encapsulated in a list.
 
                If the optional 'flds' parameter is given, the result set will 
be filtered
@@ -1438,22 +1408,10 @@
                ret = None
                cc = self._CurrentCursor
                if cc is not None:
-                       ret = self._CurrentCursor.getDataSet(flds, rowStart, 
rows, returnInternals=returnInternals)
+                       ret = self._CurrentCursor.getDataSet(flds, rowStart, 
rows)
                return ret
 
 
-       def getDataTypes(self):
-               """Returns the field type definitions as set in the cursor."""
-               return self._CurrentCursor.getDataTypes()
-
-
-       def _storeData(self, data, typs):
-               """Accepts a data set and type defintion dict, and updates the 
cursor
-               with these values.
-               """
-               self._CurrentCursor._storeData(data, typs)
-
-
        def getDataStructure(self):
                """ Gets the structure of the DataSource table. Returns a list
                of 3-tuples, where the 3-tuple's elements are:
@@ -1725,13 +1683,11 @@
 with the afterSave() hook which only gets called after a save(), and the 
 afterDelete() which is only called after a delete().""")       
 
-
        def afterCreateCursor(self, crs):
                """This hook is called after the underlying cursor object is 
created.
                The crs argument will contain the reference to the newly-created
                cursor."""
 
-
        def _syncWithCursors(self):
                """Many bizobj properties need to be passed through to the 
cursors
                that provide it with data connectivity. This method ensures 
that all
@@ -1753,17 +1709,8 @@
                crs.Encoding = self.Encoding
                crs.KeyField = self._keyField
                crs.setNonUpdateFields(self._nonUpdateFields)
+       
 
-
-       def _cursorDictReference(self):
-               """In rare situations, bizobj subclasses may need to reference 
the 
-               internal __cursors attribute. This provides a way to do that, 
but 
-               it should be stressed that this is potentially dangerous and 
could 
-               lead to lost data if not handled correctly.
-               """
-               return self.__cursors
-
-
        ## Property getter/setter methods ##
        def _getAutoPopulatePK(self):
                try:

Modified: branches/paul_ss/dabo/dApp.py
===================================================================
--- branches/paul_ss/dabo/dApp.py       2008-10-30 15:07:20 UTC (rev 4624)
+++ branches/paul_ss/dabo/dApp.py       2008-10-30 15:21:51 UTC (rev 4625)
@@ -22,10 +22,8 @@
 from dabo.lib.SimpleCrypt import SimpleCrypt
 from dabo.dObject import dObject
 from dabo import dUserSettingProvider
-from dabo.lib.RemoteConnector import _RemoteConnector as remote
 
 
-
 class Collection(list):
        """ Collection : Base class for the various collection
        classes used in the app object.
@@ -226,7 +224,7 @@
                self.default_form = None
                # Dict of "Last-Modified" values for dynamic web resources
                self._sourceLastModified = {}
-               
+
                # For simple UI apps, this allows the app object to be created
                # and started in one step. It also suppresses the display of
                # the main form.
@@ -234,11 +232,6 @@
                        self.showMainFormOnStart = False
                        self.setup()
 
-               self._initDB()
-
-               # If running as a web app, sync the files
-               self.syncFiles()
-
                self._afterInit()
                self.autoBindEvents()
                
@@ -274,7 +267,7 @@
 
                self._initModuleNames()
                self._initDB()
-
+               
                if initUI:
                        self._initUI()
                        if self.UI is not None:
@@ -663,44 +656,6 @@
                        dabo.infoLog.write(_("File %s updated") % pth)
 
 
-       def updateFromSource(self, fileOrFiles):
-               """This method takes either a single file path or a list of 
paths, and if there
-               is a SourceURL set, checks the source to see if there are newer 
versions available,
-               and if so, downloads them.
-               """
-               if not self.SourceURL:
-                       # Nothing to do
-                       return
-               if isinstance(fileOrFiles, (list, tuple)):
-                       for f in fileOrFiles:
-                               self.updateFromSource(f)
-                       return
-               pth = fileOrFiles
-               cwd = os.getcwd()
-               # The srcFile has an absolute path; the URLs work on relative.
-               try:
-                       splt = srcFile.split(cwd)[1].lstrip("/")
-               except IndexError:
-                       splt = srcFile
-               app.urlFetch(splt)
-               try:
-                       nm, ext = os.path.splitext(splt)
-               except ValueError:
-                       # No extension; skip it
-                       nm = ext = ""
-               if ext == ".cdxml":
-                       # There might be an associated code file. If not, the 
error
-                       # will be caught in the app method, and no harm will be 
done.
-                       codefile = "%s-code.py" % nm
-                       app.urlFetch(codefile)
-
-
-       @remote
-       def syncFiles(self):
-               # Currently only used in web mode
-               pass
-
-
        def getUserSettingKeys(self, spec):
                """Return a list of all keys underneath <spec> in the user 
settings table.
                

Modified: branches/paul_ss/dabo/dException.py
===================================================================
--- branches/paul_ss/dabo/dException.py 2008-10-30 15:07:20 UTC (rev 4624)
+++ branches/paul_ss/dabo/dException.py 2008-10-30 15:21:51 UTC (rev 4625)
@@ -68,9 +68,7 @@
        pass
 
 class DBQueryException(DatabaseException):
-       def __init__(self, err, sql=None):
-               if sql is None:
-                       sql = ""
+       def __init__(self, err, sql):
                self.sql = sql
                self.err_desc = "%s" % err
                
@@ -79,6 +77,3 @@
 
 class XmlException(dException):
        pass
-
-class WebServerException(dException):
-       pass

Modified: branches/paul_ss/dabo/db/dCursorMixin.py
===================================================================
--- branches/paul_ss/dabo/db/dCursorMixin.py    2008-10-30 15:07:20 UTC (rev 
4624)
+++ branches/paul_ss/dabo/db/dCursorMixin.py    2008-10-30 15:21:51 UTC (rev 
4625)
@@ -991,39 +991,29 @@
                        rec[fld] = val
 
 
-       def getRecordStatus(self, row=None, pk=None):
+       def getRecordStatus(self, row=None):
                """ Returns a dictionary containing an element for each changed
                field in the specified record (or the current record if none is 
specified).
                The field name is the key for each element; the value is a 
2-element
                tuple, with the first element being the original value, and the 
second
-               being the current value. You can specify the record by either 
the 
-               row number or the PK.
+               being the current value.
                """
                ret = {}
-               if pk is not None:
-                       recs = [r for r in self._records
-                                       if r[self._keyField] == pk]
-                       try:
-                               rec = recs[0]
-                       except IndexError:
-                               return ret
-               else:
-                       if row is None:
-                               row = self.RowNumber
-                       rec = self._records[row]
-                       pk = self.pkExpression(rec)
+               if row is None:
+                       row = self.RowNumber
 
-               mem = self._mementos.get(pk, {})
+               rec = self._records[row]
+               recKey = self.pkExpression(rec)
+               mem = self._mementos.get(recKey, {})
 
                for k, v in mem.items():
                        ret[k] = (v, rec[k])
                return ret
 
 
-       def _getNewRecordDiff(self, row=None, pk=None):
+       def _getNewRecordDiff(self, row=None):
                """ Returns a dictionary containing an element for each field
-               in the specified record (or the current record if none is 
specified). You
-               may specify the record by either row number or PK value.
+               in the specified record (or the current record if none is 
specified).
                The field name is the key for each element; the value is a 
2-element
                tuple, with the first element being the original value, and the 
second
                being the current value.
@@ -1031,19 +1021,10 @@
                This is used internally in __saverow, and only applies to new 
records.
                """
                ret = {}
-               if pk is not None:
-                       recs = [r for r in self._records
-                                       if r[self._keyField] == pk]
-                       try:
-                               rec = recs[0]
-                       except IndexError:
-                               return ret
-               else:
-                       if row is None:
-                               row = self.RowNumber
-                       rec = self._records[row]
-                       pk = self.pkExpression(rec)
+               if row is None:
+                       row = self.RowNumber
 
+               rec = self._records[row]
                for k, v in rec.items():
                        if k not in (kons.CURSOR_TMPKEY_FIELD,):
                                ret[k] = (None, v)
@@ -1086,41 +1067,12 @@
                                if not flds and not returnInternals:
                                        # user didn't specify explicit fields 
and doesn't want internals
                                        for internal in internals:
-                                               tmprec.pop(internal, None)
+                                               if tmprec.has_key(internal):
+                                                       del tmprec[internal]
                                ds.append(tmprec)
                return dDataSet(ds)
 
 
-       def getDataTypes(self):
-               """Returns the internal _types dict."""
-               return self._types
-
-
-       def _storeData(self, data, typs):
-               """Accepts a dataset and type dict from an external source and
-               uses it as its own.
-               """
-               # clear mementos and new record flags:
-               self._mementos = {}
-               self._newRecords = {}
-               # If None is passed as the data, exit after resetting the flags
-               if data is None:
-                       return
-               # Store the values
-               self._records = data
-               self._types = typs
-               # Need to do this here to avoid lags later on.
-               self._getDataStructure()
-               # Clear the unsorted list, and then apply the current sort
-               self.__unsortedRows = []
-               if self.sortColumn:
-                       try:
-                               self.sort(self.sortColumn, self.sortOrder)
-                       except dException.NoRecordsException, e:
-                               # No big deal
-                               pass
-
-
        def replace(self, field, valOrExpr, scope=None):
                """Replaces the value of the specified field with the given 
value
                or expression. All records matching the scope are affected; if
@@ -1371,31 +1323,6 @@
                rec.pop(kons.CURSOR_TMPKEY_FIELD, None)
 
 
-       def getDataDiff(self, allRows=False):
-               """Create a compact representation of all the modified records
-               for this cursor.
-               """
-               diff = []
-               def rowDiff(pk):
-                       newrec = pk in self._newRecords
-                       if newrec:
-                               ret = self._getNewRecordDiff(pk=pk)
-                       else:
-                               ret = self.getRecordStatus(pk=pk)
-                       ret[self._keyField] = pk
-                       ret[kons.CURSOR_TMPKEY_FIELD] = newrec
-                       return ret
-                       
-               if allRows:
-                       for pk in self._mementos.keys():
-                               diff.append(rowDiff(pk))
-               else:
-                       pk = self.getPK()
-                       if pk in self._mementos:
-                               diff.append(rowDiff(pk))
-               return diff
-
-
        def pregenPK(self):
                """Various backend databases require that you manually
                generate new PKs if you need to refer to their values afterward.

Deleted: branches/paul_ss/dabo/db/dbWeb.py

Deleted: branches/paul_ss/dabo/lib/RemoteConnector.py

Modified: branches/paul_ss/dabo/lib/__init__.py
===================================================================
--- branches/paul_ss/dabo/lib/__init__.py       2008-10-30 15:07:20 UTC (rev 
4624)
+++ branches/paul_ss/dabo/lib/__init__.py       2008-10-30 15:21:51 UTC (rev 
4625)
@@ -8,7 +8,6 @@
 #      import dabo.lib.ofFunctions as oFox
 
 import uuid
-import dabo
 
 
 def getRandomUUID():
@@ -17,32 +16,3 @@
 
 def getMachineUUID():
        return str(uuid.uuid1())
-
-
-try:
-       import simplejson
-except:
-       jsonConverter = None
-       def jsonEncode(val): raise ImportError, "The simplejson module is not 
installed"
-       def jsonDecode(val): raise ImportError, "The simplejson module is not 
installed"
-else:
-       import dejavuJSON
-       jsonConverter = dejavuJSON.Converter()
-       def jsonEncode(val):
-               return jsonConverter.dumps(val)
-       
-       def jsonDecode(val):
-               ret = None
-               try:
-                       ret = jsonConverter.loads(val)
-               except UnicodeDecodeError:
-                       # Try typical encodings, starting with the default.
-                       for enctype in (dabo.defaultEncoding, "utf-8", 
"latin-1"):
-                               try:
-                                       ret = jsonConverter.loads(val, enctype)
-                                       break
-                               except UnicodeDecodeError:
-                                       continue
-               if ret is None:
-                       raise
-               return ret

Modified: branches/paul_ss/dabo/lib/connParser.py
===================================================================
--- branches/paul_ss/dabo/lib/connParser.py     2008-10-30 15:07:20 UTC (rev 
4624)
+++ branches/paul_ss/dabo/lib/connParser.py     2008-10-30 15:21:51 UTC (rev 
4625)
@@ -15,7 +15,6 @@
                                "name": "",
                                "dbtype" : "",
                                "host" : "",
-                               "remotehost" : "",
                                "database" : "",
                                "user" : "",
                                "password" : "",

Deleted: branches/paul_ss/dabo/lib/dejavuJSON.py

Deleted: branches/paul_ss/dabo/lib/manifest.py




_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: http://leafe.com/archives/byMID/[EMAIL PROTECTED]

Reply via email to