google-code-export / django-photologue

Automatically exported from code.google.com/p/django-photologue
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Pass *args, **kwargs to overriden calls to save() #70

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Checkout django from svn trunk, revision >= 8670
2. Run plinit
3. Ask "yes" when asked "Would you like to apply a sample enhancement effect to 
your admin thumbnails? (yes, no):"

What is the expected output? What do you see instead?
iris:~/code/ljs andreas$ ./manage.py plinit

Photologue requires a specific photo size to display thumbnail previews in the 
Django admin application.
Would you like to generate this size now? (yes, no):yes

We will now define the "admin_thumbnail" photo size:

Width (in pixels):100
Height (in pixels):100
Crop to fit? (yes, no):no
Pre-cache? (yes, no):no
Increment count? (yes, no):yes

A "admin_thumbnail" photo size has been created.

Would you like to apply a sample enhancement effect to your admin thumbnails? 
(yes, no):yes
Traceback (most recent call last):
  File "./manage.py", line 11, in <module>
    execute_manager(settings)
  File "/Users/andreas/code/ljs/django/core/management/__init__.py", line 334, in execute_manager
    utility.execute()
  File "/Users/andreas/code/ljs/django/core/management/__init__.py", line 295, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/andreas/code/ljs/django/core/management/base.py", line 77, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/Users/andreas/code/ljs/django/core/management/base.py", line 96, in execute
    output = self.handle(*args, **options)
  File "/Users/andreas/code/ljs/lib/external/photologue/management/commands/plinit.py", line 11, in handle
    return init(*args, **kwargs)
  File "/Users/andreas/code/ljs/lib/external/photologue/management/commands/plinit.py", line 19, in init
    effect, created = PhotoEffect.objects.get_or_create(name='Enhance Thumbnail', description="Increases sharpness and contrast. Works well for smaller image sizes such as thumbnails.", contrast=1.2, 
sharpness=1.3)
  File "/Users/andreas/code/ljs/django/db/models/manager.py", line 84, in get_or_create
    return self.get_query_set().get_or_create(**kwargs)
  File "/Users/andreas/code/ljs/django/db/models/query.py", line 331, in get_or_create
    obj.save(force_insert=True)
TypeError: save() got an unexpected keyword argument 'force_insert'

What version of the product are you using? On what operating system?
Django trunk, revision >= 8670, django-photologue revision 301

Please provide any additional information below.
A patch that fixes this problem and potential other problems that might occur 
is attached. All overrides of save() passes accepts and passes *args, **kwargs 
to the super method call.

This backward incompatible change to Django is described here:
http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges#createandget_or_
createwillneverupdateexistingobjects

Original issue reported on code.google.com by andreas....@gmail.com on 30 Aug 2008 at 10:04

Attachments:

GoogleCodeExporter commented 9 years ago
Made the requested change in r302. Thanks!

Original comment by justin.d...@gmail.com on 2 Sep 2008 at 12:48