Posted by Magus Bond |
|
I've toyed around with setting up a wiki page, currently I've gotten it to direct to the "Create it." page, but the href is empty so it redirects to itself (the same page). Does anyone know what may be causing this?
Just as a background for help troubleshooting, I've implemented the wiki within an existing project and the urls.py has the following lines: #Wiki Related URLS (r'^project/(?P<groupName>\w+)/wiki/', include('sphene.sphwiki.urls')), Where groupName is simply a two digit number which corresponds to a 'project' for which I've created a group. This worked fine when I simply had the following in my main urls.py file: (r'^wiki/', include('sphene.sphwiki.urls')) However, trying to seperate it by group as I've attempted above is causing problems. It is most likely a problem with the get_absolute_editurl function in the models.py for the WikiSnip model. Thanks in advance, let me know if you need me to elaborate on anything to help you troubleshoot, Noah --- Last Edited by Magus at 2009-06-24 23:13:47 --- |
|
Posted by Herbert Poul |
|
having the group name within the path info of a URL is currently not really well supported.. although it seems popular, so i should investigate that further :) (see http://sct.sphene.net/board/thread/1721/sphpermalink-py/?page=1#post-1721 )
would you mind explaining why you need to have the group name in the URL? the main usage of community groups would be to create separate websites (ie. vhosts).. i assume there are certain usecases where it makes sense to have it under one (sub)domain but i'm not sure these are very comon.. Hey, we have Signatures !!! Great, isn't it ? ;) |
|
Posted by Magus Bond |
|
First, thanks for the quick reply.
Currently, my website has subsections for individual groups of 'members' called 'projects'. Within each project there is a forum, upload section, calendar, etc. it's for software development teams. Within each one I want a wiki section, so the easiest way I saw was to simply create a group with the same name as the project ID used in the URLs for each project. For example, Project 'Red' is a Project model with id '15', the URL to that projects calendar section is (r'^project/(?P<project_id>\d+)/calendar/$', 'myproject.views.calendar'). So, I wanted project/15/wiki to redirect to the wiki setup for group '15' which would correspond to the group of users within the project with id '15'. I've seen the other way seems to be using a middleware but that's a bit foreign to me, could that possibly be what I want to do? If not, how do you suggest I go about creating seperate groups? Really, the URL to the area does not matter as much as simply setting up the wikis which are seperated by groups which I can configure. I believe the functionality is there, I'm just having a bit of trouble seeing how to do it. |
|
Posted by Magus Bond |
|
Still can't quite get this working. I read your post again and you ask why I need the group name in the URL:
Well, I can't think of a way to have seperate wikis for groups without making a seperate URL. Does setting a GroupMember for the group mean that when you go to wiki/show/start you will automatically only see your wiki? I'd even be happy if localhost/groupname/wiki worked, but as it is, the templates are not rendering the URL in the href fields at all. The functions which generate the urls seems to be broken for groups. I've also tried the middleware option but that seems to be even more complicated than simply assigning urls to specific groups. This thread describes my problem almost perfectly but it's an old issue which I assume was resolved because my django/db/models/__init__.py file doesn't even have a 36th line. --- Last Edited by Magus at 2009-06-26 22:17:20 --- --- Last Edited by Magus at 2009-06-27 00:00:57 --- |
|
Posted by Herbert Poul |
|
ok, i have reread your requirements.. and it seems that it makes sense to have separate wikis/forums by URL.. but you probably need your own middleware, because you have to do the conversion from your project id to SCTs Group yourself, if i understand it correctly?
nope, adding users to a Group only changes privileges - so all you might get is a Permission Denied error.
since this feature request came quite often lately (having the group within the URL) - i will see that i can get to it this weekend and play around with it.. (probably first by having the group name in the URL - switching it to your use case with a custom middleware shouldn't be too hard afterwards ..
yep, that thread is a bit outdated since SCT now uses it's own version of permalink. i will let you know when i've found time to look at it. (hopefully tomorrow) Hey, we have Signatures !!! Great, isn't it ? ;) |
|
Posted by Magus Bond |
|
Sounds great, I look forward to your next response. In the mean time I'll be looking at your suggestion of writing my own middleware. Thanks again.
|
|
Posted by Herbert Poul |
|
i just committed a change which should make it possible to have the 'groupName' in the URL - not the perfect solution for you right now.. but a start..
i have used the following url conf: (r'^mytest/(?P<groupName>\w+)/community/', include('sphene.community.urls')), (r'^mytest/(?P<groupName>\w+)/wiki/', include('sphene.sphwiki.urls')), and it seems to work .. in parallel i had: SPH_HOST_MIDDLEWARE_URLCONF_MAP = { r'^(?P<groupName>\w+).localhost.*$': { 'urlconf': 'urlconfs.community_urls', }, } so i had the same thing at: 127.0.0.1:8000/test/example/wiki/show/Start/ and example.localhost.com:8000/wiki/show/Start/ and in my tests it seemed to work.. but this does not yet fully solve your problem - what i did was to remember if the Group was loaded because of the host name: sphdata['group_fromhost'] = True - and if this was NOT the case.. put in the 'groupName' into URL resolving (in sph_reverse, sph_url, sph_url2, ...) - since you have no 'groupName', but a 'project_id', where your middleware would do the conversion between your project_id and the community Group object (i assume) - this needs further improvements.. i need to think about something.. e.g. that i don't check for sphdata['group_fromhost'] but have a variable sphdata['urlresolveparams'] which are all put back into 'kwargs' before trying to reverse lookup a URL. --- Last Edited by Herbert Poul at 2009-06-27 17:27:51 --- Hey, we have Signatures !!! Great, isn't it ? ;) |
|
Posted by Magus Bond |
|
[edit to remove the stacktraces and description of problem]
I was missing the sph_extras file and had my urls a bit wrong. Upon replacing sph_extras and fixing my urls I managed to get this working. Thanks very much for the addition to the code Herbert, it's working marvelously! Appreciate your attention and ongoing help extremely. You're the man. --- Last Edited by Magus at 2009-06-29 20:16:47 --- |
|
Posted by Magus Bond |
|
Ran into an issue with history and recent changes. When trying to view a change I get the following error. It appears to be pointing back to versionId 31 when the url specifies 32, this is consistent everytime I get the error it's trying to get one less than the url indicated version id.
However, the first change on each wiki snip appears to be working fine. The "edit to this version" url is also broken similar to the edit button problem I was having earlier. I think whatever is causing this problem is a simply small oversight from the fix you implemented carrying over to these specific types of urls for 'changes'. Environment: Request Method: GET Request URL: http://127.0.0.1:8000/ia/project/22/wiki/diff/Start/32/ Django Version: 1.0-final-SVN-8450 Python Version: 2.5.1 Installed Applications: ['django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'iaproto.ideaarcade', 'iaproto.registration', 'voting', 'django_evolution', 'sphene.community', 'sphene.sphboard', 'sphene.sphwiki'] Installed Middleware: ('sphene.community.middleware.ThreadLocals', 'sphene.community.middleware.GroupMiddleware', 'sphene.community.middleware.PermissionDeniedMiddleware', 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.middleware.doc.XViewMiddleware') Traceback: File "c:\python25\lib\site-packages\django\core\handlers\base.py" in get_response 86. response = callback(request, *callback_args, **callback_kwargs) File "C:\Python25\Lib\site-packages\django\iaproto\..\..\sphene\communitytools\sphenecoll\sphene\sphwiki\views.py" in diff 165. 'editversionlink': changeStart.get_absolute_editurl() }, File "C:\Python25\Lib\site-packages\django\iaproto\..\..\sphene\communitytools\sphenecoll\sphene\sphwiki\models.py" in get_absolute_editurl 346. 'versionId': self.id } ); File "c:\python25\lib\site-packages\django\core\urlresolvers.py" in reverse 252. *args, **kwargs))) File "c:\python25\lib\site-packages\django\core\urlresolvers.py" in reverse 241. "arguments '%s' not found." % (lookup_view, args, kwargs)) Exception Type: NoReverseMatch at /ia/project/22/wiki/diff/Start/32/ Exception Value: Reverse for 'sphwiki_editversion' with arguments '()' and keyword arguments '{'versionId': 31, 'snipName': u'Start'}' not found. |
|
Posted by Herbert Poul |
|
yep, it still used reverse instead of sph_reverse.
please update from subversion and try again. thanks Hey, we have Signatures !!! Great, isn't it ? ;) |
Please login to post a reply.