From dd93c0b1e84b6cdb2eca873bceb8c829aacc48d6 Mon Sep 17 00:00:00 2001 From: hrcerqueira Date: Mon, 15 Feb 2010 12:07:31 +0000 Subject: Changed views _init.py_ to not import everything, but just the packages, and changed urls.py to include the full python path for each view. Also changed some "reverses" on templates that were using view p --- forum/skins/default/templates/book.html | 2 +- forum/skins/default/templates/index.html | 4 +- forum/skins/default/templates/question.html | 4 +- .../templates/question_summary_list_roll.html | 2 +- forum/skins/default/templates/questions.html | 4 +- forum/skins/default/templates/tags.html | 2 +- forum/skins/default/templates/user_stats.html | 2 +- forum/skins/default/templates/users_questions.html | 2 +- forum/urls.py | 80 +++++++-------- forum/views/__init__.py | 8 +- osqa.iml | 10 ++ settings_local.py.dist | 110 --------------------- 12 files changed, 65 insertions(+), 165 deletions(-) create mode 100755 osqa.iml delete mode 100755 settings_local.py.dist diff --git a/forum/skins/default/templates/book.html b/forum/skins/default/templates/book.html index 683f13cf..8574fa73 100644 --- a/forum/skins/default/templates/book.html +++ b/forum/skins/default/templates/book.html @@ -122,7 +122,7 @@
{% for tag in question.tagname_list %} - + {% endfor %}
diff --git a/forum/skins/default/templates/index.html b/forum/skins/default/templates/index.html index df2814d6..7fa189ae 100644 --- a/forum/skins/default/templates/index.html +++ b/forum/skins/default/templates/index.html @@ -102,7 +102,7 @@
{% for tag in question.tagname_list %} - + {% endfor %}
@@ -129,7 +129,7 @@
{% for tag in tags %} + title="{% blocktrans with tag.name as tagname %}see questions tagged '{{tagname}}'{% endblocktrans %}" href="{% url tag_questions tag.name|urlencode %}">{{ tag.name }} {% endfor %}
{% trans "popular tags" %} ยป
diff --git a/forum/skins/default/templates/question.html b/forum/skins/default/templates/question.html index 34f8fd1d..fe9f5cde 100644 --- a/forum/skins/default/templates/question.html +++ b/forum/skins/default/templates/question.html @@ -129,7 +129,7 @@
{% for tag in question.tagname_list %} - {% endfor %}
@@ -474,7 +474,7 @@

{% for tag in tags %} - ×{{ tag.used_count|intcomma }}
{% endfor %} diff --git a/forum/skins/default/templates/question_summary_list_roll.html b/forum/skins/default/templates/question_summary_list_roll.html index 7312dca9..57685d6d 100644 --- a/forum/skins/default/templates/question_summary_list_roll.html +++ b/forum/skins/default/templates/question_summary_list_roll.html @@ -49,7 +49,7 @@

{% for tag in question.tagname_list %} - + {% endfor %}
diff --git a/forum/skins/default/templates/questions.html b/forum/skins/default/templates/questions.html index 77802efc..4c3b96d2 100644 --- a/forum/skins/default/templates/questions.html +++ b/forum/skins/default/templates/questions.html @@ -133,7 +133,7 @@
{% for tag in question.tagname_list %} - + {% endfor %}
@@ -224,7 +224,7 @@

{% trans "Related tags" %}

