commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnue] r10259 - in trunk/gnue-common: . src/apps src/datasources src/log


From: reinhard
Subject: [gnue] r10259 - in trunk/gnue-common: . src/apps src/datasources src/logic src/logic/adapters
Date: Thu, 2 Dec 2010 17:29:23 -0600 (CST)

Author: reinhard
Date: 2010-12-02 17:29:23 -0600 (Thu, 02 Dec 2010)
New Revision: 10259

Modified:
   trunk/gnue-common/
   trunk/gnue-common/src/apps/GDebug.py
   trunk/gnue-common/src/apps/i18n.py
   trunk/gnue-common/src/datasources/ConnectionTriggerObj.py
   trunk/gnue-common/src/datasources/GConnections.py
   trunk/gnue-common/src/datasources/GDataSource.py
   trunk/gnue-common/src/datasources/GLoginHandler.py
   trunk/gnue-common/src/logic/NamespaceCore.py
   trunk/gnue-common/src/logic/adapters/Base.py
   trunk/gnue-common/src/logic/adapters/python.py
   trunk/gnue-common/src/logic/language.py
Log:
Cleanup of deprecated stuff.



Property changes on: trunk/gnue-common
___________________________________________________________________
Name: bzr:revision-info
   - timestamp: 2010-12-02 23:22:36.885999918 +0100
committer: Reinhard Müller <address@hidden>
properties: 
        branch-nick: common

   + timestamp: 2010-12-03 00:28:11.546999931 +0100
committer: Reinhard Müller <address@hidden>
properties: 
        branch-nick: common

Name: bzr:file-ids
   - src/definitions/GParser.py 
address@hidden:trunk%2Fgnue-common:src%2Fdefinitions%2FGParser.py

   + src/apps/GDebug.py 
address@hidden:trunk%2Fgnue-common:src%2Fapps%2FGDebug.py
src/apps/i18n.py        address@hidden:trunk%2Fgnue-common:src%2Fapps%2Fi18n.py
src/datasources/ConnectionTriggerObj.py 
address@hidden:trunk%2Fgnue-common:src%2Fdatasources%2FConnectionTriggerObj.py
src/datasources/GConnections.py 
address@hidden:trunk%2Fgnue-common:src%2Fdatasources%2FGConnections.py
src/datasources/GDataSource.py  
address@hidden:trunk%2Fgnue-common:src%2Fdatasources%2FGDataSource.py
src/datasources/GLoginHandler.py        
address@hidden:trunk%2Fgnue-common:src%2Fdatasources%2FGLoginHandler.py
src/logic/NamespaceCore.py      
address@hidden:trunk%2Fgnue-common:src%2Flogic%2FNamespaceCore.py
src/logic/adapters/Base.py      
address@hidden:trunk%2Fgnue-common:src%2Flogic%2Fadapters%2FBase.py
src/logic/adapters/python.py    
address@hidden:trunk%2Fgnue-common:src%2Flogic%2Fadapters%2Fpython.py
src/logic/language.py   
address@hidden:trunk%2Fgnue-common:src%2Flogic%2Flanguage.py

Name: bzr:revision-id:v4
   - 3116 address@hidden
3117 address@hidden
3118 address@hidden
3119 address@hidden
3120 address@hidden
3121 address@hidden
3122 address@hidden
3123 address@hidden
3124 address@hidden
3125 address@hidden
3126 address@hidden
3127 address@hidden
3128 address@hidden
3129 address@hidden
3130 address@hidden
3131 address@hidden
3132 address@hidden
3133 address@hidden
3134 address@hidden
3135 address@hidden
3136 address@hidden
3137 address@hidden
3138 address@hidden
3139 address@hidden
3140 address@hidden
3141 address@hidden
3142 address@hidden
3143 address@hidden
3144 address@hidden

   + 3116 address@hidden
