Posted by Herbert Poul |
|
this is correct.. but i've implemented a Role model - so there is a 'group_administrator' flag.. (and others)
take a look at the class 'Category' in sphboard/models.py there you have a property called 'sph_permission_flags' .. you could add a 'sphboard_edit_category' there and check for this role to see if the user is allowed to edit categories for this specific group. (the 'group_administrator' flag is equivalent to having assigned all available permissions - ie. the has_permission_flag method would always return True for that user) i currently have not enough time to describe it in more detail, and it seems i haven't documented it anywhere yet :( .. if you're interested you could see how the sphboard_annotate flag is used for example.. (simply search in sphboard/models.py) - i hope that i have time in the afternoon (or tomorrow) to write some documentation about it :) Hey, we have Signatures !!! Great, isn't it ? ;) |
|
Posted by Martin Johnson |
|
Thanks Herbert I missed that feature. Don't worry about documentation for me - I'm happy figuring things out from the code. You've pointed me in the correct direction, so I should be fine.
Many thanks again p.s. good to see how 'heat' works - this discussion is now Hot! --- Last Edited by Martin Johnson at 2007-10-22 12:47:57 --- |
|
Posted by Martin Johnson |
|
Hello again. I upgraded from v0.3 to the subversion trunk to get the Role model etc, and things broke (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1.0' at line 1"). So I updated django to the latest trunk revision (was a week or so behind the latest version) and then things broke really badly (see below). I'll try to fix the probs and let you know what I did. If you haven't heard from me in a week, send out a search party!
Improperly Configured at /QQ/forum/thread/3/ Error while importing URLconf <ModPythonRequest path:/QQ/forum/thread/3/, GET:<QueryDict: {}>, POST:<QueryDict: {}>, COOKIES:{'__utma': '89753118.397177732.1185957311.1193061037.1193069621.88', '__utmb': '89753118', '__utmc': '89753118', '__utmz': '89753118.1185957311.1.1.utmccn=(direct)|utmcsr=(direct)| utmcmd=(none)', 'sessionid': '02d807f61fcd1288497e58606c1b5495'}, META:{'AUTH_TYPE': None, 'CONTENT_LENGTH': 0L, 'CONTENT_TYPE': None, 'GATEWAY_INTERFACE': 'CGI/1.1', 'HTTP_ACCEPT': 'text/xml,application/xml,application/xhtml+xml,text/html; q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5', 'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7', 'HTTP_ACCEPT_ENCODING': 'gzip,deflate', 'HTTP_ACCEPT_LANGUAGE': 'en-gb,en;q=0.5', 'HTTP_CACHE_CONTROL': 'max-age=0', 'HTTP_CONNECTION': 'keep-alive', 'HTTP_COOKIE': 'sessionid=02d807f61fcd1288497e58606c1b5495; __utma=89753118.397177732.1185957311.1193061037.1193069621.88; __utmz=89753118.1185957311.1.1.utmccn=(direct)|utmcsr=(direct)| utmcmd=(none); __utmc=89753118; __utmb=89753118', 'HTTP_HOST': 'testing.researchpages.co.uk', 'HTTP_KEEP_ALIVE': '300', 'HTTP_REFERER': 'testing.researchpages.co.uk/QQ/forum/show/0/', 'HTTP_USER_AGENT': 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.6) Gecko/20061201 Firefox/2.0.0.6 (Ubuntu-feisty)', 'PATH_INFO': '/QQ/forum/thread/3/', 'PATH_TRANSLATED': None, 'QUERY_STRING': None, 'REMOTE_ADDR': '139.222.81.160', 'REMOTE_HOST': None, 'REMOTE_IDENT': None, 'REMOTE_USER': None, 'REQUEST_METHOD': 'GET', 'SCRIPT_NAME': None, 'SERVER_NAME': 'testing.researchpages.co.uk', 'SERVER_PORT': 0, 'SERVER_PROTOCOL': 'HTTP/1.1', 'SERVER_SOFTWARE': 'mod_python'}>: __import__() argument 1 must be string, not ModPythonRequest --- Last Edited by Martin Johnson at 2007-10-22 16:32:04 --- --- Last Edited by Martin Johnson at 2007-10-22 16:33:31 --- --- Last Edited by Martin Johnson at 2007-10-22 16:34:43 --- |
|
Posted by Herbert Poul |
|
weird.. i'm running the latest django version (just updated) without any problems..
but the error looks familiar somehow .. do you have a stacktrace for me ? Hey, we have Signatures !!! Great, isn't it ? ;) |
|
Posted by Martin Johnson |
|
Traceback (most recent call last):
File "/home/martin/python/django/template/__init__.py" in render_node 810. result = node.render(context) File "/home/martin/python/django/template/__init__.py" in render 846. return self.filter_expression.resolve(context) File "/home/martin/python/django/template/__init__.py" in resolve 577. obj = self.var.resolve(context) File "/home/martin/python/django/template/__init__.py" in resolve 704. return self._resolve_lookup(context) File "/home/martin/python/django/template/__init__.py" in _resolve_lookup 736. current = current() File "/home/martin/python/django/utils/functional.py" in _curried 3. return _curried_func(*(args+moreargs), **dict(kwargs, **morekwargs)) File "/home/martin/python/django/db/models/base.py" in get_absolute_url 473. return settings.ABSOLUTE_URL_OVERRIDES.get('%s.%s' % (opts.app_label, opts.module_name), func)(self) File "/home/martin/python/sphene/community/sphpermalink.py" in inner 26. return reverse(bits[0], urlconf, *bits[1:3]) File "/home/martin/python/django/core/urlresolvers.py" in reverse 297. return iri_to_uri(u'/' + get_resolver(urlconf).reverse(viewname, *args, **kwargs)) File "/home/martin/python/django/core/urlresolvers.py" in reverse 282. if lookup_view in self.reverse_dict: File "/home/martin/python/django/core/urlresolvers.py" in _get_reverse_dict 215. if not self._reverse_dict and hasattr(self.urlconf_module, 'urlpatterns'): File "/home/martin/python/django/core/urlresolvers.py" in _get_urlconf_module 255. raise \ImproperlyConfigured, "Error while importing URLconf %r: %s" % (self.urlconf_name, e) \ImproperlyConfigured at /qq/forum/thread/3/... Thanks Herbert! --- Last Edited by Martin Johnson at 2007-10-22 19:39:14 --- |
|
Posted by Herbert Poul |
|
it looks to me as if the request object has no associated 'urlconf' attribute
do you have the \MultiHostMiddleware active ? Hey, we have Signatures !!! Great, isn't it ? ;) |
|
Posted by Martin Johnson |
|
Strange - yes I did have \MultiHostMiddleware switched off, but it wasn't causing these probs til I upgraded django. The reason I turned it off was that the SPH_HOST_MIDDLEWARE_URLCONF_MAPPING and SPH_HOST_MIDDLEWARE_URLCONF_MAP settings were causing errors. To be honest I'm not sure what I need to put in these settings - as I only have one 'host' and my groups are resolved through my urls.py (possibly not the best way to be doing it but I'm stuck with it for now).
currently they look like this: SPH_HOST_MIDDLEWARE_URLCONF_MAPPING = { 'http://myurl.co.uk': { 'groupName': 'example' }, } SPH_HOST_MIDDLEWARE_URLCONF_MAP = { 'http://myurl.co.uk/': {'urlconf': 'esmg.urls', 'params': {'groupName': 'example'} }, r'^(?P<groupName>\w+).localhost.*$': { 'urlconf': 'urlconfs.community_urls', }, } And I still get the same error... Clearly there are some bits of Sphene that I need to understand better - what I'll do is get the communitydraft project up and running on a server somewhere and get to grips with it before I try to integrate it into my site. Many thanks again for your help! |
|
Posted by Herbert Poul |
|
you only need SPH_HOST_MIDDLEWARE_URLCONF_MAP .. and the key should only be the hostname, without http://
so 'myurl.co.uk' should be enough as key .. i'll see how i can fix the sphpermalink function .. (it should also work without that middleware anyway) Hey, we have Signatures !!! Great, isn't it ? ;) |
|
Posted by Martin Johnson |
|
It seems that with the MultiHostMiddleware I cannot do what I wanted - it requires a groupName argument to be passed from settings.py for a particular 'host', whereas I want to have only one host but mulitple groups. With the middleware switched off and a django revision from earlier than this weekend it works!
The offending django revision I presume is this one:
|
|
Posted by Herbert Poul |
|
well.. i guess.. it simply worked in earlier versions because the error was somehow ignored.. this changeset you've mentioned (as far as i understand it) simply adds additional error handling.. before there were also exceptions .. but they were probably not handled.. and ignored by the template engine ..
imo .. it should work if you activate the middleware, you could even leave out the 'groupName' parameter .. (it is optional .. or should be) another possible fix you could try ... modify sphenecoll/sphene/community/sphpermalink.py in line 26 (the return reverse(...)) insert a line before this return: if not isinstance(urlconf, list): urlconf = None you shouldn't need the middleware then .. (your problem is, that the 'urlconf' in this example is the request object, because the request object does not contain a 'urlconf' attribute.. - setting it here to None should make the 'reverse' method use 'settings.urlconf' instead of this parameter.) i still have to see if this change would also work for me :) (it should, since the urlconf has to be a list imo.. although .. it could also be a tuple i guess) Hey, we have Signatures !!! Great, isn't it ? ;) |