Sphene Community Tools

Community

Copyright © 2007-2008 by Herbert Poul
You are not logged in.
Login
Register

Change Language:



AddThis Social Bookmark Button

A Django site.

Powered by Sphene Community Tools
Profile for dbickett

Name dbickett
Email Address Reveal this emailaddress
Posts2
  • Re: Breaking update in Django trunk
    Board >> General
    I have gotten this close to a solution, insofar as temporary workarounds are solutions. This slightly rewrites how sphene constructs djano's dispatcher signals, in accordance with the present django trunk. However it results in a further exception I supply below.

    I made the change to two files:

    ...\sphene\community\models.py

    [dbickett@web25 ~]$ diff -u ~/checkouts/communitytools/sphenecoll/sphene/community/models.py ~/lib/python2.5/sphene/community/models.py
    --- /home/dbickett/checkouts/communitytools/sphenecoll/sphene/community/models.py       2008-08-19 11:34:06.000000000 -0500
    +++ /home/dbickett/lib/python2.5/sphene/community/models.py     2008-08-21 00:03:37.000000000 -0500
    @@ -576,10 +576,10 @@
                 value.save()
             else:
                 if value.id: value.delete()
    -
    +
         request.user.message_set.create( message = _("Successfully saved community profile.") )
    
    -def community_profile_display(sender, signal, request, user):
    +def community_profile_display(sender, signal, request, user, **kwargs):
         try:
             profile = CommunityUserProfile.objects.get( user = user, )
         except CommunityUserProfile.DoesNotExist:
    @@ -596,11 +596,15 @@
                                          'value': value.value, })
             except CommunityUserProfileFieldValue.DoesNotExist:
                 continue
    -
    +
         return ret
    
    -dispatcher.connect(community_profile_edit_init_form, signal = profile_edit_init_form, sender = EditProfileForm)
    -dispatcher.connect(community_profile_edit_save_form, signal = profile_edit_save_form, sender = EditProfileForm)
    -dispatcher.connect(community_profile_display, signal = profile_display)
    +s1 = dispatcher.Signal((profile_edit_init_form,))
    +s1.connect(community_profile_edit_init_form, sender = EditProfileForm)
    
    +# dispatcher.Signal().connect(community_profile_edit_save_form, signal = profile_edit_save_form, sender = EditProfileForm)
    +s2 = dispatcher.Signal((profile_edit_save_form,))
    +s2.connect(community_profile_edit_save_form, sender = EditProfileForm)
    
    +s3 = dispatcher.Signal((profile_display,))
    +s3.connect(community_profile_display)
    


    ...\sphene\community\__init__.py

    [dbickett@web25 ~]$ diff -u ~/checkouts/communitytools/sphenecoll/sphene/community/__init__.py ~/lib/python2.5/sphene/community/__init__.py
    --- /home/dbickett/checkouts/communitytools/sphenecoll/sphene/community/__init__.py     2008-08-19 11:34:06.000000000 -0500
    +++ /home/dbickett/lib/python2.5/sphene/community/__init__.py   2008-08-21 00:07:03.000000000 -0500
    @@ -69,7 +69,7 @@
         instance.fields['community_advprofile_avatar'] = djangoforms.ImageField( label = _(u'Avatar'), required = False, )
         instance.clean_community_advprofile_avatar = lambda : clean_community_advprofile_avatar(instance)
    
    -def community_advprofile_edit_save_form(sender, instance, signal, request):
    +def community_advprofile_edit_save_form(sender, instance, signal, request, **kwargs):
         data = instance.cleaned_data
         user = instance.user
         try:
    @@ -117,8 +117,13 @@
    
         return ret
    
    -dispatcher.connect(community_advprofile_edit_init_form, signal = profile_edit_init_form, sender = EditProfileForm)
    -dispatcher.connect(community_advprofile_edit_save_form, signal = profile_edit_save_form, sender = EditProfileForm)
    -dispatcher.connect(community_advprofile_display, signal = profile_display)
    +s1 = dispatcher.Signal((community_advprofile_edit_init_form,))
    +s1.connect(profile_edit_init_form, sender = EditProfileForm)
    +
    +s2 = dispatcher.Signal((community_advprofile_edit_save_form,))
    +s2.connect(profile_edit_save_form, sender = EditProfileForm)
    +
    +s3 = dispatcher.Signal((community_advprofile_display,))
    +s3.connect(profile_display)
    


    ... resulting exception:

    [dbickett@web25 ~]$ python webapps/djangotrunk/bcaucus/manage.py syncdb
    Traceback (most recent call last):
      File "webapps/djangotrunk/bcaucus/manage.py", line 11, in <module>
        execute_manager(settings)
      File "/home/dbickett/webapps/djangotrunk/lib/python2.5/django/core/management/__init__.py", line 334, in execute_manager
        utility.execute()
      File "/home/dbickett/webapps/djangotrunk/lib/python2.5/django/core/management/__init__.py", line 295, in execute
        self.fetch_command(subcommand).run_from_argv(self.argv)
      File "/home/dbickett/webapps/djangotrunk/lib/python2.5/django/core/management/base.py", line 77, in run_from_argv
        self.execute(*args, **options.__dict__)
      File "/home/dbickett/webapps/djangotrunk/lib/python2.5/django/core/management/base.py", line 87, in execute
        translation.activate('en-us')
      File "/home/dbickett/webapps/djangotrunk/lib/python2.5/django/utils/translation/__init__.py", line 73, in activate
        return real_activate(language)
      File "/home/dbickett/webapps/djangotrunk/lib/python2.5/django/utils/translation/__init__.py", line 43, in delayed_loader
        return g['real_%s' % caller](*args, **kwargs)
      File "/home/dbickett/webapps/djangotrunk/lib/python2.5/django/utils/translation/trans_real.py", line 209, in activate
        _active[currentThread()] = translation(language)
      File "/home/dbickett/webapps/djangotrunk/lib/python2.5/django/utils/translation/trans_real.py", line 198, in translation
        default_translation = _fetch(settings.LANGUAGE_CODE)
      File "/home/dbickett/webapps/djangotrunk/lib/python2.5/django/utils/translation/trans_real.py", line 181, in _fetch
        app = getattr(__import__(appname[:p], {}, {}, [appname[p+1:]]), appname[p+1:])
      File "/home/dbickett/lib/python2.5/sphene/community/__init__.py", line 121, in <module>
        s1.connect(profile_edit_init_form, sender = EditProfileForm)
      File "/home/dbickett/webapps/djangotrunk/lib/python2.5/django/dispatch/dispatcher.py", line 68, in connect
        assert inspect.getargspec(receiver)2 is not None, \
      File "/usr/local/lib/python2.5/inspect.py", line 743, in getargspec
        raise TypeError('arg is not a Python function')
    TypeError: arg is not a Python function
    


    Haven't tackled this yet!

    --- Last Edited by dbickett at 2008-08-21 05:18:29 ---
  • Re: Breaking update in Django trunk
    Board >> General
    I have this problem as well.

    I updated my copy of django to the svn trunk revision after reading the installation & tutorial, but the version of django seems to be the problem in this case. If you look at the module which the code is using when the error is thrown (speaking of the present django trunk, again), you'll find that Signal is an object which you'll have to instantiate first, then call "connect" -- it's method. You may need to create three objects, because SCT calls "connect" as though it is a function of the module "dispatcher" three times in sequence. (I don't understand yet whether or not this object needs to stay alive, though my intuition tells me it does.)

    In Django 0.96, dispatcher.py is different, in that the SCT code in this case would not cause an exception. This is interesting because the tutorial (or install doc) specifically told me that SCT would not work with django 0.96, as I recall, though this probably owes to more than one reason.

    This is a list of files in the SCT trunk which are incompatible with the present django trunk:

    [dbickett@web25 ~]$ grep -rF "dispatcher.connect" ~/checkouts/communitytools/sphenecoll/sphene/
    /home/dbickett/checkouts/communitytools/sphenecoll/sphene/community/models.py:dispatcher.connect(community_profile_edit_init_form, signal = profile_edit_init_form, sender = EditProfileForm)
    /home/dbickett/checkouts/communitytools/sphenecoll/sphene/community/models.py:dispatcher.connect(community_profile_edit_save_form, signal = profile_edit_save_form, sender = EditProfileForm)
    /home/dbickett/checkouts/communitytools/sphenecoll/sphene/community/models.py:dispatcher.connect(community_profile_display, signal = profile_display)
    /home/dbickett/checkouts/communitytools/sphenecoll/sphene/community/__init__.py:dispatcher.connect(community_advprofile_edit_init_form, signal = profile_edit_init_form, sender = EditProfileForm)
    /home/dbickett/checkouts/communitytools/sphenecoll/sphene/community/__init__.py:dispatcher.connect(community_advprofile_edit_save_form, signal = profile_edit_save_form, sender = EditProfileForm)
    /home/dbickett/checkouts/communitytools/sphenecoll/sphene/community/__init__.py:dispatcher.connect(community_advprofile_display, signal = profile_display)
    /home/dbickett/checkouts/communitytools/sphenecoll/sphene/community/management.py:dispatcher.connect(init_data, sender=models, signal=signals.post_syncdb)
    /home/dbickett/checkouts/communitytools/sphenecoll/sphene/community/management.py:dispatcher.connect(do_changelog, signal=signals.post_syncdb)
    /home/dbickett/checkouts/communitytools/sphenecoll/sphene/community/management.py:dispatcher.connect(create_permission_flags ,signal=signals.post_syncdb)
    /home/dbickett/checkouts/communitytools/sphenecoll/sphene/community/groupaware_templateloader.py:dispatcher.connect(clear_template_cache,
    /home/dbickett/checkouts/communitytools/sphenecoll/sphene/sphcomments/models.py:dispatcher.connect(clear_root_category_cache,
    /home/dbickett/checkouts/communitytools/sphenecoll/sphene/sphcomments/models.py:dispatcher.connect(clear_root_category_cache,
    /home/dbickett/checkouts/communitytools/sphenecoll/sphene/sphboard/models.py:dispatcher.connect(update_heat,
    /home/dbickett/checkouts/communitytools/sphenecoll/sphene/sphboard/models.py:dispatcher.connect(update_thread_information,
    /home/dbickett/checkouts/communitytools/sphenecoll/sphene/sphboard/models.py:dispatcher.connect(update_post_count,
    /home/dbickett/checkouts/communitytools/sphenecoll/sphene/sphboard/models.py:dispatcher.connect(clear_signature_cache,
    /home/dbickett/checkouts/communitytools/sphenecoll/sphene/sphboard/models.py:dispatcher.connect(board_profile_edit_init_form, signal = profile_edit_init_form, sender = EditProfileForm)
    /home/dbickett/checkouts/communitytools/sphenecoll/sphene/sphboard/models.py:dispatcher.connect(board_profile_edit_save_form, signal = profile_edit_save_form, sender = EditProfileForm)
    /home/dbickett/checkouts/communitytools/sphenecoll/sphene/sphboard/models.py:dispatcher.connect(board_profile_display, signal = profile_display)
    /home/dbickett/checkouts/communitytools/sphenecoll/sphene/sphboard/templatetags/sphboard_extras.py:dispatcher.connect(clear_authorinfo_cache,
    /home/dbickett/checkouts/communitytools/sphenecoll/sphene/sphboard/templatetags/sphboard_extras.py:dispatcher.connect(clear_authorinfo_cache_postcount,
    /home/dbickett/checkouts/communitytools/sphenecoll/sphene/sphboard/templatetags/sphboard_extras.py:dispatcher.connect(clear_posts_render_cache,
    /home/dbickett/checkouts/communitytools/sphenecoll/sphene/sphboard/management.py:dispatcher.connect(do_changelog, sender=models, signal=signals.post_syncdb)
    /home/dbickett/checkouts/communitytools/sphenecoll/sphene/sphboard/management.py:dispatcher.connect(init_data, sender=models, signal=signals.post_syncdb)
    


    --- Last Edited by dbickett at 2008-08-21 05:47:26 ---


Powered by Sphene Community Tools