google-code-export / django-syncr

Automatically exported from code.google.com/p/django-syncr
0 stars 0 forks source link

syncr.youtube.models.Video.save() needs **kwargs for pass-through #70

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
First: THANKS!

Second: Have a problem/fix that may help folks who are using the trunk of
django (currently revision 11375)  ... am using version 0.41 of syncr.  

Was getting the following error:

>>> from video.syncr.app import youtube
>>> sync = youtube.YoutubeSyncr()
>>> sync.syncVideo('zWnCN_dPDWY')
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/mnt/www/django/video/../video/syncr/app/youtube.py", line 58, in
syncVideo
    return self.syncVideoFeed(feed)
  File "/mnt/www/django/video/../video/syncr/app/youtube.py", line 84, in
syncVideoFeed
    defaults=default_dict)
  File "/usr/lib/python2.5/site-packages/django/db/models/manager.py", line
123, in get_or_create
    return self.get_query_set().get_or_create(**kwargs)
  File "/usr/lib/python2.5/site-packages/django/db/models/query.py", line
335, in get_or_create
    obj.save(force_insert=True)
TypeError: save() got an unexpected keyword argument 'force_insert'

I found this bug: http://code.djangoproject.com/ticket/8662

I changed lines 24 and 25 of syncr/youtube/models.py to (just added
**kwargs to pass through the save function):

    def save(self, **kwargs):
        super(Video, self).save(**kwargs)
        Tag.objects.update_tags(self, self.tag_list)

The error went away.

Thanks again.

Original issue reported on code.google.com by damont...@gmail.com on 2 Aug 2009 at 6:20

GoogleCodeExporter commented 9 years ago
Thanks for the bug report! This was fixed a while back in the trunk version, 
but no one got around to closing 
this ticket. Thanks again!

Original comment by jesse.l...@gmail.com on 5 Dec 2009 at 7:55