{% for tag in tags %} - + × {{ tag.used_count|intcomma }}
{% endfor %} diff --git a/forum/skins/default/templates/tags.html b/forum/skins/default/templates/tags.html index 1bde187f..50f90fb1 100644 --- a/forum/skins/default/templates/tags.html +++ b/forum/skins/default/templates/tags.html @@ -46,7 +46,7 @@
diff --git a/forum/urls.py b/forum/urls.py index f93d5151..fe335538 100644 --- a/forum/urls.py +++ b/forum/urls.py @@ -17,7 +17,7 @@ sitemaps = { APP_PATH = os.path.dirname(__file__) urlpatterns = patterns('', - url(r'^$', app.index, name='index'), + url(r'^$', app.content.index, name='index'), url(r'^sitemap.xml$', 'django.contrib.sitemaps.views.sitemap', {'sitemaps': sitemaps}), #(r'^favicon\.ico$', 'django.views.generic.simple.redirect_to', {'url': '/media/images/favicon.ico'}), #(r'^favicon\.gif$', 'django.views.generic.simple.redirect_to', {'url': '/media/images/favicon.gif'}), @@ -28,65 +28,65 @@ urlpatterns = patterns('', {'document_root': os.path.join(APP_PATH,'upfiles').replace('\\','/')} ), (r'^%s/$' % _('signin/'), 'django_authopenid.views.signin'), - url(r'^%s$' % _('about/'), app.about, name='about'), - url(r'^%s$' % _('faq/'), app.faq, name='faq'), - url(r'^%s$' % _('privacy/'), app.privacy, name='privacy'), - url(r'^%s$' % _('logout/'), app.logout, name='logout'), - url(r'^%s(?P\d+)/%s$' % (_('answers/'), _('comments/')), app.answer_comments, name='answer_comments'), - url(r'^%s(?P\d+)/%s$' % (_('answers/'), _('edit/')), app.edit_answer, name='edit_answer'), - url(r'^%s(?P\d+)/%s$' % (_('answers/'), _('revisions/')), app.answer_revisions, name='answer_revisions'), - url(r'^%s$' % _('questions/'), app.questions, name='questions'), - url(r'^%s%s$' % (_('questions/'), _('ask/')), app.ask, name='ask'), - url(r'^%s%s$' % (_('questions/'), _('unanswered/')), app.unanswered, name='unanswered'), - url(r'^%s(?P\d+)/%s$' % (_('questions/'), _('edit/')), app.edit_question, name='edit_question'), - url(r'^%s(?P\d+)/%s$' % (_('questions/'), _('close/')), app.close, name='close'), - url(r'^%s(?P\d+)/%s$' % (_('questions/'), _('reopen/')), app.reopen, name='reopen'), - url(r'^%s(?P\d+)/%s$' % (_('questions/'), _('answer/')), app.answer, name='answer'), - url(r'^%s(?P\d+)/%s$' % (_('questions/'), _('vote/')), app.vote, name='vote'), - url(r'^%s(?P\d+)/%s$' % (_('questions/'), _('revisions/')), app.question_revisions, name='question_revisions'), - url(r'^%s(?P\d+)/%s$' % (_('questions/'), _('comments/')), app.question_comments, name='question_comments'), - url(r'^%s$' % _('command/'), app.ajax_command, name='call_ajax'), + url(r'^%s$' % _('about/'), app.meta.about, name='about'), + url(r'^%s$' % _('faq/'), app.meta.faq, name='faq'), + url(r'^%s$' % _('privacy/'), app.meta.privacy, name='privacy'), + url(r'^%s$' % _('logout/'), app.meta.logout, name='logout'), + url(r'^%s(?P\d+)/%s$' % (_('answers/'), _('comments/')), app.content.answer_comments, name='answer_comments'), + url(r'^%s(?P\d+)/%s$' % (_('answers/'), _('edit/')), app.content.edit_answer, name='edit_answer'), + url(r'^%s(?P\d+)/%s$' % (_('answers/'), _('revisions/')), app.content.answer_revisions, name='answer_revisions'), + url(r'^%s$' % _('questions/'), app.content.questions, name='questions'), + url(r'^%s%s$' % (_('questions/'), _('ask/')), app.content.ask, name='ask'), + url(r'^%s%s$' % (_('questions/'), _('unanswered/')), app.content.unanswered, name='unanswered'), + url(r'^%s(?P\d+)/%s$' % (_('questions/'), _('edit/')), app.content.edit_question, name='edit_question'), + url(r'^%s(?P\d+)/%s$' % (_('questions/'), _('close/')), app.content.close, name='close'), + url(r'^%s(?P\d+)/%s$' % (_('questions/'), _('reopen/')), app.content.reopen, name='reopen'), + url(r'^%s(?P\d+)/%s$' % (_('questions/'), _('answer/')), app.content.answer, name='answer'), + url(r'^%s(?P\d+)/%s$' % (_('questions/'), _('vote/')), app.content.vote, name='vote'), + url(r'^%s(?P\d+)/%s$' % (_('questions/'), _('revisions/')), app.content.question_revisions, name='question_revisions'), + url(r'^%s(?P\d+)/%s$' % (_('questions/'), _('comments/')), app.content.question_comments, name='question_comments'), + url(r'^%s$' % _('command/'), app.content.ajax_command, name='call_ajax'), url(r'^%s(?P\d+)/%s(?P\d+)/%s$' % (_('questions/'), _('comments/'),_('delete/')), \ - app.delete_comment, kwargs={'commented_object_type':'question'},\ + app.content.delete_comment, kwargs={'commented_object_type':'question'},\ name='delete_question_comment'), url(r'^%s(?P\d+)/%s(?P\d+)/%s$' % (_('answers/'), _('comments/'),_('delete/')), \ - app.delete_comment, kwargs={'commented_object_type':'answer'}, \ + app.content.delete_comment, kwargs={'commented_object_type':'answer'}, \ name='delete_answer_comment'), \ #place general question item in the end of other operations - url(r'^%s(?P\d+)/' % _('question/'), app.question, name='question'), - url(r'^%s$' % _('tags/'), app.tags, name='tags'), - url(r'^%s(?P[^/]+)/$' % _('tags/'), app.tag, name='tag_questions'), + url(r'^%s(?P\d+)/' % _('question/'), app.content.question, name='question'), + url(r'^%s$' % _('tags/'), app.content.tags, name='tags'), + url(r'^%s(?P[^/]+)/$' % _('tags/'), app.content.tag, name='tag_questions'), - url(r'^%s%s(?P[^/]+)/$' % (_('mark-tag/'),_('interesting/')), app.mark_tag, \ + url(r'^%s%s(?P[^/]+)/$' % (_('mark-tag/'),_('interesting/')), app.content.mark_tag, \ kwargs={'reason':'good','action':'add'}, \ name='mark_interesting_tag'), - url(r'^%s%s(?P[^/]+)/$' % (_('mark-tag/'),_('ignored/')), app.mark_tag, \ + url(r'^%s%s(?P[^/]+)/$' % (_('mark-tag/'),_('ignored/')), app.content.mark_tag, \ kwargs={'reason':'bad','action':'add'}, \ name='mark_ignored_tag'), - url(r'^%s(?P[^/]+)/$' % _('unmark-tag/'), app.mark_tag, \ + url(r'^%s(?P[^/]+)/$' % _('unmark-tag/'), app.content.mark_tag, \ kwargs={'action':'remove'}, \ name='mark_ignored_tag'), - url(r'^%s$' % _('users/'),app.users, name='users'), - url(r'^%s(?P\d+)/$' % _('moderate-user/'), app.moderate_user, name='moderate_user'), - url(r'^%s(?P\d+)/%s$' % (_('users/'), _('edit/')), app.edit_user, name='edit_user'), - url(r'^%s(?P\d+)//*' % _('users/'), app.user, name='user'), - url(r'^%s$' % _('badges/'),app.badges, name='badges'), - url(r'^%s(?P\d+)//*' % _('badges/'), app.badge, name='badge'), - url(r'^%s%s$' % (_('messages/'), _('markread/')),app.read_message, name='read_message'), + url(r'^%s$' % _('users/'),app.users.users, name='users'), + url(r'^%s(?P\d+)/$' % _('moderate-user/'), app.users.moderate_user, name='moderate_user'), + url(r'^%s(?P\d+)/%s$' % (_('users/'), _('edit/')), app.users.edit_user, name='edit_user'), + url(r'^%s(?P\d+)//*' % _('users/'), app.users.user, name='user'), + url(r'^%s$' % _('badges/'),app.meta.badges, name='badges'), + url(r'^%s(?P\d+)//*' % _('badges/'), app.meta.badge, name='badge'), + url(r'^%s%s$' % (_('messages/'), _('markread/')),app.meta.read_message, name='read_message'), # (r'^admin/doc/' % _('admin/doc'), include('django.contrib.admindocs.urls')), (r'^%s(.*)' % _('nimda/'), admin.site.root), url(r'^feeds/(?P.*)/$', 'django.contrib.syndication.views.feed', {'feed_dict': feeds}), - (r'^%s$' % _('upload/'), app.upload), - url(r'^%s$' % _('books/'), app.books, name='books'), - url(r'^%s%s(?P[^/]+)/$' % (_('books/'), _('ask/')), app.ask_book, name='ask_book'), - url(r'^%s(?P[^/]+)/$' % _('books/'), app.book, name='book'), - url(r'^%s$' % _('search/'), app.search, name='search'), - url(r'^%s$' % _('feedback/'), app.feedback, name='feedback'), + (r'^%s$' % _('upload/'), app.content.upload), + url(r'^%s$' % _('books/'), app.books.books, name='books'), + url(r'^%s%s(?P[^/]+)/$' % (_('books/'), _('ask/')), app.books.ask_book, name='ask_book'), + url(r'^%s(?P[^/]+)/$' % _('books/'), app.books.book, name='book'), + url(r'^%s$' % _('search/'), app.content.search, name='search'), + url(r'^%s$' % _('feedback/'), app.meta.feedback, name='feedback'), (r'^%sfb/' % _('account/'), include('fbconnect.urls')), (r'^%s' % _('account/'), include('django_authopenid.urls')), (r'^i18n/', include('django.conf.urls.i18n')), diff --git a/forum/views/__init__.py b/forum/views/__init__.py index 0bd91fe6..7fdb6f61 100644 --- a/forum/views/__init__.py +++ b/forum/views/__init__.py @@ -1,4 +1,4 @@ -from forum.views.content import * -from forum.views.users import * -from forum.views.meta import * -from forum.views.books import * +import content +import users +import meta +import books diff --git a/osqa.iml b/osqa.iml new file mode 100755 index 00000000..4e760f0a --- /dev/null +++ b/osqa.iml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/settings_local.py.dist b/settings_local.py.dist deleted file mode 100755 index 09865857..00000000 --- a/settings_local.py.dist +++ /dev/null @@ -1,110 +0,0 @@ -# encoding:utf-8 -import os.path -from django.utils.translation import ugettext as _ - -def check_local_setting(name, value): - local_vars = locals() - if name in local_vars and local_var[name] == value: - return True - else: - return False - -SITE_SRC_ROOT = os.path.dirname(__file__) -LOG_FILENAME = 'django.osqa.log' - -#for logging -import logging -logging.basicConfig( - filename=os.path.join(SITE_SRC_ROOT, 'log', LOG_FILENAME), - level=logging.DEBUG, - format='%(pathname)s TIME: %(asctime)s MSG: %(filename)s:%(funcName)s:%(lineno)d %(message)s', -) - -#ADMINS and MANAGERS -ADMINS = (('Forum Admin', 'forum@example.com'),) -MANAGERS = ADMINS - -#DEBUG SETTINGS -DEBUG = False -TEMPLATE_DEBUG = DEBUG -INTERNAL_IPS = ('127.0.0.1',) - -DATABASE_NAME = 'osqa' # Or path to database file if using sqlite3. -DATABASE_USER = '' # Not used with sqlite3. -DATABASE_PASSWORD = '' # Not used with sqlite3. -DATABASE_ENGINE = 'mysql' #mysql, etc -DATABASE_HOST = '' -DATABASE_PORT = '' - -#Moved from settings.py for better organization. (please check it up to clean up settings.py) - -#email server settings -SERVER_EMAIL = '' -DEFAULT_FROM_EMAIL = '' -EMAIL_HOST_USER = '' -EMAIL_HOST_PASSWORD = '' -EMAIL_SUBJECT_PREFIX = '[OSQA] ' -EMAIL_HOST='osqa.net' -EMAIL_PORT='25' -EMAIL_USE_TLS=False - -#LOCALIZATIONS -TIME_ZONE = 'America/New_York' - -########################### -# -# this will allow running your forum with url like http://site.com/forum -# -# FORUM_SCRIPT_ALIAS = 'forum/' -# -FORUM_SCRIPT_ALIAS = '' #no leading slash, default = '' empty string - - -#OTHER SETTINGS -APP_TITLE = u'OSQA: Open Source Q&A Forum' -APP_SHORT_NAME = u'OSQA' -APP_KEYWORDS = u'OSQA,CNPROG,forum,community' -APP_DESCRIPTION = u'Ask and answer questions.' -APP_INTRO = u'

Ask and answer questions, make the world better!

' -APP_COPYRIGHT = 'Copyright OSQA, 2009. Some rights reserved under creative commons license.' -LOGIN_URL = '/%s%s%s' % (FORUM_SCRIPT_ALIAS,'account/','signin/') -GREETING_URL = LOGIN_URL #may be url of "faq" page or "about", etc - -USE_I18N = True -LANGUAGE_CODE = 'en' -EMAIL_VALIDATION = 'off' #string - on|off -MIN_USERNAME_LENGTH = 1 -EMAIL_UNIQUE = False -APP_URL = 'http://osqa.net' #used by email notif system and RSS -GOOGLE_SITEMAP_CODE = '' -GOOGLE_ANALYTICS_KEY = '' -BOOKS_ON = False -WIKI_ON = True -USE_EXTERNAL_LEGACY_LOGIN = False -EXTERNAL_LEGACY_LOGIN_HOST = 'login.osqa.net' -EXTERNAL_LEGACY_LOGIN_PORT = 80 -EXTERNAL_LEGACY_LOGIN_PROVIDER_NAME = 'OSQA' -FEEDBACK_SITE_URL = None #None or url -EDITABLE_SCREEN_NAME = False #True or False - can user change screen name? - -DJANGO_VERSION = 1.1 -RESOURCE_REVISION=4 - -USE_SPHINX_SEARCH = False #if True all SPHINX_* settings are required -#also sphinx search engine and djangosphinxs app must be installed -#sample sphinx configuration file is /sphinx/sphinx.conf -SPHINX_API_VERSION = 0x113 #refer to djangosphinx documentation -SPHINX_SEARCH_INDICES=('osqa',) #a tuple of index names remember about a comma after the -#last item, especially if you have just one :) -SPHINX_SERVER='localhost' -SPHINX_PORT=3312 - -#please get these at recaptcha.net -RECAPTCHA_PRIVATE_KEY='...' -RECAPTCHA_PUBLIC_KEY='...' -OSQA_DEFAULT_SKIN = 'default' - -#Facebook settings -USE_FB_CONNECT=True -FB_API_KEY='' #your api key from facebook -FB_SECRET='' #your application secret -- cgit v1.2.3-1-g7c22