diff options
author | Philip Sargent <philip.sargent@klebos.com> | 2021-05-02 15:50:20 +0100 |
---|---|---|
committer | Philip Sargent <philip.sargent@klebos.com> | 2021-05-02 15:50:20 +0100 |
commit | 51da26564fa85d5c615771a12f5595f94f56c517 (patch) | |
tree | 5c7418ae6e83bf191aea3b5d0c5f9ed9e2f7131a /parsers | |
parent | a9ffae9b87b001ecd2f5fbc626d3c782548acf94 (diff) | |
download | troggle-51da26564fa85d5c615771a12f5595f94f56c517.tar.gz troggle-51da26564fa85d5c615771a12f5595f94f56c517.tar.bz2 troggle-51da26564fa85d5c615771a12f5595f94f56c517.zip |
chnage img fix to import, not display
Diffstat (limited to 'parsers')
-rw-r--r-- | parsers/logbooks.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/parsers/logbooks.py b/parsers/logbooks.py index 3bb49b5..7509db4 100644 --- a/parsers/logbooks.py +++ b/parsers/logbooks.py @@ -101,7 +101,7 @@ def GetTripPersons(trippeople, expedition, logtime_underground, tid=None): def EnterLogIntoDbase(date, place, title, text, trippeople, expedition, logtime_underground, entry_type="wiki", tid=None): """ saves a logbook entry and related persontrips - Does NOT save the expeditionday_id - all NULLs. why? + Does NOT save the expeditionday_id - all NULLs. why? Because we are deprecating expeditionday ! """ try: trippersons, author = GetTripPersons(trippeople, expedition, logtime_underground, tid=tid) @@ -127,6 +127,10 @@ def EnterLogIntoDbase(date, place, title, text, trippeople, expedition, logtime_ cave=None if lplace not in noncaveplaces: cave = GetCaveLookup().get(lplace) + + y = str(date)[:4] + text = text.replace('src="', f'src="/years/{y}/' ) + text = text.replace("src='", f"src='/years/{y}/" ) #Check for an existing copy of the current entry, and save expeditionday = expedition.get_expedition_day(date) @@ -134,9 +138,10 @@ def EnterLogIntoDbase(date, place, title, text, trippeople, expedition, logtime_ # 'cave' is converted to a string doing this, which renders as the cave slug. # but it is a db query which we should try to avoid - rewrite this - #NEW slug for a logbook entry here! Use the unique id, not the title !!! + #NEW slug for a logbook entry here! Unique id + slugified title fragment slug = tid + "_" + slugify(title)[:10].replace('-','_') nonLookupAttribs={'place':place, 'text':text, 'expedition':expedition, 'cave_slug':str(cave), 'slug': slug, 'entry_type':entry_type} + lbo, created=save_carefully(LogbookEntry, lookupAttribs, nonLookupAttribs) |