diff options
author | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2009-12-09 20:21:34 -0500 |
---|---|---|
committer | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2009-12-09 20:21:34 -0500 |
commit | 82d35490db90878f013523c4d1a5ec3af2df8b23 (patch) | |
tree | b73053f97366a7c5efe54602ce305f3f3bbaf799 | |
parent | fdac57838a27f3837b0ef187a9a3f86f293d29b1 (diff) | |
download | askbot-82d35490db90878f013523c4d1a5ec3af2df8b23.tar.gz askbot-82d35490db90878f013523c4d1a5ec3af2df8b23.tar.bz2 askbot-82d35490db90878f013523c4d1a5ec3af2df8b23.zip |
made google sitemap reader ping on every question/answer and comment save and question delete
-rw-r--r-- | INSTALL | 15 | ||||
-rw-r--r-- | forum/models.py | 22 |
2 files changed, 35 insertions, 2 deletions
@@ -8,7 +8,8 @@ B. INSTALLATION 4. Installation under Apache/WSGI 5. Full text search 6. Email subscriptions - 7. Miscellaneous + 7. Sitemap + 8. Miscellaneous C. CONFIGURATION PARAMETERS (settings_local.py) D. CUSTOMIZATION @@ -212,7 +213,17 @@ WSGIPythonEggs /var/python/eggs #must be readable and writable by apache subscription sender may be tested manually in shell by calling cron/send_email_alerts -7. Miscellaneous +7. Sitemap +Sitemap will be available at /<settings_local.FORUM_SCRIPT_ALIAS>sitemap.xml +e.g yoursite.com/forum/sitemap.xml + +google will be pinged each time question, answer or +comment is saved or a question deleted + +for this to be useful - do register you sitemap with Google at +https://www.google.com/webmasters/tools/ + +8. Miscellaneous There are some demo scripts under sql_scripts folder, including badges and test accounts for CNProg.com. You diff --git a/forum/models.py b/forum/models.py index eb3650f8..bceced1a 100644 --- a/forum/models.py +++ b/forum/models.py @@ -102,6 +102,14 @@ class Comment(models.Model): class Meta: ordering = ('-added_at',) db_table = u'comment' + + def save(self,**kwargs): + super(Comment,self).save(**kwargs) + try: + ping_google() + except Exception: + logging.debug('problem pinging google did you register you sitemap with google?') + def __unicode__(self): return self.comment @@ -199,6 +207,13 @@ class Question(models.Model): objects = QuestionManager() + def delete(self): + super(Question, self).delete() + try: + ping_google() + except Exception: + logging.debug('problem pinging google did you register you sitemap with google?') + def save(self, **kwargs): """ Overridden to manually manage addition of tags when the object @@ -458,6 +473,13 @@ class Answer(models.Model): get_comments = get_object_comments get_last_update_info = post_get_last_update_info + def save(self,**kwargs): + super(Answer,self).save(**kwargs) + try: + ping_google() + except Exception: + logging.debug('problem pinging google did you register you sitemap with google?') + def get_user_vote(self, user): votes = self.votes.filter(user=user) if votes.count() > 0: |