On 02/20/2013 04:11 PM, Raphaël Badin wrote:
> On 02/20/2013 03:54 PM, Dave Walker wrote:
>> Does it make sense to monkey patch if django < required version?
>
> It's also a possibility, but given the way Django plays with imports,
> this could be a dangerous game.

That being said, the monkey patch solution is appealing because it means 
we continue to import the field from django.db.models.fields and we use 
'django.db.models.fields.GenericIPAddressField' in the migrations in 1.2 
*and* in trunk, thus avoiding all the upgrade issues.

By making sure the monkey patching code is called at the top of the 
src/maasserver/models/__init__.py file (which is imported by Django at 
start up time), it seems we can solve the import issue.

I've created a patch that does that and includes the 
GenericIPAddressField (plus all the required utility methods): 
http://paste.ubuntu.com/1691108/

Testing against a Django package without the genericipaddressfield.diff 
patch, I get the entire test suite to pass.  Now I need to test the 
created package because we've seen that the "import pattern" differs 
when a Django application is loaded in a wsgi container.

-- 
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to maas in Ubuntu.
https://bugs.launchpad.net/bugs/1130232

Title:
  Implement GenericIpAddressField in MAAS rather than django.

To manage notifications about this bug go to:
https://bugs.launchpad.net/maas/+bug/1130232/+subscriptions

-- 
Ubuntu-server-bugs mailing list
Ubuntu-server-bugs@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server-bugs

Reply via email to