Sphene Community Tools

Community

Copyright © 2007-2018 by Herbert Poul

You are not logged in.
Login
Register

Change Language:



AddThis Social Bookmark Button

A Django site.

Powered by Sphene Community Tools
Board » General » sphpermalink.py

Page: 1 2 Next

Hey,

Installed Sphene on my website, and it's going great so far. However, I have multiple groups and noticed that the default installation does not work with multiple groups by simply putting a (?P<groupName>[^/]+) into the url; additionally I had to comment out lines 27 and 28 from sphpermalink.py (which remove the 'groupName' key from reverse' parameter dict). Is there a cleaner way to put the group in the URL without editing sphene's code, OR is there maybe some way where sphene's code could be written to adapt gracefully if groupName is or is not in the URL?

Thanks,
-Walt
hi,
good question .. my main usecase currently for having multiple groups are having "vhosts" (using subdomains) - so i have not actually used the group in the path info of the URLs .. (although this was part of the original idea.. that you can either have it in the host or the path .. i just had no use for this yet)

to your problem.. are these two lines the only changes you needed to do? if this is the case i guess i would simply add a setting which wraps this (not perfect, but at least a solution where you don't have to modify SCTs code).

as for your question - i'm not sure what you mean :) you mean it should be more forgiving about missing 'groupName' parameter in the URLs and stuff and simply load a default group in the middlewares if none is given?

thanks for providing feedback and using sct :)
herbert
Hey, we have Signatures !!! Great, isn't it ? ;)
Herbert,

My question involves the URL bending necessary to make other components work that are broken by removing those two lines :) At the moment I've restricted my modifications to my own urls.py, instead of changing SCT's (because that would break other sites, which is bad).

If I have more time later this week or next, maybe I'll look into making a clean patch that makes SCT adapt whether or not groupName is included in the URL. That is my main concern, but at an initial glance it does not look readily easy (possible? The problem arises because Django's 'reverse' function does not accept extra named parameters).

-Walt

PS - My use case is I have one private wiki and one public wiki, under separate group names. The private wiki is maintained due to a lack of editing staff to guarantee sanity in a public wiki, and the public wiki is provided because WikiLinks get ugly if only a certain section of WikiSnips (say those prefixed with Public/) are open to public editing.

--- Last Edited by shadowman131 at 2009-06-22 15:41:19 ---
please take a look at: http://sct.sphene.net/board/thread/1726/group-specific-wiki-pages/?page=1#post-1733

i think my commit with rev 787 makes an (almost) clean patch :) http://yourhell.com/wsvn/root/django/communitytools/?rev=787&sc=1
what do you think? - it works for me, although i haven't tested it extensively
Hey, we have Signatures !!! Great, isn't it ? ;)
Seems good, two things are . . . something -

1. Why does community take the groupName?
2. sphboard-feed is broken on mine, don't know if it's just my site or not . . . I'll check it out later tonight. Looks likely to be broken for everyone, because the reverse() call does not pass groupName. I know it has noGroup = True set, but I highly doubt Django's reverse knows the meaning of noGroup. :)

--- Last Edited by shadowman131 at 2009-06-29 03:33:13 ---
1. Why does community take the groupName?
not sure what you mean.. why it is included with groupName in my urls.py?

2. sphboard-feed is broken on mine, don't know if it's just my site or not . . . I'll check it out later tonight. Looks likely to be broken for everyone, because the reverse() call does not pass groupName. I know it has noGroup = True set, but I highly doubt Django's reverse knows the meaning of noGroup. :)


how do you reverse lookup sphboard-feed? in your own templates?
Hey, we have Signatures !!! Great, isn't it ? ;)
not sure what you mean.. why it is included with groupName in my urls.py?
Perhaps my better-phrased question would be, what community URLs benefit from being associated with a group? I haven't found a community link yet that seems to change depending on group . . . maybe I haven't been paying attention there though.

how do you reverse lookup sphboard-feed? in your own templates?


Not my code or template - Line 46 in sphboard/views.py is the problem. For me this occurs when I, oh, try to view the threads associated with a forum.
/var/www-packages/sphene-community-tools-trunk/sphenecoll/sphene/sphboard/views.py in showCategory

  39. if category_id != None and category_id != '0':
  40. args['parent__isnull'] = False
  41. args['parent'] = category_id
  42. categoryObject = get_object_or_404(Category, pk = category_id)
  43. if not categoryObject.has_view_permission( request.user ):
  44. raise PermissionDenied()
  45. categoryObject.touch(request.session, request.user)

  46. blog_feed_url = reverse('sphboard-feeds', urlconf=get_current_urlconf(), args = (), kwargs = { 'url': 'latest/2' }) ...

  47. add_rss_feed( blog_feed_url, 'Latest Threads in %s RSS Feed' % categoryObject.name )
  48.
  49. if sphdata != None: sphdata['subtitle'] = categoryObject.name
  50. elif sphdata is not None:
  51. sphdata['subtitle'] = ugettext('Forum Overview')
  52.



I'll have a chance to look into it more tonight, if you haven't fixed it by then.
-Walt


--- Last Edited by shadowman131 at 2009-06-29 17:23:00 ---
Perhaps my better-phrased question would be, what community URLs benefit from being associated with a group? I haven't found a community link yet that seems to change depending on group . . . maybe I haven't been paying attention there though.
this is a good question actually. but i think managing roles is Group specific.

Not my code or template - Line 46 in sphboard/views.py is the problem. For me this occurs when I, oh, try to view the threads associated with a forum.


I'll have a chance to look into it more tonight, if you haven't fixed it by then.


a right.. it shouldn't actually use reverse, but the 'sphreverse' function. i can't remember why i decided to use 'reverse' directly in this view function. kind of strange.

i won't be able to fix it today, so if you get to it, it would be great :) (but i assume it would simply be required to make it somehow use sphreverse)

cu,
herbert
Hey, we have Signatures !!! Great, isn't it ? ;)
Yup, changing it to sph_reverse looks identical and fixes the bug . . . The only difference was a urlconf was specified, but I looked at sph_reverse and that stocks the get_current_urlconf as well. So changing reverse() to sph_reverse() seems to be all that was required.
ah cool, so this should work:

   blog_feed_url = sph_reverse('sphboard-feeds', kwargs = { 'url': 'latest/2' })


sounds like the right thing to do .. will commit it later
Hey, we have Signatures !!! Great, isn't it ? ;)

Page: 1 2 Next

Please login to post a reply.



Powered by Sphene Community Tools