Commit ce4fd7a8 by Bridger Maxwell

Removed the lost and found until it can be debugged.

parent 4ddc7cbd
......@@ -214,39 +214,40 @@ def on_article_relation_save(instance, *args, **kwargs):
post_save.connect(on_article_relation_save, ArticleForObject)
def on_article_delete(instance, *args, **kwargs):
# If an article is deleted, then throw out its URLPaths
# But move all descendants to a lost-and-found node.
site = Site.objects.get_current()
# Get the Lost-and-found path or create a new one
try:
lost_and_found = URLPath.objects.get(slug=settings.LOST_AND_FOUND_SLUG,
parent=URLPath.root(),
site=site)
except URLPath.DoesNotExist:
article = Article(group_read = True,
group_write = False,
other_read = False,
other_write = False)
article.add_revision(ArticleRevision(
content=_(u'Articles who lost their parents\n'
'===============================\n\n'
'The children of this article have had their parents deleted. You should probably find a new home for them.'),
title=_(u"Lost and found")))
lost_and_found = URLPath.objects.create(slug=settings.LOST_AND_FOUND_SLUG,
parent=URLPath.root(),
site=site,
article=article)
article.add_object_relation(lost_and_found)
for urlpath in URLPath.objects.filter(articles__article=instance, site=site):
# Delete the children
for child in urlpath.get_children():
child.move_to(lost_and_found)
# ...and finally delete the path itself
# TODO: This should be unnecessary because of URLPath.article(...ondelete=models.CASCADE)
urlpath.delete()
pre_delete.connect(on_article_delete, Article)
# TODO: When a parent all of its children are purged, they get sucked up into the lost and found. It is disabled for now.
# def on_article_delete(instance, *args, **kwargs):
# # If an article is deleted, then throw out its URLPaths
# # But move all descendants to a lost-and-found node.
# site = Site.objects.get_current()
#
# # Get the Lost-and-found path or create a new one
# try:
# lost_and_found = URLPath.objects.get(slug=settings.LOST_AND_FOUND_SLUG,
# parent=URLPath.root(),
# site=site)
# except URLPath.DoesNotExist:
# article = Article(group_read = True,
# group_write = False,
# other_read = False,
# other_write = False)
# article.add_revision(ArticleRevision(
# content=_(u'Articles who lost their parents\n'
# '===============================\n\n'
# 'The children of this article have had their parents deleted. You should probably find a new home for them.'),
# title=_(u"Lost and found")))
# lost_and_found = URLPath.objects.create(slug=settings.LOST_AND_FOUND_SLUG,
# parent=URLPath.root(),
# site=site,
# article=article)
# article.add_object_relation(lost_and_found)
#
#
# for urlpath in URLPath.objects.filter(articles__article=instance, site=site):
# # Delete the children
# for child in urlpath.get_children():
# child.move_to(lost_and_found)
# # ...and finally delete the path itself
# # TODO: This should be unnecessary because of URLPath.article(...ondelete=models.CASCADE)
# urlpath.delete()
#
# pre_delete.connect(on_article_delete, Article)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment