From d4ee6c7b8a0be47236f7a9e172a932e6f37904b3 Mon Sep 17 00:00:00 2001 From: Adolfo Fitoria Date: Sat, 8 Aug 2009 10:26:29 -0600 Subject: translating templates/content/js/com.cnprog.i18n.js to Spanish --- templates/content/js/com.cnprog.i18n.js | 61 ++++++++++++++++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-) diff --git a/templates/content/js/com.cnprog.i18n.js b/templates/content/js/com.cnprog.i18n.js index 90166eec..96f755bf 100644 --- a/templates/content/js/com.cnprog.i18n.js +++ b/templates/content/js/com.cnprog.i18n.js @@ -84,9 +84,68 @@ var i18nEn = { 'characters':'characters left', }; +var i18nEs = { + 'insufficient privilege':'privilegio insuficiente', + 'cannot pick own answer as best':'no puede escoger su propia respuesta como la mejor', + 'anonymous users cannot select favorite questions':'usuarios anonimos no pueden seleccionar', + 'please login':'por favor inicie sesión', + 'anonymous users cannot vote':'usuarios anónimos no pueden votar', + '>15 points requried to upvote': '>15 puntos requeridos para votar positivamente', + '>100 points required to downvote':'>100 puntos requeridos para votar negativamente', + 'please see': 'por favor vea', + 'cannot vote for own posts':'no se puede votar por sus propias publicaciones', + 'daily vote cap exhausted':'cuota de votos diarios excedida', + 'cannot revoke old vote':'no puede revocar un voto viejo', + 'please confirm offensive':"por favor confirme ofensiva", + 'anonymous users cannot flag offensive posts':'usuarios anónimos no pueden marcar publicaciones como ofensivas', + 'cannot flag message as offensive twice':'no puede marcar mensaje como ofensivo dos veces', + 'flag offensive cap exhausted':'cuota para marcar ofensivas ha sido excedida', + 'need >15 points to report spam':"necesita >15 puntos para reportar spam, + 'confirm delete':"¿Está seguro que desea borrar esto?", + 'anonymous users cannot delete/undelete':"usuarios anónimos no pueden borrar o recuperar publicaciones", + 'post recovered':"publicación recuperada", + 'post deleted':"publicación borrada。", + 'add comment':'agregar comentario', + 'community reputation points':'reputación comunitaria', + 'to comment, need':'para comentar, necesita reputación', + 'delete this comment':'borrar este comentario', + 'hide comments':"ocultar comentarios", + 'add a comment':"agregar comentarios", + 'comments':"comentarios", + 'confirm delete comment':"¿Realmente desea borrar este comentario?", + 'characters':'caracteres faltantes', + 'can write':'tiene ', + 'click to close':'haga click para cerrar', + 'loading...':'cargando...', + 'tags cannot be empty':'las etiquetas no pueden estar vacías', + 'tablimits info':"hasta 5 etiquetas de no mas de 20 caracteres cada una", + 'content cannot be empty':'el contenido no puede estar vacío', + 'content minchars': 'por favor introduzca mas de {0} caracteres', + 'please enter title':'por favor ingrese un título', + 'title minchars':"por favor introduzca al menos {0} caracteres", + 'delete':'borrar', + 'undelete': 'recuperar', + 'bold': 'negrita', + 'italic':'cursiva', + 'link':'enlace', + 'quote':'citar', + 'preformatted text':'texto preformateado', + 'image':'imagen', + 'numbered list':'lista numerada', + 'bulleted list':'lista no numerada', + 'heading':'标题', + 'horizontal bar':'barra horizontal', + 'undo':'deshacer', + 'redo':'rehacer', + 'enter image url':'introduzca la URL de la imagen, por ejemplo:
http://www.example.com/image.jpg \"titulo de imagen\"', + 'enter url':'introduzca direcciones web, ejemplo:
http://www.cnprog.com/ \"titulo del enlace\"

"', + 'upload image':'cargar imagen:', +}; + var i18n = { 'en':i18nEn, - 'zh_CN':i18nZh + 'zh_CN':i18nZh, + 'es':i18nEs }; var i18n_dict = i18n[i18nLang]; -- cgit v1.2.3-1-g7c22 From 268a63a68a06d2ce1188991ced154b2e391d5c4f Mon Sep 17 00:00:00 2001 From: Adolfo Fitoria Date: Sat, 8 Aug 2009 21:34:53 -0600 Subject: fixing error in settings.py (missing template stuff for admin) --- settings.py | 1 + 1 file changed, 1 insertion(+) diff --git a/settings.py b/settings.py index fac3c0d5..fb594676 100644 --- a/settings.py +++ b/settings.py @@ -64,6 +64,7 @@ TEMPLATE_CONTEXT_PROCESSORS = ( 'context.auth_processor', 'context.application_settings', #'django.core.context_processors.i18n', + 'django.core.context_processors.auth' #this is required for admin ) ROOT_URLCONF = 'urls' -- cgit v1.2.3-1-g7c22 From a8c23ae4e44b27b459fe7bf68ed2e213d99bd146 Mon Sep 17 00:00:00 2001 From: Adolfo Fitoria Date: Sat, 8 Aug 2009 22:54:56 -0600 Subject: fixing a bug in question view --- forum/views.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/forum/views.py b/forum/views.py index 6ef7bd6d..1566e9a8 100644 --- a/forum/views.py +++ b/forum/views.py @@ -332,7 +332,10 @@ def question(request, id): answers = answers.select_related(depth=1) favorited = question.has_favorite_by_user(request.user) - question_vote = question.votes.select_related().filter(user=request.user) + if not request.user.is_anonymous(): + question_vote = question.votes.select_related().filter(user=request.user) + else: + question_vote = None #is this correct? if question_vote is not None and question_vote.count() > 0: question_vote = question_vote[0] -- cgit v1.2.3-1-g7c22 From 18fb07bad2392bdc6dae3d1c949c2602f6088934 Mon Sep 17 00:00:00 2001 From: Adolfo Fitoria Date: Sun, 9 Aug 2009 16:06:30 -0600 Subject: moving settings values from settings.py to settings_local.py for better organization --- settings.py | 51 +++++++++++++++++++++++++------------------------- settings_local.py | 56 ++++++++++++++++++++++++++++++++++++++----------------- 2 files changed, 65 insertions(+), 42 deletions(-) diff --git a/settings.py b/settings.py index fb594676..5947617e 100644 --- a/settings.py +++ b/settings.py @@ -17,27 +17,27 @@ ADMINS = ( ) MANAGERS = ADMINS -#email server settings -SERVER_EMAIL = '' -DEFAULT_FROM_EMAIL = 'team@cnprog.com' -EMAIL_HOST_USER = '' -EMAIL_HOST_PASSWORD = '' -EMAIL_SUBJECT_PREFIX = '[cnprog.com]' -EMAIL_HOST='smtp.gmail.com' -EMAIL_PORT='587' -EMAIL_USE_TLS=True +#email server settings (moved to settings_local) +#SERVER_EMAIL = '' +#DEFAULT_FROM_EMAIL = 'team@cnprog.com' +#EMAIL_HOST_USER = '' +#EMAIL_HOST_PASSWORD = '' +#EMAIL_SUBJECT_PREFIX = '[cnprog.com]' +#EMAIL_HOST='smtp.gmail.com' +#EMAIL_PORT='587' +#EMAIL_USE_TLS=True -#LOCALIZATIONS -TIME_ZONE = 'Asia/Chongqing Asia/Chungking' +#LOCALIZATIONS (Moved to settings_local) +#TIME_ZONE = 'Asia/Chongqing Asia/Chungking' # LANGUAGE_CODE = 'en-us' SITE_ID = 1 -#OTHER SETTINGS -APP_TITLE = u'CNProg.com 程序员问答社区' -APP_KEYWORDS = u'技术问答社区,中国程序员,编程技术社区,程序员社区,程序员论坛,程序员wiki,程序员博客' -APP_DESCRIPTION = u'中国程序员的编程技术问答社区。我们做专业的、可协作编辑的技术问答社区。' -APP_INTRO = u'

CNProg是一个面向程序员的可协作编辑的开放源代码问答社区

您可以在这里提问各类程序技术问题 - 问题不分语言和平台。 同时也希望您对力所能及的问题,给予您的宝贵答案。

' -APP_COPYRIGHT = 'Copyright CNPROG.COM 2009' +#OTHER SETTINGS (Moved to settings_local) +#APP_TITLE = u'CNProg.com 程序员问答社区' +#APP_KEYWORDS = u'技术问答社区,中国程序员,编程技术社区,程序员社区,程序员论坛,程序员wiki,程序员博客' +#APP_DESCRIPTION = u'中国程序员的编程技术问答社区。我们做专业的、可协作编辑的技术问答社区。' +#APP_INTRO = u'

CNProg是一个面向程序员的可协作编辑的开放源代码问答社区

您可以在这里提问各类程序技术问题 - 问题不分语言和平台。 同时也希望您对力所能及的问题,给予您的宝贵答案。

' +#APP_COPYRIGHT = 'Copyright CNPROG.COM 2009' ADMIN_MEDIA_PREFIX = '/admin/media/' SECRET_KEY = '$oo^&_m&qwbib=(_4m_n*zn-d=g#s0he5fx9xonnym#8p6yigm' # List of callables that know how to import templates from various sources. @@ -98,11 +98,12 @@ INSTALLED_APPS = ( # User settings from settings_local import * -USE_I18N = True -LANGUAGE_CODE = 'en' -EMAIL_VALIDATION = 'off' -MIN_USERNAME_LENGTH = 1 -EMAIL_UNIQUE = False -APP_URL = 'http://server.com' #used by email notif system and RSS -GOOGLE_SITEMAP_CODE = '55uGNnQVJW8p1bbXeF/Xbh9I7nZBM/wLhRz6N/I1kkA=' -GOOGLE_ANALYTICS_KEY = '' +#Moved to settings_local +#USE_I18N = True +#LANGUAGE_CODE = 'en' +#EMAIL_VALIDATION = 'off' +#MIN_USERNAME_LENGTH = 1 +#EMAIL_UNIQUE = False +#APP_URL = 'http://server.com' #used by email notif system and RSS +#GOOGLE_SITEMAP_CODE = '55uGNnQVJW8p1bbXeF/Xbh9I7nZBM/wLhRz6N/I1kkA=' +#GOOGLE_ANALYTICS_KEY = '' diff --git a/settings_local.py b/settings_local.py index d6c7224b..1ec944c6 100644 --- a/settings_local.py +++ b/settings_local.py @@ -1,25 +1,47 @@ # encoding:utf-8 +import os.path -#path must have slash appended!!! -SITE_SRC_ROOT = '/var/www/vhosts/default/htdocs/cnprog-tests/test/' +SITE_SRC_ROOT = os.path.dirname(__file__) LOG_FILENAME = 'django.lanai.log' #for logging import logging -logging.basicConfig(filename=SITE_SRC_ROOT + 'log/' + LOG_FILENAME, level=logging.DEBUG,) +logging.basicConfig(filename=SITE_SRC_ROOT + '/log/' + LOG_FILENAME, level=logging.DEBUG,) -DATABASE_NAME = 'cnprog' # Or path to database file if using sqlite3. -DATABASE_USER = 'cnprog' # Not used with sqlite3. +DATABASE_NAME = 'cnprog.sqlite3' # Or path to database file if using sqlite3. +DATABASE_USER = '' # Not used with sqlite3. DATABASE_PASSWORD = '' # Not used with sqlite3. -DATABASE_ENGINE = '' #mysql, etc - -#why does this stuff go here? -#MIDDLEWARE_CLASSES = ( -# 'django.middleware.gzip.GZipMiddleware', -# 'django.contrib.sessions.middleware.SessionMiddleware', -# 'django.middleware.locale.LocaleMiddleware', -# 'django.middleware.common.CommonMiddleware', -# 'django.contrib.auth.middleware.AuthenticationMiddleware', -# 'django.middleware.transaction.TransactionMiddleware', -# 'debug_toolbar.middleware.DebugToolbarMiddleware', -#) +DATABASE_ENGINE = 'sqlite3' #mysql, etc + +#Moved from settings.py for better organization. (please check it up to clean up settings.py) + +#email server settings +SERVER_EMAIL = '' +DEFAULT_FROM_EMAIL = 'team@cnprog.com' +EMAIL_HOST_USER = '' +EMAIL_HOST_PASSWORD = '' +EMAIL_SUBJECT_PREFIX = '[cnprog.com]' +EMAIL_HOST='smtp.gmail.com' +EMAIL_PORT='587' +EMAIL_USE_TLS=True + +#LOCALIZATIONS +TIME_ZONE = 'Asia/Chongqing Asia/Chungking' +# LANGUAGE_CODE = 'en-us' + +#OTHER SETTINGS +APP_TITLE = u'CNProg.com 程序员问答社区' +APP_KEYWORDS = u'技术问答社区,中国程序员,编程技术社区,程序员社区,程序员论坛,程序员wiki,程序员博客' +APP_DESCRIPTION = u'中国程序员的编程技术问答社区。我们做专业的、可协作编辑的技术问答社区。' +APP_INTRO = u'

CNProg是一个面向程序员的可协作编辑的开放源代码问答社区

您可以在这里提问各类程序技术问题 - 问题不分语言和平台。 同时也希望您对力所能及的问题,给予您的宝贵答案。

' +APP_COPYRIGHT = 'Copyright CNPROG.COM 2009' + +USE_I18N = True +LANGUAGE_CODE = 'en' +EMAIL_VALIDATION = 'off' +MIN_USERNAME_LENGTH = 1 +EMAIL_UNIQUE = False +APP_URL = 'http://server.com' #used by email notif system and RSS +GOOGLE_SITEMAP_CODE = '55uGNnQVJW8p1bbXeF/Xbh9I7nZBM/wLhRz6N/I1kkA=' +GOOGLE_ANALYTICS_KEY = '' + -- cgit v1.2.3-1-g7c22 From 5c0c30ad2091c649ea119f947aeb8589bb42627c Mon Sep 17 00:00:00 2001 From: Adolfo Fitoria Date: Sun, 9 Aug 2009 16:58:13 -0600 Subject: adding os.path to the log file --- settings_local.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings_local.py b/settings_local.py index 1ec944c6..c0483ffc 100644 --- a/settings_local.py +++ b/settings_local.py @@ -6,7 +6,7 @@ LOG_FILENAME = 'django.lanai.log' #for logging import logging -logging.basicConfig(filename=SITE_SRC_ROOT + '/log/' + LOG_FILENAME, level=logging.DEBUG,) +logging.basicConfig(filename=os.path.join(SITE_SRC_ROOT, 'log', LOG_FILENAME), level=logging.DEBUG,) DATABASE_NAME = 'cnprog.sqlite3' # Or path to database file if using sqlite3. DATABASE_USER = '' # Not used with sqlite3. -- cgit v1.2.3-1-g7c22 From 5e90a12217c03cf11c4517aacc5539f3012ec89b Mon Sep 17 00:00:00 2001 From: Adolfo Fitoria Date: Sun, 9 Aug 2009 17:35:31 -0600 Subject: fixing python2.4 compat in views --- forum/views.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/forum/views.py b/forum/views.py index 1566e9a8..4dc56946 100644 --- a/forum/views.py +++ b/forum/views.py @@ -1169,8 +1169,11 @@ def user_recent(request, user_id, user_view): self.type_id = type self.title = title self.summary = summary - self.title_link = u'/questions/%s/%s#%s' %(question_id, title, answer_id)\ - if int(answer_id) > 0 else u'/questions/%s/%s' %(question_id, title) + if int(answer_id) > 0: + self.title_link = u'/questions/%s/%s#%s' %(question_id, title, answer_id) + else: + self.title_link = u'/questions/%s/%s' %(question_id, title) + class AwardEvent: def __init__(self, time, type, id): self.time = time -- cgit v1.2.3-1-g7c22 From 5713267becc837578e363d5aac9f8d97af7ff7e2 Mon Sep 17 00:00:00 2001 From: Adolfo Fitoria Date: Sun, 9 Aug 2009 17:41:57 -0600 Subject: fixing more python 2.4 compat issues (hope it will be the last ones) --- forum/auth.py | 5 ++++- forum/models.py | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/forum/auth.py b/forum/auth.py index 36ca54d3..776746e8 100644 --- a/forum/auth.py +++ b/forum/auth.py @@ -167,7 +167,10 @@ def can_upload_files(request_user): ########################################### def calculate_reputation(origin, offset): result = int(origin) + int(offset) - return result if result > 0 else 1 + if (result > 0): + return result + else: + return 1 @transaction.commit_on_success def onFlaggedItem(item, post, user): diff --git a/forum/models.py b/forum/models.py index 255eb21f..4d8894e4 100644 --- a/forum/models.py +++ b/forum/models.py @@ -652,7 +652,10 @@ def record_comment_event(instance, created, **kwargs): from django.contrib.contenttypes.models import ContentType question_type = ContentType.objects.get_for_model(Question) question_type_id = question_type.id - type = TYPE_ACTIVITY_COMMENT_QUESTION if instance.content_type_id == question_type_id else TYPE_ACTIVITY_COMMENT_ANSWER + if (instance.content_type_id == question_type_id): + type = TYPE_ACTIVITY_COMMENT_QUESTION + else: + type = TYPE_ACTIVITY_COMMENT_ANSWER activity = Activity(user=instance.user, active_at=instance.added_at, content_object=instance, activity_type=type) activity.save() -- cgit v1.2.3-1-g7c22 From 5d900baf26548c0efec7f3f93c5f67252ed46666 Mon Sep 17 00:00:00 2001 From: Adolfo Fitoria Date: Sun, 9 Aug 2009 18:42:48 -0600 Subject: fixing a translation (to fit style) --- locale/es/LC_MESSAGES/django.mo | Bin 42843 -> 42834 bytes locale/es/LC_MESSAGES/django.po | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/locale/es/LC_MESSAGES/django.mo b/locale/es/LC_MESSAGES/django.mo index a2a27c2f..6c616b17 100644 Binary files a/locale/es/LC_MESSAGES/django.mo and b/locale/es/LC_MESSAGES/django.mo differ diff --git a/locale/es/LC_MESSAGES/django.po b/locale/es/LC_MESSAGES/django.po index b209c72c..7f407da3 100644 --- a/locale/es/LC_MESSAGES/django.po +++ b/locale/es/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2009-08-05 22:28-0400\n" -"PO-Revision-Date: 2009-08-07 11:21-0600\n" +"PO-Revision-Date: 2009-08-09 18:42-0600\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" @@ -1261,7 +1261,7 @@ msgstr "mi perfil" #: templates/header.html:42 msgid "ask a question" -msgstr "hacer una pregunta" +msgstr "preguntar" #: templates/header.html:57 msgid "search" -- cgit v1.2.3-1-g7c22 From 1297c9896ee28d20d495cc9f783a9cbc199a3285 Mon Sep 17 00:00:00 2001 From: Adolfo Fitoria Date: Sun, 9 Aug 2009 21:30:49 -0600 Subject: fixing stupid bug in templates.content/js/com.cnprog.i18n.js --- templates/content/js/com.cnprog.i18n.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/content/js/com.cnprog.i18n.js b/templates/content/js/com.cnprog.i18n.js index 96f755bf..848ad59e 100644 --- a/templates/content/js/com.cnprog.i18n.js +++ b/templates/content/js/com.cnprog.i18n.js @@ -100,7 +100,7 @@ var i18nEs = { 'anonymous users cannot flag offensive posts':'usuarios anónimos no pueden marcar publicaciones como ofensivas', 'cannot flag message as offensive twice':'no puede marcar mensaje como ofensivo dos veces', 'flag offensive cap exhausted':'cuota para marcar ofensivas ha sido excedida', - 'need >15 points to report spam':"necesita >15 puntos para reportar spam, + 'need >15 points to report spam':"necesita >15 puntos para reportar spam", 'confirm delete':"¿Está seguro que desea borrar esto?", 'anonymous users cannot delete/undelete':"usuarios anónimos no pueden borrar o recuperar publicaciones", 'post recovered':"publicación recuperada", -- cgit v1.2.3-1-g7c22 From ab12a5851236e044f0b8dec7f921995b01beb72a Mon Sep 17 00:00:00 2001 From: Adolfo Fitoria Date: Sun, 9 Aug 2009 21:34:41 -0600 Subject: modified settings.py and settings_local.py.dist to be more organized --- settings.py | 29 -------------------------- settings_local.py.dist | 56 +++++++++++++++++++++++++++++++++++--------------- 2 files changed, 39 insertions(+), 46 deletions(-) diff --git a/settings.py b/settings.py index 5947617e..fcfdb548 100644 --- a/settings.py +++ b/settings.py @@ -17,27 +17,8 @@ ADMINS = ( ) MANAGERS = ADMINS -#email server settings (moved to settings_local) -#SERVER_EMAIL = '' -#DEFAULT_FROM_EMAIL = 'team@cnprog.com' -#EMAIL_HOST_USER = '' -#EMAIL_HOST_PASSWORD = '' -#EMAIL_SUBJECT_PREFIX = '[cnprog.com]' -#EMAIL_HOST='smtp.gmail.com' -#EMAIL_PORT='587' -#EMAIL_USE_TLS=True - -#LOCALIZATIONS (Moved to settings_local) -#TIME_ZONE = 'Asia/Chongqing Asia/Chungking' -# LANGUAGE_CODE = 'en-us' SITE_ID = 1 -#OTHER SETTINGS (Moved to settings_local) -#APP_TITLE = u'CNProg.com 程序员问答社区' -#APP_KEYWORDS = u'技术问答社区,中国程序员,编程技术社区,程序员社区,程序员论坛,程序员wiki,程序员博客' -#APP_DESCRIPTION = u'中国程序员的编程技术问答社区。我们做专业的、可协作编辑的技术问答社区。' -#APP_INTRO = u'

CNProg是一个面向程序员的可协作编辑的开放源代码问答社区

您可以在这里提问各类程序技术问题 - 问题不分语言和平台。 同时也希望您对力所能及的问题,给予您的宝贵答案。

' -#APP_COPYRIGHT = 'Copyright CNPROG.COM 2009' ADMIN_MEDIA_PREFIX = '/admin/media/' SECRET_KEY = '$oo^&_m&qwbib=(_4m_n*zn-d=g#s0he5fx9xonnym#8p6yigm' # List of callables that know how to import templates from various sources. @@ -97,13 +78,3 @@ INSTALLED_APPS = ( # User settings from settings_local import * - -#Moved to settings_local -#USE_I18N = True -#LANGUAGE_CODE = 'en' -#EMAIL_VALIDATION = 'off' -#MIN_USERNAME_LENGTH = 1 -#EMAIL_UNIQUE = False -#APP_URL = 'http://server.com' #used by email notif system and RSS -#GOOGLE_SITEMAP_CODE = '55uGNnQVJW8p1bbXeF/Xbh9I7nZBM/wLhRz6N/I1kkA=' -#GOOGLE_ANALYTICS_KEY = '' diff --git a/settings_local.py.dist b/settings_local.py.dist index 2c8f939d..d6273070 100644 --- a/settings_local.py.dist +++ b/settings_local.py.dist @@ -1,25 +1,47 @@ -SITE_SRC_ROOT = '/Users/sailing/Development/cnprog_beta2' +# encoding:utf-8 +import os.path + +SITE_SRC_ROOT = os.path.dirname(__file__) +LOG_FILENAME = 'django.lanai.log' #for logging import logging -LOG_FILENAME = '/Users/sailing/Development/cnprog_beta2/django.lanai.log' -logging.basicConfig(filename=LOG_FILENAME,level=logging.DEBUG,) - +logging.basicConfig(filename=os.path.join(SITE_SRC_ROOT, 'log', LOG_FILENAME), level=logging.DEBUG,) -#Database configuration -DATABASE_ENGINE = 'mysql' -DATABASE_HOST = '' -DATABASE_PORT = '' -DATABASE_NAME = 'cnprog' # Or path to database file if using sqlite3. -DATABASE_USER = 'root' # Not used with sqlite3. +DATABASE_NAME = '' # Or path to database file if using sqlite3. +DATABASE_USER = '' # Not used with sqlite3. DATABASE_PASSWORD = '' # Not used with sqlite3. +DATABASE_ENGINE = '' #mysql, etc + +#Moved from settings.py for better organization. (please check it up to clean up settings.py) + +#email server settings +SERVER_EMAIL = '' +DEFAULT_FROM_EMAIL = 'team@cnprog.com' +EMAIL_HOST_USER = '' +EMAIL_HOST_PASSWORD = '' +EMAIL_SUBJECT_PREFIX = '[cnprog.com]' +EMAIL_HOST='smtp.gmail.com' +EMAIL_PORT='587' +EMAIL_USE_TLS=True + +#LOCALIZATIONS +TIME_ZONE = 'Asia/Chongqing Asia/Chungking' +# LANGUAGE_CODE = 'en-us' +#OTHER SETTINGS +APP_TITLE = u'CNProg.com 程序员问答社区' +APP_KEYWORDS = u'技术问答社区,中国程序员,编程技术社区,程序员社区,程序员论坛,程序员wiki,程序员博客' +APP_DESCRIPTION = u'中国程序员的编程技术问答社区。我们做专业的、可协作编辑的技术问答社区。' +APP_INTRO = u'

CNProg是一个面向程序员的可协作编辑的开放源代码问答社区

您可以在这里提问各类程序技术问题 - 问题不分语言和平台。 同时也希望您对力所能及的问题,给予您的宝贵答案。

' +APP_COPYRIGHT = 'Copyright CNPROG.COM 2009' -# Absolute path to the directory that holds media. -# Example: "/home/media/media.lawrence.com/" -MEDIA_ROOT = '/Users/sailing/Development/cnprog_beta2/templates/upfiles/' +USE_I18N = True +LANGUAGE_CODE = 'en' +EMAIL_VALIDATION = 'off' +MIN_USERNAME_LENGTH = 1 +EMAIL_UNIQUE = False +APP_URL = 'http://server.com' #used by email notif system and RSS +GOOGLE_SITEMAP_CODE = '55uGNnQVJW8p1bbXeF/Xbh9I7nZBM/wLhRz6N/I1kkA=' +GOOGLE_ANALYTICS_KEY = '' -# URL that handles the media served from MEDIA_ROOT. Make sure to use a -# trailing slash if there is a path component (optional in other cases). -# Examples: "http://media.lawrence.com", "http://example.com/media/" -MEDIA_URL = 'http://127.0.0.1:8000/upfiles/' -- cgit v1.2.3-1-g7c22 From d935eb1d66bd9e5c8da350bb7be3eb39f92d995c Mon Sep 17 00:00:00 2001 From: Adolfo Fitoria Date: Sun, 9 Aug 2009 22:36:26 -0600 Subject: adding meta keywords to questions and canonical tag --- forum/models.py | 3 +++ templates/question.html | 3 +++ 2 files changed, 6 insertions(+) diff --git a/forum/models.py b/forum/models.py index 4d8894e4..7de703ca 100644 --- a/forum/models.py +++ b/forum/models.py @@ -179,6 +179,9 @@ class Question(models.Model): """Creates a list of Tag names from the ``tagnames`` attribute.""" return [name for name in self.tagnames.split(u' ')] + def tagname_meta_generator(self): + return ','.join([str(tag) for tag in self.tagname_list()]) + def get_absolute_url(self): return '%s%s' % (reverse('question', args=[self.id]), self.title.replace(' ', '-')) diff --git a/templates/question.html b/templates/question.html index eaff9da3..1fd6467d 100644 --- a/templates/question.html +++ b/templates/question.html @@ -6,6 +6,9 @@ {% load i18n %} {% block title %}{% spaceless %}{{ question.get_question_title }}{% endspaceless %}{% endblock %} {% block forejs %} + + + {% if not question.closed and request.user.is_authenticated %} -- cgit v1.2.3-1-g7c22 From cc378999abd39e070dbc87b482f022201a86b7fa Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Mon, 10 Aug 2009 21:40:01 -0400 Subject: untested commit. merged Adolfos mods, validated most of html, slugify urls, fixed IE issues in openid signin --- forum/models.py | 20 ++++----- forum/templatetags/extra_filters.py | 9 +++- forum/templatetags/extra_tags.py | 6 ++- locale/en/LC_MESSAGES/django.po | 44 +++++++++---------- locale/es/LC_MESSAGES/django.po | 4 +- templates/404.html | 2 +- templates/500.html | 4 +- templates/answer_edit.html | 12 ++---- templates/answer_edit_tips.html | 2 - templates/ask.html | 17 ++++---- templates/authopenid/changeemail.html | 2 +- templates/authopenid/complete.html | 28 ++++++------ templates/authopenid/sendpw.html | 4 +- templates/authopenid/signin.html | 29 ++++++------- templates/authopenid/signup.html | 10 ++--- templates/badges.html | 5 +-- templates/base.html | 10 +++-- templates/base_content.html | 12 +++--- templates/book.html | 2 +- .../content/jquery-openid/images/blogger-1.png | Bin 0 -> 432 bytes .../content/jquery-openid/images/claimid-0.png | Bin 0 -> 629 bytes templates/content/jquery-openid/images/flickr.png | Bin 0 -> 426 bytes .../content/jquery-openid/images/livejournal-1.png | Bin 0 -> 713 bytes .../content/jquery-openid/images/myopenid-2.png | Bin 0 -> 511 bytes .../content/jquery-openid/images/technorati-1.png | Bin 0 -> 606 bytes .../content/jquery-openid/images/verisign-2.png | Bin 0 -> 859 bytes templates/content/jquery-openid/images/vidoop.png | Bin 0 -> 499 bytes .../content/jquery-openid/images/wordpress.png | Bin 0 -> 566 bytes templates/content/jquery-openid/openid.css | 2 +- templates/content/style/style.css | 1 - templates/faq.html | 2 +- templates/footer.html | 6 ++- templates/header.html | 17 ++++---- templates/index.html | 12 +++--- templates/logout.html | 1 - templates/privacy.html | 1 - templates/question.html | 47 ++++++++++++--------- templates/question_edit.html | 16 +++---- templates/question_edit_tips.html | 2 - templates/question_retag.html | 7 +-- templates/questions.html | 22 +++++----- templates/tags.html | 7 ++- templates/unanswered.html | 10 ++--- templates/user_info.html | 2 +- templates/user_preferences.html | 11 ++--- templates/user_responses.html | 2 +- templates/user_stats.html | 9 ++-- templates/user_tabs.html | 2 +- templates/users_questions.html | 2 +- 49 files changed, 199 insertions(+), 204 deletions(-) create mode 100644 templates/content/jquery-openid/images/blogger-1.png create mode 100644 templates/content/jquery-openid/images/claimid-0.png create mode 100644 templates/content/jquery-openid/images/flickr.png create mode 100644 templates/content/jquery-openid/images/livejournal-1.png create mode 100644 templates/content/jquery-openid/images/myopenid-2.png create mode 100644 templates/content/jquery-openid/images/technorati-1.png create mode 100644 templates/content/jquery-openid/images/verisign-2.png create mode 100644 templates/content/jquery-openid/images/vidoop.png create mode 100644 templates/content/jquery-openid/images/wordpress.png diff --git a/forum/models.py b/forum/models.py index 7de703ca..9510476a 100644 --- a/forum/models.py +++ b/forum/models.py @@ -274,6 +274,16 @@ class Question(models.Model): class Meta: db_table = u'question' +class FavoriteQuestion(models.Model): + """A favorite Question of a User.""" + question = models.ForeignKey(Question) + user = models.ForeignKey(User, related_name='user_favorite_questions') + added_at = models.DateTimeField(default=datetime.datetime.now) + class Meta: + db_table = u'favorite_question' + def __unicode__(self): + return '[%s] favorited at %s' %(self.user, self.added_at) + class QuestionRevision(models.Model): """A revision of a Question.""" question = models.ForeignKey(Question, related_name='revisions') @@ -422,16 +432,6 @@ class AnswerRevision(models.Model): flat=True)[0] + 1 super(AnswerRevision, self).save(**kwargs) -class FavoriteQuestion(models.Model): - """A favorite Question of a User.""" - question = models.ForeignKey(Question) - user = models.ForeignKey(User, related_name='user_favorite_questions') - added_at = models.DateTimeField(default=datetime.datetime.now) - class Meta: - db_table = u'favorite_question' - def __unicode__(self): - return '[%s] favorited at %s' %(self.user, self.added_at) - class Badge(models.Model): """Awarded for notable actions performed on the site by Users.""" GOLD = 1 diff --git a/forum/templatetags/extra_filters.py b/forum/templatetags/extra_filters.py index cec97920..d8b8e61f 100644 --- a/forum/templatetags/extra_filters.py +++ b/forum/templatetags/extra_filters.py @@ -1,8 +1,13 @@ -from django import template +from django import template from forum import auth register = template.Library() +@template.defaultfilters.stringfilter +@register.filter +def collapse(input): + return ' '.join(input.split()) + @register.filter def can_vote_up(user): return auth.can_vote_up(user) @@ -80,4 +85,4 @@ def cnprog_intword(number): else: return number except: - return number \ No newline at end of file + return number diff --git a/forum/templatetags/extra_tags.py b/forum/templatetags/extra_tags.py index ac4e6ca3..06a2d27c 100644 --- a/forum/templatetags/extra_tags.py +++ b/forum/templatetags/extra_tags.py @@ -14,7 +14,8 @@ register = template.Library() GRAVATAR_TEMPLATE = ('') + '?s=%(size)s&d=identicon&r=PG" ' + 'alt="%(username)s\'s gravatar image" />') @register.simple_tag def gravatar(user, size): @@ -26,11 +27,14 @@ def gravatar(user, size): """ try: gravatar = user['gravatar'] + username = user['username'] except (TypeError, AttributeError, KeyError): gravatar = user.gravatar + username = user.username return mark_safe(GRAVATAR_TEMPLATE % { 'size': size, 'gravatar_hash': gravatar, + 'username': template.defaultfilters.urlencode(username), }) MAX_FONTSIZE = 18 diff --git a/locale/en/LC_MESSAGES/django.po b/locale/en/LC_MESSAGES/django.po index 3dda9ce9..07532566 100644 --- a/locale/en/LC_MESSAGES/django.po +++ b/locale/en/LC_MESSAGES/django.po @@ -148,7 +148,7 @@ msgstr "" #: django_authopenid/views.py:417 django_authopenid/views.py:544 msgid "Welcome" -msgstr "Verification Email from Q&A forum" +msgstr "Verification Email from Q&A forum" #: django_authopenid/views.py:507 msgid "Password changed." @@ -812,7 +812,7 @@ msgid "must have valid %(email)s to post" msgstr "" "Looks like your email address, %(email)s has not " "yet been validated. To post messages you must verify your email, " -"please see more details here.
You can submit " +"please see more details here.
You can submit " "your question now and validate email after that. Your question will saved as " "pending meanwhile. " @@ -1135,12 +1135,12 @@ msgstr "" "

How? If you have just set or changed your email " "address - check your email and click the included link." -"
The link contains a key generated specifically for you. You can also " +"
The link contains a key generated specifically for you. You can also " "