3117 address@hidden
3118 address@hidden
3119 address@hidden
3120 address@hidden
3121 address@hidden
3122 address@hidden
3123 address@hidden
3124 address@hidden
3125 address@hidden
3126 address@hidden
3127 address@hidden
3128 address@hidden
3129 address@hidden
3130 address@hidden
3131 address@hidden
3132 address@hidden
3133 address@hidden
3134 address@hidden
3135 address@hidden
3136 address@hidden
3137 address@hidden
3138 address@hidden
3139 address@hidden
3140 address@hidden
3141 address@hidden
3142 address@hidden
3143 address@hidden
3144 address@hidden
3145 address@hidden

Name: bzr:text-parents
   - src/definitions/GParser.py 
svn-v3-single1-dHJ1bmsvZ251ZS1jb21tb24.:3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-common:10063

   + src/apps/GDebug.py 
svn-v3-single1-dHJ1bmsvZ251ZS1jb21tb24.:3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-common:9954
src/apps/i18n.py        
svn-v3-single1-dHJ1bmsvZ251ZS1jb21tb24.:3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-common:9954
src/datasources/ConnectionTriggerObj.py 
svn-v3-single1-dHJ1bmsvZ251ZS1jb21tb24.:3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-common:9986
src/datasources/GConnections.py address@hidden
src/datasources/GDataSource.py  address@hidden
src/datasources/GLoginHandler.py        
svn-v3-single1-dHJ1bmsvZ251ZS1jb21tb24.:3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-common:9954
src/logic/NamespaceCore.py      
svn-v3-single1-dHJ1bmsvZ251ZS1jb21tb24.:3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-common:9954
src/logic/adapters/Base.py      
svn-v3-single1-dHJ1bmsvZ251ZS1jb21tb24.:3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-common:9954
src/logic/adapters/python.py    
svn-v3-single1-dHJ1bmsvZ251ZS1jb21tb24.:3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-common:9954
src/logic/language.py   
svn-v3-single1-dHJ1bmsvZ251ZS1jb21tb24.:3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-common:9954


Modified: trunk/gnue-common/src/apps/GDebug.py
===================================================================
--- trunk/gnue-common/src/apps/GDebug.py        2010-12-02 22:27:05 UTC (rev 
10258)
+++ trunk/gnue-common/src/apps/GDebug.py        2010-12-02 23:29:23 UTC (rev 
10259)
@@ -28,6 +28,8 @@
 messages to a file.
 """
 
+# TODO: Deprecate everything with 0.8, remove with 0.9
+
 import __builtin__
 import inspect
 import os
@@ -211,7 +213,7 @@
     @param file: Filename to output debug messages to (instead of stderr)
     """
 
-    global _DEBUG_LEVELS, printMesg
+    global _DEBUG_LEVELS
 
     # Find out debug levels
     levels = []
@@ -244,15 +246,3 @@
             hnd.setFormatter(fmt)
             lgr.addHandler(hnd)
             lgr.setLevel(logging.DEBUG)
-
-
-# -----------------------------------------------------------------------------
-# Deprecated, for compatibility
-# -----------------------------------------------------------------------------
-
-def printMesg (level, message):
-    """
-    DEPRECATED. Use the logging functions in L{gnue.common.base.log}
-    instead.
-    """
-    __builtin__.__dict__ ['gDebug'] (level, message)

