forked from github/pelican
force timestamp conversion in tumblr importer to be UTC with offset and adjust tests
This commit is contained in:
parent
9c87d8f3a3
commit
83a8059d02
2 changed files with 13 additions and 16 deletions
|
|
@ -1,6 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import argparse
|
||||
import datetime
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
|
|
@ -416,10 +417,12 @@ def tumblr2fields(api_key, blogname):
|
|||
slug = post.get('slug') or slugify(title, regex_subs=subs)
|
||||
tags = post.get('tags')
|
||||
timestamp = post.get('timestamp')
|
||||
date = SafeDatetime.fromtimestamp(int(timestamp)).strftime(
|
||||
"%Y-%m-%d %H:%M:%S")
|
||||
slug = SafeDatetime.fromtimestamp(int(timestamp)).strftime(
|
||||
"%Y-%m-%d-") + slug
|
||||
date = SafeDatetime.fromtimestamp(
|
||||
int(timestamp), tz=datetime.timezone.utc
|
||||
).strftime("%Y-%m-%d %H:%M:%S%z")
|
||||
slug = SafeDatetime.fromtimestamp(
|
||||
int(timestamp), tz=datetime.timezone.utc
|
||||
).strftime("%Y-%m-%d-") + slug
|
||||
format = post.get('format')
|
||||
content = post.get('body')
|
||||
type = post.get('type')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue