Django Quick Start with Schema Evolution Support

Ilias Lazaridis ilias at lazaridis.com
Wed Jun 7 11:12:04 EDT 2006


Brian wrote:
> Ilias Lazaridis wrote:
> <snip>
>> http://lazaridis.com
> 
> I would agree with you that this is a place to discuss python.
> However, your posts primarily deal with your expulsion from another
> group.  Instead of discussing that, why don't your discuss the python
> technicalities of your project and leave the rest alone since we want
> to hear about the former and not the later.
> 
> Brian

thank you.

-

*IMPORT*

I would like to know, if this construct is valid, or if it can result in 
problems:

  	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



More information about the Python-list mailing list