Modified: trunk/gnue-common/src/apps/i18n.py
===================================================================
--- trunk/gnue-common/src/apps/i18n.py  2010-12-02 22:27:05 UTC (rev 10258)
+++ trunk/gnue-common/src/apps/i18n.py  2010-12-02 23:29:23 UTC (rev 10259)
@@ -30,6 +30,8 @@
 @var encoding: Encoding of the current locale
 """
 
+# TODO: Deprecate with 0.8, remove with 0.9
+
 import locale
 import os
 import sys

Modified: trunk/gnue-common/src/datasources/ConnectionTriggerObj.py
===================================================================
--- trunk/gnue-common/src/datasources/ConnectionTriggerObj.py   2010-12-02 
22:27:05 UTC (rev 10258)
+++ trunk/gnue-common/src/datasources/ConnectionTriggerObj.py   2010-12-02 
23:29:23 UTC (rev 10259)
@@ -98,19 +98,3 @@
             assert log.debug ("Cannot add connection %s to object tree" % name)
             continue
         root_object.addChild(ConnectionTriggerObj(conn, name))
-
-
-# Depreciated
-
-def addAllConnections (connections, gobjNamespace): 
-  """
-  Adds all the connection names to the global trigger namespace. DEPRECIATED.
-  """
-
-  for name in connections.backends.BACKENDS.sections(): 
-    try: 
-      conn = connections.getConnection (name)
-    except: 
-      assert log.debug ("Cannot add connection %s to trigger namespace" % name)
-      continue
-    gobjNamespace.constructTriggerObject (ConnectionTriggerObj (conn, name))

Modified: trunk/gnue-common/src/datasources/GConnections.py
===================================================================
--- trunk/gnue-common/src/datasources/GConnections.py   2010-12-02 22:27:05 UTC 
(rev 10258)
+++ trunk/gnue-common/src/datasources/GConnections.py   2010-12-02 23:29:23 UTC 
(rev 10259)
@@ -130,7 +130,7 @@
 
     return backends.BACKENDS.sections()
 
-  getConnectionNames = log.deprecated_f(getConnectionNames)
+  getConnectionNames = log.deprecated_f(getConnectionNames) # Remove with 0.8.
 
 
   # ---------------------------------------------------------------------------
@@ -146,7 +146,7 @@
     for section in backends.BACKENDS.sections():
         result[section] = dict(backends.BACKENDS.items(section))
 
-  getAllConnectionParameters = log.deprecated_f(getAllConnectionParameters)
+  getAllConnectionParameters = log.deprecated_f(getAllConnectionParameters) # 
Remove with 0.8
 
 
   # ---------------------------------------------------------------------------
@@ -163,7 +163,7 @@
 
     return dict(backends.BACKENDS.items(connection_name))
 
-  getConnectionParameters = log.deprecated_f(getConnectionParameters)
+  getConnectionParameters = log.deprecated_f(getConnectionParameters) # Remove 
with 0.8
 
 
   # ---------------------------------------------------------------------------

Modified: trunk/gnue-common/src/datasources/GDataSource.py
===================================================================
--- trunk/gnue-common/src/datasources/GDataSource.py    2010-12-02 22:27:05 UTC 
(rev 10258)
+++ trunk/gnue-common/src/datasources/GDataSource.py    2010-12-02 23:29:23 UTC 
(rev 10259)
@@ -239,6 +239,9 @@
   # ---------------------------------------------------------------------------
 
   def __trigger_set_order_by (self, value):
+    if isinstance(value, basestring):
+        log.deprecated("setting the sortorder as a string is deprecated. "
+                "Use a list of dictionaries instead.")  # Remove with 0.8
     self.__sortorder = self.__convertOrderBy (value)
 
 
@@ -847,8 +850,6 @@
     # If it's a string or a unicode string, we transform it into a tuple
     # sequence, where all items are treated to be in 'ascending' order
     if isinstance (order_by, basestring):
-      assert log.debug ("DEPRECIATION WARNING: use of 'order_by' attribute is 
" \
-                 "depreciated. Please use <sortorder> instead.")
       for field in order_by.split (','):
         (item, desc) = (field, field [-5:].lower () == ' desc')
         if desc:

Modified: trunk/gnue-common/src/datasources/GLoginHandler.py
===================================================================
--- trunk/gnue-common/src/datasources/GLoginHandler.py  2010-12-02 22:27:05 UTC 
(rev 10258)
+++ trunk/gnue-common/src/datasources/GLoginHandler.py  2010-12-02 23:29:23 UTC 
(rev 10259)
@@ -59,34 +59,6 @@
   """
 
   # ---------------------------------------------------------------------------
