[mythtv-commits] mythtv commit: r25147 - in trunk/mythtv/bindings/python by wagnerrp

mythtv at cvs.mythtv.org mythtv at cvs.mythtv.org
Mon Jun 21 00:21:47 UTC 2010


      Author: wagnerrp
        Date: 2010-06-21 00:21:47 +0000 (Mon, 21 Jun 2010)
New Revision: 25147
   Changeset: http://svn.mythtv.org/trac/changeset/25147

Added:

   trunk/mythtv/bindings/python/MythTV/altdict.py
   trunk/mythtv/bindings/python/MythTV/connections.py
   trunk/mythtv/bindings/python/MythTV/database.py
   trunk/mythtv/bindings/python/MythTV/dataheap.py
   trunk/mythtv/bindings/python/MythTV/exceptions.py
   trunk/mythtv/bindings/python/MythTV/logging.py
   trunk/mythtv/bindings/python/MythTV/methodheap.py
   trunk/mythtv/bindings/python/MythTV/msearch.py
   trunk/mythtv/bindings/python/MythTV/mythproto.py
   trunk/mythtv/bindings/python/MythTV/static.py
   trunk/mythtv/bindings/python/MythTV/system.py
   trunk/mythtv/bindings/python/MythTV/utility.py

Removed:

   trunk/mythtv/bindings/python/MythTV/MythBase.py
   trunk/mythtv/bindings/python/MythTV/MythData.py
   trunk/mythtv/bindings/python/MythTV/MythFunc.py
   trunk/mythtv/bindings/python/MythTV/MythStatic.py

Modified:

   trunk/mythtv/bindings/python/MythTV/__init__.py
   trunk/mythtv/bindings/python/MythTV/wikiscripts/wikiscripts.py
   trunk/mythtv/bindings/python/python.pro
   trunk/mythtv/bindings/python/scripts/mythpython
   trunk/mythtv/bindings/python/setup.py

Log:

This is a big reorganization. The individual modules were getting a bit
large to maintain.  This is an internal reorganization and should be 
transparent to external programs using the bindings.
   static.py      - renamed from MythStatic.py, same purpose
   exceptions.py  - MythError class and subclasses
   logging.py     - MythLog class
   msearch.py     - UPnP M-Search implementation, split out from the database
                    auto-detect code
   utility.py     - collection of decorators and other tools
   altdict.py     - alternate dictionary-like classes
   connections.py - base connection classes for database, backend, frontend,
                    and xml
   database.py    - managed database access, with connection cache, config.xml
                    and upnp lookup, and table data handlers
   system.py      - classes for running external executables
   mythproto.py   - managed backend access, with connection cache, event
                    handler, and file transfer
   dataheap.py    - collection of data management classes
   methodheap.py  - collection of methods used against database, backend,
                    frontend, and xml connections

To facilitate the reorganization, and help prevent future circular dependency
issues, several methods have been rewritten as classmethods.
   Program().getRecorded()                 Recorded.fromProgram()
   Program().record()           --->       Record.fromProgram()
   Recorded().getProgram()                 Program.fromRecorded()

This model is continued in other locations.  DBData and DBDataWrite classes 
no longer accept raw input from a database query, but use the fromRaw()
classmethod instead.  Similarly, classes accepting eTree objects from xml use
a fromEtree() classmethod.  This should be more maintainable than large
class constructors, overloaded through keywork arguments.

QuickDictData is renamed to OrdDict, and is an ordered dictionary subclassed 
off the dict class.  DictData is now based off OrdDict.

Exception classes are no longer identical.  Error codes can only be used
against their related exception type.  All are still subclassed to MythError,
and can be caught using that base class.

Several places that used to returns lists now use iterators or generators. This
allows data to be processed 'lazily', meaning functions will return as soon as
the external data source responds, rather than waiting for internal processing
of the data. This also means methods will always return an iterable, and checks
for 'None' prior to use are unnecessary. If the old behavior is required, the
can simply be wrapped in a list().

Ref #8577.





More information about the mythtv-commits mailing list