mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
commit
b2092fe0e7
4 changed files with 24 additions and 7 deletions
|
|
@ -2,6 +2,9 @@
|
|||
import re
|
||||
import os
|
||||
import shutil
|
||||
import time
|
||||
import calendar
|
||||
import pytz
|
||||
from datetime import datetime
|
||||
from codecs import open as _open
|
||||
from itertools import groupby
|
||||
|
|
@ -222,3 +225,13 @@ def files_changed(path, extensions):
|
|||
LAST_MTIME = mtime
|
||||
return True
|
||||
return False
|
||||
|
||||
def set_date_tzinfo(d, tz_name=None):
|
||||
""" Date without tzinfo shoudbe utc.
|
||||
This function set the right tz to date that aren't utc and don't have tzinfo
|
||||
"""
|
||||
if tz_name is not None:
|
||||
tz = pytz.timezone(tz_name)
|
||||
return tz.localize(d)
|
||||
else:
|
||||
return d
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ from functools import partial
|
|||
import locale
|
||||
|
||||
from feedgenerator import Atom1Feed, Rss201rev2Feed
|
||||
from pelican.utils import get_relative_path
|
||||
from pelican.utils import get_relative_path, set_date_tzinfo
|
||||
from pelican.paginator import Paginator
|
||||
from pelican.log import *
|
||||
|
||||
|
|
@ -37,7 +37,8 @@ class Writer(object):
|
|||
description=item.content,
|
||||
categories=item.tags if hasattr(item, 'tags') else None,
|
||||
author_name=getattr(item, 'author', 'John Doe'),
|
||||
pubdate=item.date)
|
||||
pubdate=set_date_tzinfo(item.date,
|
||||
self.settings.get('TIMEZONE', None)))
|
||||
|
||||
def write_feed(self, elements, context, filename=None, feed_type='atom'):
|
||||
"""Generate a feed with the list of articles provided
|
||||
|
|
|
|||
2
setup.py
2
setup.py
|
|
@ -4,7 +4,7 @@ import sys
|
|||
|
||||
VERSION = "2.7.2" # find a better way to do so.
|
||||
|
||||
requires = ['feedgenerator', 'jinja2', 'pygments', 'docutils']
|
||||
requires = ['feedgenerator', 'jinja2', 'pygments', 'docutils', 'pytz']
|
||||
if sys.version_info < (2,7):
|
||||
requires.append('argparse')
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ TEMPLATES={
|
|||
PELICAN=$pelican
|
||||
PELICANOPTS=$pelicanopts
|
||||
|
||||
BASEDIR=$basedir
|
||||
BASEDIR=$$(PWD)
|
||||
INPUTDIR=$$(BASEDIR)/src
|
||||
OUTPUTDIR=$$(BASEDIR)/output
|
||||
CONFFILE=$$(BASEDIR)/pelican.conf.py
|
||||
|
|
@ -36,20 +36,21 @@ help:
|
|||
\t@echo ' '
|
||||
|
||||
|
||||
html: $$(OUTPUTDIR)/index.html
|
||||
html: clean $$(OUTPUTDIR)/index.html
|
||||
\t@echo 'Done'
|
||||
|
||||
$$(OUTPUTDIR)/%.html:
|
||||
\t$$(PELICAN) $$(INPUTDIR) -o $$(OUTPUTDIR) -s $$(CONFFILE)
|
||||
|
||||
clean:
|
||||
\trm -r $$(OUTPUTDIR)/*
|
||||
\trm -fr $$(OUTPUTDIR)
|
||||
\tmkdir $$(OUTPUTDIR)
|
||||
|
||||
dropbox_upload: $$(OUTPUTDIR)/index.html
|
||||
\tcp -r $$(OUTPUTDIR)/* $$(DROPBOX_DIR)
|
||||
|
||||
ssh_upload: $$(OUTPUTDIR)/index.html
|
||||
\tscp -rv $$(OUTPUTDIR)/* $$(SSH_USER)@$$(SSH_HOST)/$$(SSH_TARGET_DIR)
|
||||
\tscp -r $$(OUTPUTDIR)/* $$(SSH_USER)@$$(SSH_HOST):$$(SSH_TARGET_DIR)
|
||||
|
||||
ftp_upload: $$(OUTPUTDIR)/index.html
|
||||
\tlftp ftp://$$(FTP_USER)@$$(FTP_HOST) -e "mirror -R $$(OUTPUT_DIR)/* $$(FTP_TARGET_DIR) ; quit"
|
||||
|
|
@ -64,6 +65,8 @@ AUTHOR = u"$author"
|
|||
SITENAME = u"$sitename"
|
||||
SITEURL = '/'
|
||||
|
||||
TIMEZONE = 'Europe/Paris'
|
||||
|
||||
DEFAULT_LANG='$lang'
|
||||
|
||||
# Blogroll
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue