Sphene Community Tools

Community

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

Change Language:



AddThis Social Bookmark Button

A Django site.
Profile for Herbert Poul

Name Herbert Poul
Email Address Reveal this emailaddress
ICQ UIN50647169
Jabber Idkahless@sphene.net
Website URLhttp://sct.sphene.net
AvatarUsers avatar
Posts348
Board Signature
Hey, we have Signatures !!! Great, isn't it ? ;)
  • Re: NFA error
    Board >> General
    do you have the urls.py from the sphene.community application included in your urlconf ?

    it seems it can't find:

    url(r'^tags/json/autocompletion/$', 'tags_json_autocompletion', name = 'sph_tags_json_autocompletion'),


    which is defined in sphene/community/urls.py
    Hey, we have Signatures !!! Great, isn't it ? ;)
  • Re: NFA error
    Board >> General
    ah ok .. makes sense ..

    it seems you haven't added the SCT specific middlewares:


    'sphene.community.middleware.ThreadLocals',
    'sphene.community.middleware.GroupMiddleware',


    in addition when including the urls.py you need to add { 'groupName': 'example' } .. or use the SPH_HOST_MIDDLEWARE_URLCONF_MAP settings variable.. (and use { 'groupName': None } as the communitydraft/community/urlconfs/community_urls.py does)

    Hey, we have Signatures !!! Great, isn't it ? ;)
  • Re: NFA error
    Board >> General
    weird ..
    have you modified url configuration or something ? maybe you could output view_args to see what content it has ? - are you modifieing the arguments in any way in your middleware ?
    Hey, we have Signatures !!! Great, isn't it ? ;)
  • Re: Changing urls from /wiki/ to something other
    Board >> General
    p.s.: is a search function planned for the nice forum?
    FYI - a simple search is now implemented - see http://sct.sphene.net/board/thread/677/?page=1#post-1000 and Search
    Hey, we have Signatures !!! Great, isn't it ? ;)
  • Re: Forum search
    Board >> General
    ok .. since i got interested .. i implemented a (simple) search function for the forum ;)

    http://sct.sphene.net/board/search/?query=search

    it is based on xapian and djapian .. see Search for more details.
    Hey, we have Signatures !!! Great, isn't it ? ;)
  • Re: Wrong Forum rights for users / max size of avatar-picture.
    Board >> General
    ooops.. i think i found the problem :(

    i thought named arguments to the Q object are ANDed .. just as those to filter(..) .. obviously ... i was wrong.

    i have committed a fix into the trunk .. please update and it should work


    thanks for debugging this with me,
    herbert
    Hey, we have Signatures !!! Great, isn't it ? ;)
  • Re: Wrong Forum rights for users / max size of avatar-picture.
    Board >> General
    hmm.. that's interesting.. maybe there is a bug in checking the flag permissions ..

    please try the following:


    # again load the post and the user
    >>> from sphene.sphboard.models import Post
    >>> from sphene.community.permissionutils import has_permission_flag
    >>> from django.contrib.auth.models import User
    >>> user = User.objects.get(pk = 2)
    >>> post = Post.objects.get(pk = 5)

    # enable debugging
    >>> from django.conf import settings
    >>> settings.DEBUG = True
    # reset queries
    >>> from django.db import connection
    >>> connection.queries = []

    # test the permission flag
    >>> has_permission_flag(user, 'sphboard_editallposts', post.category)
    False


    # output the sql queries
    >>> connection.queries
    [{'time': '0.001', 'sql': 'SELECT "community_rolegroupmember"."id","community_rolegroupmember"."rolegroup_id","community_rolegroupmember"."user_id" FROM "community ..........


    maybe you could paste me all queries the permission check made ?
    Hey, we have Signatures !!! Great, isn't it ? ;)
  • Re: Wrong Forum rights for users / max size of avatar-picture.
    Board >> General
    no .. there are no default rights (especially not for editing posts)

    we could try to debug the problem.. e.g. edit the file sphenecoll/sphene/sphboard/models.py and go to line 642 .. it should be right inside of 'def allow_editing(...)':


    if user.is_superuser \
    or has_permission_flag( user, 'sphboard_editallposts', self.category ):
    return True


    modify it to look like:


    print "user %s for post %d" % (str(user), self.id)
    if user.is_superuser \
    or has_permission_flag( user, 'sphboard_editallposts', self.category ):
    print "- is superuser or has permission flag"
    return True


    and then run it in the django development server.. and see what happens when your dummy user views the posts ...

    another way to debug it would be to use the python shell ..

    from the same directory as you would start your development server run:


    $ ./manage.py shell

    Executing module body.
    Python 2.5.2 (r252:60911, Apr 17 2008, 11:51:28)
    [GCC 4.0.1 (Apple Computer, Inc. build 5367)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    (InteractiveConsole)
    >>>

    # and now you can use python commands to debug the problem..

    # first load the post:

    >>> from sphene.sphboard.models import Post
    >>> post = Post.objects.get(pk = 5)
    >>> post
    <Post: Re: Test Thread>

    # (use the ID of the post you see in the URL)

    # load the user:

    >>> from django.contrib.auth.models import User
    >>> user = User.objects.get(pk = 1)
    >>> user
    <User: kahless>
    >>>

    # test the permissions:

    >>> post.allow_editing(user)
    True
    >>> user.is_superuser
    True
    >>> from sphene.community.permissionutils import has_permission_flag
    >>> has_permission_flag(user, 'sphboard_editallposts', post.category)
    True
    >>>



    well .. try one (or both) methods . .and let me know what the output looks like :)

    thanks,
    herbert

    --- Last Edited by Herbert Poul at 2008-04-26 12:00:02 ---
    Hey, we have Signatures !!! Great, isn't it ? ;)
  • Re: Wrong Forum rights for users / max size of avatar-picture.
    Board >> General
    hi,

    I setup a fresh install of the community tools. And know I see that every user is able to edit every post of another user.


    i've just tried it out .. and .. simply adding a user .. logging in as that user .. and i wasn't able to edit anyone else's posts ..

    maybe you are adding all users as superusers ? :)

    Where can I setup up the default rights for every user not assigned to a special role?

    by default new users have no role and no extra permissions


    Next: I didn't find in adminearea where to increase size of avatar-pictures. in code I saw the
    "community_avatar_max_size" but never an entry elsewhere. Have I change it direct inside database?


    no, this can be configured in SPH SETTINGS - simply add SPH_SETTINGS = { 'community_avatar_max_size': .... , } to your settings_local.py or settings.py

    Hey, we have Signatures !!! Great, isn't it ? ;)
  • Re: Changing urls from /wiki/ to something other
    Board >> General
    where is the problem with that ? the reverse links should be found automatically ..
    i've done it at: http://sphene.net/c/Startpage/ and it seems to work for me - are your links wrong ?
    switching over to /c/ at beginning works fine meanwhile. But I want to remove the "show" in "/c/show/Start" and didn't find a real way doing this.
    try adding the following to your urlconf (for the default communitydraft this would be communitydraft/community/urlconfs/community_urls.py )


    # this add at the beginning
    from sphene.sphwiki.urls import snip

    # and to your urlpatterns = patterns('', ... add:

    (r'^c/' + snip + r'/$', 'sphene.sphwiki.views.showSnip', defaultdict),

    Hey, we have Signatures !!! Great, isn't it ? ;)


Powered by Sphene Community Tools