-  # Get login information (depreciated)
-  # ---------------------------------------------------------------------------
-
-  def getLogin (self, requiredFields, errortext = None):
-    """
-    DEPRECIATED: get information for the given fields and return a dictionary 
-
-    @param requiredFields: sequence of [connection name, description, sequence
-        of fields (name, label, is password)]
-    @param errortext: message of the last error occured
-
-    @raises UserCanceledLogin: if the user canceled the login request
-    """
-    pass
-
-
-  # ---------------------------------------------------------------------------
-  # Called when the app no longer needs the login handler
-  # ---------------------------------------------------------------------------
-
-  def destroyLoginDialog (self):
-    """
-    DEPRECIATED
-    """
-    pass
-
-
-  # ---------------------------------------------------------------------------
   # Ask for all fields given by the field definitions
   # ---------------------------------------------------------------------------
 
@@ -139,40 +111,10 @@
   def _askLogin_ (self, title, fields):
     """
     Descendants override this method to do all the dirty work for askLogin ().
-
-    This class converts the given field definition sequence into an old style
-    format as required by getLogin () and finally calls getLogin. This process
-    will fade out as soon as getLogin is obsolete.
     """
+    pass
 
-    # flatten the blown-up sequence till all support the new style definitions
-    data   = []
-    labels = []
-    error  = None
 
-    for (label, name, ftype, default, master, elements) in fields:
-      if ftype in ['image']:
-        continue
-
-      elif ftype == 'label':
-        labels.append (label)
-
-      elif ftype == 'warning':
-        error = label
-
-      else:
-        data.append ((name, label, ftype == 'password'))
-
-    try:
-      name = len (labels) and labels [0] or ''
-      desc = len (labels) > 1 and labels [1] or ''
-      result = self.getLogin ([name, desc, data], error)
-    finally:
-      self.destroyLoginDialog ()
-
-    return result
-
-
 # =============================================================================
 # Class implementing a basic login handler using raw_input and getpass
 # =============================================================================

Modified: trunk/gnue-common/src/logic/NamespaceCore.py
===================================================================
--- trunk/gnue-common/src/logic/NamespaceCore.py        2010-12-02 22:27:05 UTC 
(rev 10258)
+++ trunk/gnue-common/src/logic/NamespaceCore.py        2010-12-02 23:29:23 UTC 
(rev 10259)
@@ -61,20 +61,5 @@
         self._globalNamespace = {}
 
         self._globalNamespace[rootName] = \
-                self.constructTriggerObject(xml_object)
-
-
-    # -------------------------------------------------------------------------
-    # Construct a namespace object tree for an XML object tree
-    # -------------------------------------------------------------------------
-
-    def constructTriggerObject(self, xml_object):
-        """
-        Construct a namespace object tree from an XML
-        (L{definitions.GObjects.GObj}) object tree. DEPRECIATED.
-
-        Depreciated. Use xml_object.create_namespace_object instead.
-        """
-
-        return xml_object.create_namespace_object(self._globalNamespace,
-                self.__root_name)
+                xml_object.create_namespace_object(self._globalNamespace,
+                        self.__root_name)

Modified: trunk/gnue-common/src/logic/adapters/Base.py
===================================================================
--- trunk/gnue-common/src/logic/adapters/Base.py        2010-12-02 22:27:05 UTC 
(rev 10258)
+++ trunk/gnue-common/src/logic/adapters/Base.py        2010-12-02 23:29:23 UTC 
(rev 10259)
@@ -40,6 +40,7 @@
 import re
 import types
 
+from gnue.common.base import log
 from gnue.common.logic.language import ImplementationError, AbortRequest
 
 __all__ = ['LanguageAdapter', 'ExecutionContext']
