I didn't manage to set up your project. I'm new to django, so please forgive me if any of these answers are obvious.
My questions: 1) 'maiacorp.registration', # needed Add blueprintcss 0.7.x to your media_root in a folder called "css". required Add mootools 1.2.x to your media_root in a folder called "js"
These aren't apart of your source. If it's outside of the source, would you mind linking to it/explaining what exactly it is you want? The mootools file I found is one file, but the blueprintcss seems to be an entire package. Is that what you wanted?
2) Once everything is installed right, how about a setup guide? I think I created a forum through the forum/admin interface, but it still doesn't have a "create new post" button (not that I'm sure it's installed right).
Comment #1
Posted on Aug 5, 2009 by Swift BirdComment deleted
Comment #2
Posted on Aug 6, 2009 by Helpful DogAgree that more detail would be helpful. Download django-registration and use for 'maiacorp.registration' I used 404 errors to figure out where to place things in media_root.
I was able to create forums and register, but I was not able to create new posts.
After clicking on "Save" while creating a new post, I would get:
TypeError at /forum/2/topic/create/
'NoneType' object is not callable
Request Method: POST Request URL: http://127.0.0.1:8000/forum/2/topic/create/ Exception Type: TypeError Exception Value:
'NoneType' object is not callable
Exception Location: /Library/Python/2.5/site-packages/django/forms/forms.py in full_clean, line 240
Environment:
Request Method: POST Request URL: http://127.0.0.1:8000/forum/2/topic/create/ Django Version: 1.1 Python Version: 2.5.1 Installed Applications: ['django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'mysite.forum', 'mysite.register', 'django.contrib.admin'] Installed Middleware: ('django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware')
Traceback: File "/Library/Python/2.5/site-packages/django/core/handlers/base.py" in get_response 92. response = callback(request, *callback_args, **callback_kwargs) File "/Library/Python/2.5/site-packages/django/contrib/auth/decorators.py" in call 78. return self.view_func(request, *args, **kwargs) File "/Library/Python/2.5/site-packages/django/forms/forms.py" in is_valid 120. return self.is_bound and not bool(self.errors) File "/Library/Python/2.5/site-packages/django/forms/forms.py" in _get_errors 111. self.full_clean() File "/Library/Python/2.5/site-packages/django/forms/forms.py" in full_clean 240. value = field.clean(value)
Exception Type: TypeError at /forum/2/topic/create/ Exception Value: 'NoneType' object is not callable
Comment #3
Posted on Aug 10, 2009 by Quick GiraffeI had the same issue as above, regarding the NoneType not callable error. I looked at the source code, and it appears that the HTML parser "BeautifulSoup" is an unlisted requirement. It can be downloaded here:
http://www.crummy.com/software/BeautifulSoup/
From how the source code reads, this was probably intended to be optional instead of required, but the source code seems to have a mistake which causes it in fact to be required instead! Kind of amusing, I guess. So, in fields.py, the "not" needs to be removed from this line:
if not BeautifulSoup is None: return value
This will cause BeautifulSoup to only be used if it is available. However, be aware that without BeautifulSoup, some validation code will be skipped. It's best to install it.
One other thing:
After you do this, another problem will come up in that same file. There are two variables, "valid_tags" and "valid_attrs" in the SafeHtmlField in fields.py which are referenced in the clean() function as class variables, but they are instantiated as function variables instead. To correct this problem, cut these two lines out of clean() and paste them in somewhere outside of the function but still within the class, and un-indent them:
valid_tags = 'p i strong b u a h1 h2 h3 pre br img strike'.split() valid_attrs = 'href src'.split()
After these changes, fields.py should look like this:
-- coding: utf-8 --
from django import forms try: from BeautifulSoup import BeautifulSoup, Comment except: BeautifulSoup, Comment = None,None
class SafeHtmlField(forms.Field): valid_tags = 'p i strong b u a h1 h2 h3 pre br img strike'.split() valid_attrs = 'href src'.split() def clean(self, value):
if BeautifulSoup is None: return value
content = value
soup = BeautifulSoup(content)
for comment in soup.findAll(
text=lambda text: isinstance(text, Comment)):
comment.extract()
for tag in soup.findAll(True):
if tag.name not in self.__class__.valid_tags:
tag.hidden = True
tag.attrs = [(attr, val) for attr, val in tag.attrs
if attr in self.__class__.valid_attrs]
return soup.renderContents().decode('utf8')
There is one other completely unrelated thing I'll mention while I'm at it. In admin.py, I had to change some lines to get this working in the admin interface.
This line: forum_admin = admin.AdminSite() I changed to this: forum_admin = admin.site
And I added this line at the end so I could create Forum labels in the admin (this requires importing ForumLabel from models.py at the top of the file, of course): forum_admin.register(ForumLabel)
I hope this helps some people trying to get up and running, and I hope I didn't make any unexpected oversights in these code alterations. And thanks very much to the author of this Django app for coding it and making it available. It's a very nice app!
Comment #4
Posted on Dec 11, 2009 by Helpful CamelOk folks. I managed to fix the start up guide. Please, try again and tell me the results. And use ForumBR-1.0 ALPHA.
Comment #5
Posted on Dec 27, 2009 by Helpful CamelCorrecting myself. Use version 1.0!!! =D If you guys find any more problems with the "installation guide", please report.
Status: Started
Labels:
Type-Defect
Priority-Medium