From: yomguy Date: Thu, 24 Mar 2011 16:55:07 +0000 (+0100) Subject: fix rolling time period X-Git-Tag: 1.1~339 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=cdc80b6a7c3ca85f797f1a77e0ce2894e48e7e5c;p=telemeta.git fix rolling time period --- diff --git a/INSTALL b/INSTALL index 8d282e2e..ac36a4a8 100644 --- a/INSTALL +++ b/INSTALL @@ -139,6 +139,8 @@ Add the following variables: TELEMETA_CACHE_DIR = absolute path to the cache directory that you just created TELEMETA_GMAP_KEY = your Google Map API key TELEMETA_DOWNLOAD_ENABLED = True to enable audio data download + TELEMETA_RSS_HOST = the public hostname of the RSS server + TELEMETA_PUBLIC_ACCESS_PERIOD = 51 # (in years) Just paste the lines below:: @@ -147,8 +149,7 @@ Just paste the lines below:: TELEMETA_EXPORT_CACHE_DIR = TELEMETA_CACHE_DIR + "/export" TELEMETA_DATA_CACHE_DIR = TELEMETA_CACHE_DIR + "/data" CACHE_BACKEND = "file://" + TELEMETA_CACHE_DIR + "/data" - - + -------------------------- 5. Initialize the database -------------------------- diff --git a/telemeta/web/base.py b/telemeta/web/base.py index 6ac1e52b..220c246c 100644 --- a/telemeta/web/base.py +++ b/telemeta/web/base.py @@ -246,7 +246,7 @@ class WebView(object): analyzers = self.item_analyze(item) playlists = self.get_playlists(request) - # Rrolling publishing date : Public access when time between recorded year + # Rolling publishing date : Public access when time between recorded year # and currant year is over settings value PUBLIC_ACCESS_PERIOD date_from = item.recorded_from_date date_to = item.recorded_to_date @@ -260,7 +260,7 @@ class WebView(object): if date: year = str(date).split('-') year_now = datetime.datetime.now().strftime("%Y") - if int(year_now) - int(year[0]) < settings.PUBLIC_ACCESS_PERIOD: + if int(year_now) - int(year[0]) < settings.TELEMETA_PUBLIC_ACCESS_PERIOD: public_access = False return render(request, template, @@ -756,7 +756,6 @@ class WebView(object): return redirect('telemeta-home') #MARKERS - @jsonrpc_method('telemeta.add_marker') def add_marker(request, marker): # marker must be a dict @@ -807,7 +806,6 @@ class WebView(object): raise 'Error : Bad marker dictionnary' # PLAYLISTS - @jsonrpc_method('telemeta.add_playlist') def add_playlist(request, playlist): # playlist must be a dict @@ -905,16 +903,13 @@ class WebView(object): for tag in tags: data.append(item[tag]) writer.writerow(data) - return response def help(self, request): """Render the help page""" - template = loader.get_template('telemeta/index.html') ids = [id for id in MediaItem.objects.all().values_list('id', flat=True).order_by('?')[0:3]] items = MediaItem.objects.enriched().filter(pk__in=ids) - context = RequestContext(request, { 'page_content': pages.get_page_content(request, 'parts/help', ignore_slash_issue=True), 'items': items}) @@ -925,7 +920,7 @@ class WebView(object): rss_item_list = [] organization = settings.TELEMETA_ORGANIZATION subjects = settings.TELEMETA_SUBJECTS - rss_host = settings.RSS_HOST + rss_host = settings.TELEMETA.RSS_HOST date_now = datetime.datetime.now() revisions = self.get_revisions(request) tags = ['title', 'description', 'comment'] @@ -933,7 +928,6 @@ class WebView(object): for r in revisions: revision = r['revision'] element = r['element'] - if element: link = 'http://' + rss_host + '/' + revision.element_type + 's/' + str(element.public_id) description = ''