[gnue] r10259 - in trunk/gnue-common: . src/apps src/datasources src/logic src/logic/adapters
[email protected] Thu, 2 Dec 2010 17:29:23 -0600 (CST)
| Newsgroups | gmane.comp.cms.gnue.cvs |
|---|---|
| Message-ID | <[email protected]> |
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=C3=BCller <[email protected]> properties:=20 branch-nick: common + timestamp: 2010-12-03 00:28:11.546999931 +0100 committer: Reinhard M=C3=BCller <[email protected]> properties:=20 branch-nick: common Name: bzr:file-ids - src/definitions/GParser.py 967@3a364389-8fce-0310-8f11-cc363fde16c7:= trunk%2Fgnue-common:src%2Fdefinitions%2FGParser.py + src/apps/GDebug.py 1027@3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2= Fgnue-common:src%2Fapps%2FGDebug.py src/apps/i18n.py 5254@3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-c= ommon:src%2Fapps%2Fi18n.py src/datasources/ConnectionTriggerObj.py 5058@3a364389-8fce-0310-8f11-cc36= 3fde16c7:trunk%2Fgnue-common:src%2Fdatasources%2FConnectionTriggerObj.py src/datasources/GConnections.py 1060@3a364389-8fce-0310-8f11-cc363fde16c7= :trunk%2Fgnue-common:src%2Fdatasources%2FGConnections.py src/datasources/GDataSource.py 1098@3a364389-8fce-0310-8f11-cc363fde16c7:= trunk%2Fgnue-common:src%2Fdatasources%2FGDataSource.py src/datasources/GLoginHandler.py 1074@3a364389-8fce-0310-8f11-cc363fde16c= 7:trunk%2Fgnue-common:src%2Fdatasources%2FGLoginHandler.py src/logic/NamespaceCore.py 3779@3a364389-8fce-0310-8f11-cc363fde16c7:trun= k%2Fgnue-common:src%2Flogic%2FNamespaceCore.py src/logic/adapters/Base.py 5518@3a364389-8fce-0310-8f11-cc363fde16c7:trun= k%2Fgnue-common:src%2Flogic%2Fadapters%2FBase.py src/logic/adapters/python.py 5518@3a364389-8fce-0310-8f11-cc363fde16c7:tr= unk%2Fgnue-common:src%2Flogic%2Fadapters%2Fpython.py src/logic/language.py 5519@3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fg= nue-common:src%2Flogic%2Flanguage.py Name: bzr:revision-id:v4 - 3116 [email protected] 3117 [email protected] 3118 [email protected] 3119 [email protected] 3120 [email protected] 3121 [email protected] 3122 [email protected] 3123 [email protected] 3124 [email protected] 3125 [email protected] 3126 [email protected] 3127 [email protected] 3128 [email protected] 3129 [email protected] 3130 [email protected] 3131 [email protected] 3132 [email protected] 3133 [email protected] 3134 [email protected] 3135 [email protected] 3136 [email protected] 3137 [email protected] 3138 [email protected] 3139 [email protected] 3140 [email protected] 3141 [email protected] 3142 [email protected] 3143 [email protected] 3144 [email protected] + 3116 [email protected] 3117 [email protected] 3118 [email protected] 3119 [email protected] 3120 [email protected] 3121 [email protected] 3122 [email protected] 3123 [email protected] 3124 [email protected] 3125 [email protected] 3126 [email protected] 3127 [email protected] 3128 [email protected] 3129 [email protected] 3130 [email protected] 3131 [email protected] 3132 [email protected] 3133 [email protected] 3134 [email protected] 3135 [email protected] 3136 [email protected] 3137 [email protected] 3138 [email protected] 3139 [email protected] 3140 [email protected] 3141 [email protected] 3142 [email protected] 3143 [email protected] 3144 [email protected] 3145 [email protected] Name: bzr:text-parents - src/definitions/GParser.py svn-v3-single1-dHJ1bmsvZ251ZS1jb21tb24.:3= a364389-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-03= 10-8f11-cc363fde16c7:trunk%2Fgnue-common:9954 src/datasources/ConnectionTriggerObj.py svn-v3-single1-dHJ1bmsvZ251ZS1jb2= 1tb24.:3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-common:9986 src/datasources/GConnections.py [email protected]= 42-6pp6cwlicgt2bhhs src/datasources/GDataSource.py [email protected]= 3-xs7k6pkghh9t6fc3 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.:3a3643= 89-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-common:9954 src/logic/adapters/Base.py svn-v3-single1-dHJ1bmsvZ251ZS1jb21tb24.:3a3643= 89-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-common:9954 src/logic/adapters/python.py svn-v3-single1-dHJ1bmsvZ251ZS1jb21tb24.:3a36= 4389-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-common:9954 src/logic/language.py svn-v3-single1-dHJ1bmsvZ251ZS1jb21tb24.:3a364389-8f= ce-0310-8f11-cc363fde16c7:trunk%2Fgnue-common:9954 Modified: trunk/gnue-common/src/apps/GDebug.py =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/gnue-common/src/apps/GDebug.py 2010-12-02 22:27:05 UTC (rev 102= 58) +++ trunk/gnue-common/src/apps/GDebug.py 2010-12-02 23:29:23 UTC (rev 102= 59) @@ -28,6 +28,8 @@ messages to a file. """ =20 +# 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= ) """ =20 - global _DEBUG_LEVELS, printMesg + global _DEBUG_LEVELS =20 # Find out debug levels levels =3D [] @@ -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 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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 """ =20 +# TODO: Deprecate with 0.8, remove with 0.9 + import locale import os import sys Modified: trunk/gnue-common/src/datasources/ConnectionTriggerObj.py =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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):=20 - """ - Adds all the connection names to the global trigger namespace. DEPRECI= ATED. - """ - - for name in connections.backends.BACKENDS.sections():=20 - try:=20 - conn =3D connections.getConnection (name) - except:=20 - assert log.debug ("Cannot add connection %s to trigger namespace" = % name) - continue - gobjNamespace.constructTriggerObject (ConnectionTriggerObj (conn, na= me)) Modified: trunk/gnue-common/src/datasources/GConnections.py =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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 @@ =20 return backends.BACKENDS.sections() =20 - getConnectionNames =3D log.deprecated_f(getConnectionNames) + getConnectionNames =3D log.deprecated_f(getConnectionNames) # Remove w= ith 0.8. =20 =20 # --------------------------------------------------------------------= ------- @@ -146,7 +146,7 @@ for section in backends.BACKENDS.sections(): result[section] =3D dict(backends.BACKENDS.items(section)) =20 - getAllConnectionParameters =3D log.deprecated_f(getAllConnectionParame= ters) + getAllConnectionParameters =3D log.deprecated_f(getAllConnectionParame= ters) # Remove with 0.8 =20 =20 # --------------------------------------------------------------------= ------- @@ -163,7 +163,7 @@ =20 return dict(backends.BACKENDS.items(connection_name)) =20 - getConnectionParameters =3D log.deprecated_f(getConnectionParameters) + getConnectionParameters =3D log.deprecated_f(getConnectionParameters) = # Remove with 0.8 =20 =20 # --------------------------------------------------------------------= ------- Modified: trunk/gnue-common/src/datasources/GDataSource.py =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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 @@ # --------------------------------------------------------------------= ------- =20 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 =3D self.__convertOrderBy (value) =20 =20 @@ -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' attribu= te is " \ - "depreciated. Please use <sortorder> instead.") for field in order_by.split (','): (item, desc) =3D (field, field [-5:].lower () =3D=3D ' desc') if desc: Modified: trunk/gnue-common/src/datasources/GLoginHandler.py =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/gnue-common/src/datasources/GLoginHandler.py 2010-12-02 22:27:0= 5 UTC (rev 10258) +++ trunk/gnue-common/src/datasources/GLoginHandler.py 2010-12-02 23:29:2= 3 UTC (rev 10259) @@ -59,34 +59,6 @@ """ =20 # --------------------------------------------------------------------= ------- - # Get login information (depreciated) - # --------------------------------------------------------------------= ------- - - def getLogin (self, requiredFields, errortext =3D None): - """ - DEPRECIATED: get information for the given fields and return a dicti= onary=20 - - @param requiredFields: sequence of [connection name, description, se= quence - 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 # --------------------------------------------------------------------= ------- =20 @@ -139,40 +111,10 @@ def _askLogin_ (self, title, fields): """ Descendants override this method to do all the dirty work for askLog= in (). - - This class converts the given field definition sequence into an old = style - format as required by getLogin () and finally calls getLogin. This p= rocess - will fade out as soon as getLogin is obsolete. """ + pass =20 - # flatten the blown-up sequence till all support the new style defin= itions - data =3D [] - labels =3D [] - error =3D None =20 - for (label, name, ftype, default, master, elements) in fields: - if ftype in ['image']: - continue - - elif ftype =3D=3D 'label': - labels.append (label) - - elif ftype =3D=3D 'warning': - error =3D label - - else: - data.append ((name, label, ftype =3D=3D 'password')) - - try: - name =3D len (labels) and labels [0] or '' - desc =3D len (labels) > 1 and labels [1] or '' - result =3D self.getLogin ([name, desc, data], error) - finally: - self.destroyLoginDialog () - - return result - - # =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D # Class implementing a basic login handler using raw_input and getpass # =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D Modified: trunk/gnue-common/src/logic/NamespaceCore.py =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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 =3D {} =20 self._globalNamespace[rootName] =3D \ - 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 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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 =20 +from gnue.common.base import log from gnue.common.logic.language import ImplementationError, AbortRequest =20 __all__ =3D ['LanguageAdapter', 'ExecutionContext'] @@ -51,7 +52,7 @@ =20 class LanguageAdapter: """ - Base class for language adapters. DEPRECIATED. + Base class for language adapters. DEPRECATED. =20 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 r= un. - DEPRECIATED. + DEPRECATED. =20 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 # ------------------------------------------------------------------= ------- =20 + @log.deprecated_f # Remove with 0.8 def defineNamespace(self, addNS, asGlobal =3D False): """ - Define the namespace for this execution context. DEPRECIATED. + Define the namespace for this execution context. DEPRECATED. =20 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 @@ =20 def bindObject(self, name, aObject, asGlobal =3D False): """ - Bind an object into the namespace. DEPRECIATED. + Bind an object into the namespace. DEPRECATED. =20 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 @@ =20 def bindFunction(self, name, aFunction, asGlobal =3D False): """ - Bind a function into the namespace. DEPRECIATED. + Bind a function into the namespace. DEPRECATED. =20 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 @@ =20 def bindBuiltin(self, name, anElement): """ - Bind a builtin function into the namespace. DEPRECIATED. + Bind a builtin function into the namespace. DEPRECATED. =20 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 @@ =20 # ------------------------------------------------------------------= ------- =20 + @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. =20 This function is not necessary any more. """ Modified: trunk/gnue-common/src/logic/adapters/python.py =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/gnue-common/src/logic/adapters/python.py 2010-12-02 22:27:05 UT= C (rev 10258) +++ trunk/gnue-common/src/logic/adapters/python.py 2010-12-02 23:29:23 UT= C (rev 10259) @@ -28,7 +28,7 @@ Language adapter plugin for Python. """ =20 -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 =20 @@ -48,6 +48,7 @@ # Create a new execution context # ------------------------------------------------------------------= ------- =20 + @log.deprecated_f # Remove with 0.8 def createNewContext(self): """ Create a python execution context @@ -180,6 +181,7 @@ # Depreciated functions # ------------------------------------------------------------------= ------- =20 + @log.deprecated_f # Remove with 0.8 def bindObject(self, name, aObject, asGlobal =3D False): """ Add an object to the local or global namespace. @@ -191,6 +193,7 @@ =20 # ------------------------------------------------------------------= ------- =20 + @log.deprecated_f # Remove with 0.8 def bindFunction(self, name, aFunction, asGlobal =3D False): """ Add a function to the local or global namespace. @@ -202,6 +205,7 @@ =20 # ------------------------------------------------------------------= ------- =20 + @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'] =3D params =20 # 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 a= s a " + "non-keyword argument is deprecated.") __self.__local_namespace['__parameters']['self'] =3D args[0] =20 try: Modified: trunk/gnue-common/src/logic/language.py =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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 =20 __all__ =3D ['AdapterNotFoundError', 'ImplementationError', 'CompileErro= r', - 'RuntimeError', 'AbortRequest', 'getLanguageAdapter', - 'create_execution_context'] + 'RuntimeError', 'AbortRequest', 'create_execution_context'] =20 __plugins =3D {} # Cache for loaded plugins =20 -# for old function "getLanguageAdapter" -__adapters =3D {} =20 - # ----------------------------------------------------------------------= ------- # Exceptions # ----------------------------------------------------------------------= ------- @@ -158,40 +154,6 @@ global_namespace, builtin_namespace) =20 =20 -# ----------------------------------------------------------------------= ------- -# 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 lan= guage. - - 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 =3D str(language.lower()) - =20 - if not __adapters.has_key(lang): - try: - module =3D dyn_import('gnue.common.logic.adapters.%s' % lang= ) - except ImportError: - raise AdapterNotFoundError, language - __adapters[lang] =3D module.LanguageAdapter() - - return __adapters[lang] - - # =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D # Self test code # =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D @@ -203,35 +165,6 @@ print "My name is %s %s." % (my_name, name) return value * 2""" =20 - print "*** Old (depreciated) interface ***" - - print "Creating language adapter for 'python' ..." - adapter =3D getLanguageAdapter('python') - - print "Creating new execution environment ..." - environ =3D adapter.createNewContext() - environ.shortname =3D "testing" - - print "Setting up namespaces ..." - environ.bindObject('my_name', 'John') - - print "Creating a new virtual code object ..." - method =3D environ.buildFunction('myFunctionName', code, - {'name': "", 'value': 0}) - - params =3D {'name': 'foo', 'value': 'bar'} - print "Calling function with: %s" % params - res =3D method(**params) - print " result:", repr(res) - - params =3D {'name': 'fooBar', 'value': 4} - print "Calling function with: %s" % params - res =3D method(**params) - print " result:", repr(res) - - print "" - print "*** New interface ***" - print "Creating execution context for Python..." execution_context =3D create_execution_context( language =3D 'Python',