Skip to content

Commit 29df5f0

Browse files
committed
Merge pull request #32 from pvieytes/scripts
add update_cache script fix #32 #22
2 parents f02efe8 + 524c5f3 commit 29df5f0

File tree

10 files changed

+49
-3
lines changed

10 files changed

+49
-3
lines changed

src/blogs/ManageBlog.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def get_all_blogs():
3232
return cache.get('all_blogs')
3333

3434
@staticmethod
35-
def update_blogs():
35+
def update_blogs_cache():
3636
ManageBlog.update_news_blog()
3737
ManageBlog.update_all_blogs()
3838

src/main/management/__init__.py

Whitespace-only changes.

src/main/management/commands/__init__.py

Whitespace-only changes.
+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
from django.core.management.base import NoArgsCommand
2+
from nannycentral.utils.urls import check_urls
3+
from nannycentral.utils import log
4+
5+
6+
7+
8+
class Command(NoArgsCommand):
9+
help = """
10+
check all medals criteria.
11+
"""
12+
@flag_decorator
13+
def handle_noargs(self, **options):
14+
15+
msg = "SCRIPT - 'check_urls' - start"
16+
log.info(msg)
17+
18+
try:
19+
check_urls()
20+
except:
21+
msg = "SCRIPT - 'check_urls' - error"
22+
log.error(msg)
23+
msg = "SCRIPT - 'check_urls' - end"
24+
log.info(msg)
25+
26+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from django.core.management.base import NoArgsCommand
2+
3+
class Command(NoArgsCommand):
4+
help = """
5+
check automatic rehabs.
6+
"""
7+
def handle_noargs(self, **options):
8+
print "update cache"

src/management/__init__.py

Whitespace-only changes.

src/management/commands/__init__.py

Whitespace-only changes.
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from django.core.management.base import NoArgsCommand
2+
from osweb.blogs import ManageBlog
3+
from osweb.twitter import ManageTwitter
4+
5+
class Command(NoArgsCommand):
6+
help = """
7+
check automatic rehabs.
8+
"""
9+
def handle_noargs(self, **options):
10+
ManageTwitter.update_tweets_cache()
11+
ManageBlog.update_blogs_cache()

src/settings.py.in

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ INSTALLED_APPS = (
5050
# 'django.contrib.admin',
5151
# Uncomment the next line to enable admin documentation:
5252
# 'django.contrib.admindocs',
53+
'osweb',
5354

5455
)
5556

src/twitter/ManageTwitter.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,11 @@ class ManageTwitter():
6868
@staticmethod
6969
def get_tweets():
7070
if cache.get('tweets') is None:
71-
ManageTwitter.update_tweets_cahce()
71+
ManageTwitter.update_tweets_cache()
7272
return cache.get('tweets')
7373

7474
@staticmethod
75-
def update_tweets_cahce():
75+
def update_tweets_cache():
7676
tweets = ManageTwitter.read_tweets()
7777
cache.set('tweets', tweets, settings.TWEETS_CACHE_TIME)
7878

0 commit comments

Comments
 (0)