I have a few small questions subjecting python functionality, most importantly the "alias_method".
- *IMPORT* I would like to know, if this construct is valid, or if it can result in problems (that I do not see as a newcomer): 1082 try: 1083 from django.rework.evolve import evolvedb 1084 except ImportError: 1085 def evolvedb(): 1086 "Evolve Command Dummy" 1087 print 'Command evolvedb not imported' 1088 evolvedb.args ='' - *PATCHING* A second problem is, how to make the setup for users (testers) more convenient. Is there e.g. any mechanism to apply a patch in an automated manner (e.g. using a python library)? - *ALIAS_METHOD* The django commands are hard-coded: http://code.djangoproject.com/browser/django/trunk/django/core/management.py#L1180 thus elegant/dynamic additions of commands seem not possible. Another possibility is to enlink (hook?) the functionality into an existent function Is there any way (beside a patch) to alter the behaviour to an existing function. Is ther a python construct similar to the "alias_method" of Ruby: (example from an simple evolution support for a ruby orm) #------------------------------------------------------------------------------ # use "alias_method" to enlink the code #------------------------------------------------------------------------------ class SqliteAdapter alias_method :old_create_table, :create_table def create_table(*args) table_evolve(*args) result = old_create_table(*args) return result end end http://lazaridis.com/case/persist/og-evolve.rb - - - If anyone is interested to verify the results in order to stabelize the simple schema evolution support for django, please review the results here: http://case.lazaridis.com/wiki/DjangoProductEvaluation http://case.lazaridis.com/wiki/DjangoSchemaEvolution http://case.lazaridis.com/browser/django/rework/evolve.py http://case.lazaridis.com/browser/django/rework/add_evolvedb_command.diff . -- http://lazaridis.com -- http://mail.python.org/mailman/listinfo/python-list