Skip to content

Commit 75bf305

Browse files
committed
fix: Docstring
1 parent 2d4c639 commit 75bf305

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/viur/core/modules/translation.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import json
44
import logging
55
import os
6-
from datetime import timedelta as td
6+
import datetime
77
from viur.core import conf, db, utils, current, errors
88
from viur.core.decorators import exposed
99
from viur.core.bones import *
@@ -150,7 +150,6 @@ def read(cls, skel, *args, **kwargs):
150150

151151
@classmethod
152152
def write(cls, skel, **kwargs):
153-
154153
# Create the key from the name on initial write!
155154
if not skel["key"]:
156155
skel["key"] = db.Key(KINDNAME, skel["name"].lower())
@@ -208,6 +207,10 @@ def adminInfo(self):
208207
}
209208

210209
def addSkel(self):
210+
"""
211+
Returns a custom TranslationSkel where the name is editable.
212+
The name becomes part of the key.
213+
"""
211214
skel = super().addSkel().ensure_is_cloned()
212215
skel.name.readOnly = False
213216
skel.name.required = True
@@ -230,10 +233,11 @@ def onDeleted(self, *args, **kwargs):
230233
def _reload_translations(self):
231234
if (
232235
self._last_reload is not None
233-
and self._last_reload - utils.utcNow() < td(minutes=10)
236+
and self._last_reload - utils.utcNow() < datetime.timedelta(minutes=10)
234237
):
235238
# debounce: translations has been reload recently, skip this
236239
return None
240+
237241
logging.info("Reload translations")
238242
# TODO: this affects only the current instance
239243
self._last_reload = utils.utcNow()

0 commit comments

Comments
 (0)