[damned-lies] Add POT/tar cleaning in run-maintenance task
- From: Claude Paroz <claudep src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [damned-lies] Add POT/tar cleaning in run-maintenance task
- Date: Tue, 1 Feb 2011 12:30:56 +0000 (UTC)
commit 613bbbb11d03851c6ff268c13e1e39fa48ad0f9f
Author: Claude Paroz <claude 2xlibre net>
Date: Tue Feb 1 13:30:00 2011 +0100
Add POT/tar cleaning in run-maintenance task
languages/views.py | 10 ++++++++++
stats/management/commands/run-maintenance.py | 2 ++
2 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/languages/views.py b/languages/views.py
index 7c7ffe6..fb792f6 100644
--- a/languages/views.py
+++ b/languages/views.py
@@ -176,3 +176,13 @@ def get_domain_stats(mods, node_name):
content += "<svnpath>%s</svnpath>" % stat.vcs_web_path()
content += "</%s>" % node_name
return content
+
+# ********* Utility functions ******************
+def clean_tar_files():
+ """ Delete outdated tar.gz files generated by the language_release_tar view """
+ tar_directory = os.path.join(settings.POTDIR, 'tar')
+ if not os.path.exists(tar_directory):
+ return
+ for tarfile in os.listdir(tar_directory):
+ if not tarfile.endswith("%s.tar.gz" % date.today()):
+ os.remove(tarfile)
diff --git a/stats/management/commands/run-maintenance.py b/stats/management/commands/run-maintenance.py
index 9242b65..706c7ec 100644
--- a/stats/management/commands/run-maintenance.py
+++ b/stats/management/commands/run-maintenance.py
@@ -3,6 +3,7 @@ from django.core.management.base import BaseCommand
from people.models import Person
from teams.models import Role
from vertimus.models import ActionDbArchived
+from languages.views import clean_tar_files
class Command(BaseCommand):
help = "Run maintenance tasks"
@@ -11,3 +12,4 @@ class Command(BaseCommand):
Person.clean_unactivated_accounts()
Role.inactivate_unused_roles()
ActionDbArchived.clean_old_actions(365)
+ clean_tar_files()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]