@@ -51,7 +52,7 @@
 
 class LanguageAdapter:
     """
-    Base class for language adapters. DEPRECIATED.
+    Base class for language adapters. DEPRECATED.
 
     This class will be depreciated in 0.7 and removed in 0.8.
     Depreciated. Use L{language.create_execution_context} instead.
@@ -64,7 +65,7 @@
     def createNewContext(self):
         """
         Create a new execution context in which user provided code can run.
-        DEPRECIATED.
+        DEPRECATED.
 
         This function will be depreciated in 0.7 and removed in 0.8.
         Use L{language.create_execution_context} instead.
@@ -200,9 +201,10 @@
     # Depreciated methods
     # -------------------------------------------------------------------------
 
+    @log.deprecated_f                       # Remove with 0.8
     def defineNamespace(self, addNS, asGlobal = False):
         """
-        Define the namespace for this execution context. DEPRECIATED.
+        Define the namespace for this execution context. DEPRECATED.
 
         This function will be depreciated in 0.7 and removed in 0.8.
         Use L{language.create_execution_context} instead to define all
@@ -223,7 +225,7 @@
 
     def bindObject(self, name, aObject, asGlobal = False):
         """
-        Bind an object into the namespace. DEPRECIATED.
+        Bind an object into the namespace. DEPRECATED.
 
         This function will be depreciated in 0.7 and removed in 0.8.
         Use L{language.create_execution_context} instead to define all
@@ -238,7 +240,7 @@
 
     def bindFunction(self, name, aFunction, asGlobal = False):
         """
-        Bind a function into the namespace. DEPRECIATED.
+        Bind a function into the namespace. DEPRECATED.
 
         This function will be depreciated in 0.7 and removed in 0.8.
         Use L{language.create_execution_context} instead to define all
@@ -253,7 +255,7 @@
 
     def bindBuiltin(self, name, anElement):
         """
-        Bind a builtin function into the namespace. DEPRECIATED.
+        Bind a builtin function into the namespace. DEPRECATED.
 
         This function will be depreciated in 0.7 and removed in 0.8.
         Use L{language.create_execution_context} instead to define all
@@ -278,10 +280,11 @@
 
     # -------------------------------------------------------------------------
 
+    @log.deprecated_f                       # Remove with 0.8
     def release (self):
         """
         Release an execution context: remove references in the namespace and
-        the like. DEPRECIATED.
+        the like. DEPRECATED.
 
         This function is not necessary any more.
         """

Modified: trunk/gnue-common/src/logic/adapters/python.py
===================================================================
--- trunk/gnue-common/src/logic/adapters/python.py      2010-12-02 22:27:05 UTC 
(rev 10258)
+++ trunk/gnue-common/src/logic/adapters/python.py      2010-12-02 23:29:23 UTC 
(rev 10259)
@@ -28,7 +28,7 @@
 Language adapter plugin for Python.
 """
 
-from gnue.common.base import errors
+from gnue.common.base import errors, log
 from gnue.common.logic import language
 from gnue.common.logic.adapters import Base
 
@@ -48,6 +48,7 @@
     # Create a new execution context
     # -------------------------------------------------------------------------
 
+    @log.deprecated_f                       # Remove with 0.8
     def createNewContext(self):
         """
         Create a python execution context
@@ -180,6 +181,7 @@
     # Depreciated functions
     # -------------------------------------------------------------------------
 
+    @log.deprecated_f                       # Remove with 0.8
     def bindObject(self, name, aObject, asGlobal = False):
         """
         Add an object to the local or global namespace.
@@ -191,6 +193,7 @@
 
     # -------------------------------------------------------------------------
 
+    @log.deprecated_f                       # Remove with 0.8
     def bindFunction(self, name, aFunction, asGlobal = False):
         """
         Add a function to the local or global namespace.
@@ -202,6 +205,7 @@
 
     # -------------------------------------------------------------------------
 
+    @log.deprecated_f                       # Remove with 0.8
     def bindBuiltin(self, name, anElement):
         """
         Bind the given element into the builtin-namespace.
@@ -248,8 +252,10 @@
         __self.__local_namespace['__parameters'] = params
 
         # FIXME: This allows the "self" parameter to be passed as a non-keyword
-        # argument. DEPRECATED.
+        # argument. DEPRECATED. Remove with 0.8
         if args:
+            log.deprecated("Calling a function with the self parameter as a "
+                    "non-keyword argument is deprecated.")
             __self.__local_namespace['__parameters']['self'] = args[0]
 
         try:

Modified: trunk/gnue-common/src/logic/language.py
===================================================================
--- trunk/gnue-common/src/logic/language.py     2010-12-02 22:27:05 UTC (rev 
10258)
+++ trunk/gnue-common/src/logic/language.py     2010-12-02 23:29:23 UTC (rev 
10259)
@@ -38,15 +38,11 @@
 from gnue.common.utils.FileUtils import dyn_import
 
 __all__ = ['AdapterNotFoundError', 'ImplementationError', 'CompileError',
-        'RuntimeError', 'AbortRequest', 'getLanguageAdapter',
-        'create_execution_context']
+        'RuntimeError', 'AbortRequest', 'create_execution_context']
 
 __plugins = {}                          # Cache for loaded plugins
 
-# for old function "getLanguageAdapter"
-__adapters = {}
 
-
 # -----------------------------------------------------------------------------
 # Exceptions
 # -----------------------------------------------------------------------------
@@ -158,40 +154,6 @@
             global_namespace, builtin_namespace)
 
 
-# -----------------------------------------------------------------------------
-# Get or create an instance of a given language adapter
-# -----------------------------------------------------------------------------
-
-def getLanguageAdapter(language):
-    """
-    Return a language adapter object for the given language. DEPRECIATED.
-
-    This function returns an execution context factory for the given language.
-
-    This function will be depreciated in 0.7 and removed in 0.8.
-
-    @param language: The language to return the language adapter object for.
-    @type language: string or unicode
-
-    @return: Language adapter object
-    @rtype: adapters.Base.LanguageAdapter
-
-    @raise AdapterNotFoundError: There is no language adapter available for the
-        given language.
-    """
-
-    lang = str(language.lower())
-  
-    if not __adapters.has_key(lang):
-        try:
-            module = dyn_import('gnue.common.logic.adapters.%s' % lang)
-        except ImportError:
-            raise AdapterNotFoundError, language
-        __adapters[lang] = module.LanguageAdapter()
-
-    return __adapters[lang]
-
-
 # =============================================================================
 # Self test code
 # =============================================================================
@@ -203,35 +165,6 @@
             print "My name is %s %s." % (my_name, name)
             return value * 2"""
 
-    print "*** Old (depreciated) interface ***"
-
-    print "Creating language adapter for 'python' ..."
-    adapter = getLanguageAdapter('python')
-
-    print "Creating new execution environment ..."
-    environ = adapter.createNewContext()
-    environ.shortname = "testing"
-
-    print "Setting up namespaces ..."
-    environ.bindObject('my_name', 'John')
-
-    print "Creating a new virtual code object ..."
-    method = environ.buildFunction('myFunctionName', code,
-            {'name': "", 'value': 0})
-
-    params = {'name': 'foo', 'value': 'bar'}
-    print "Calling function with: %s" % params
-    res = method(**params)
-    print "   result:", repr(res)
-
-    params = {'name': 'fooBar', 'value': 4}
-    print "Calling function with: %s" % params
-    res = method(**params)
-    print "   result:", repr(res)
-
-    print ""
-    print "*** New interface ***"
-
     print "Creating execution context for Python..."
     execution_context = create_execution_context(
             language = 'Python',




reply via email to

[Prev in Thread] Current Thread [Next in Thread]