aboutsummaryrefslogtreecommitdiffstats
path: root/nikola/post.py
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2024-04-23 00:38:24 -0400
committerLibravatarUnit 193 <unit193@unit193.net>2024-04-23 00:38:24 -0400
commit0199f695e93782d728bd31857afe54f4df92f351 (patch)
tree34e9030a05a89461d222172615c74891fba1e5ef /nikola/post.py
parent22b8f5dae59e876643e8e3002f72282f3e8608c5 (diff)
parent9b0e86a8e74768c4fe848fb5ce8d754292db4e3e (diff)
Update upstream source from tag 'upstream/8.3.0'
Update to upstream version '8.3.0' with Debian dir bc13791b86ab63e4473e92288f1749c55a6ad540
Diffstat (limited to 'nikola/post.py')
-rw-r--r--nikola/post.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/nikola/post.py b/nikola/post.py
index 42df0eb..792e6f0 100644
--- a/nikola/post.py
+++ b/nikola/post.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2022 Roberto Alsina and others.
+# Copyright © 2012-2024 Roberto Alsina and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
@@ -350,8 +350,8 @@ class Post(object):
if self.config['__invariant__']:
default_metadata['date'] = datetime.datetime(2013, 12, 31, 23, 59, 59, tzinfo=self.config['__tzinfo__'])
else:
- default_metadata['date'] = datetime.datetime.utcfromtimestamp(
- os.stat(self.source_path).st_ctime).replace(tzinfo=dateutil.tz.tzutc()).astimezone(self.config['__tzinfo__'])
+ default_metadata['date'] = datetime.datetime.fromtimestamp(
+ os.stat(self.source_path).st_ctime, dateutil.tz.tzutc()).astimezone(self.config['__tzinfo__'])
# If time zone is set, build localized datetime.
try:
@@ -1213,12 +1213,12 @@ def get_meta(post, lang):
if lang is None:
# Only perform these checks for the default language
- if 'slug' not in meta:
+ if 'slug' not in meta or not meta['slug']:
# If no slug is found in the metadata use the filename
meta['slug'] = slugify(os.path.splitext(
os.path.basename(post.source_path))[0], post.default_lang)
- if 'title' not in meta:
+ if 'title' not in meta or not meta['title']:
# If no title is found, use the filename without extension
meta['title'] = os.path.splitext(
os.path.basename(post.source_path))[0]