diff --git a/kallithea/controllers/admin/users.py b/kallithea/controllers/admin/users.py
--- a/kallithea/controllers/admin/users.py
+++ b/kallithea/controllers/admin/users.py
@@ -44,7 +44,7 @@ from kallithea.lib.auth import AuthUser,
from kallithea.lib.base import BaseController, IfSshEnabled, render
from kallithea.lib.exceptions import DefaultUserException, UserCreationError, UserOwnsReposException
from kallithea.lib.utils import action_logger
-from kallithea.lib.utils2 import datetime_to_time, generate_api_key, safe_int
+from kallithea.lib.utils2 import datetime_to_time, fmt_date, generate_api_key, safe_int
from kallithea.lib.webutils import url
from kallithea.model import db, meta
from kallithea.model.api_key import ApiKeyModel
@@ -90,7 +90,7 @@ class UsersController(BaseController):
"username": username(user.user_id, user.username),
"firstname": webutils.escape(user.name),
"lastname": webutils.escape(user.lastname),
- "last_login": h.fmt_date(user.last_login),
+ "last_login": fmt_date(user.last_login),
"last_login_raw": datetime_to_time(user.last_login),
"active": h.boolicon(user.active),
"admin": h.boolicon(user.admin),
diff --git a/kallithea/controllers/feed.py b/kallithea/controllers/feed.py
--- a/kallithea/controllers/feed.py
+++ b/kallithea/controllers/feed.py
@@ -40,7 +40,7 @@ from kallithea.lib import webutils
from kallithea.lib.auth import HasRepoPermissionLevelDecorator, LoginRequired
from kallithea.lib.base import BaseRepoController
from kallithea.lib.diffs import DiffProcessor
-from kallithea.lib.utils2 import asbool, safe_int, safe_str, shorter
+from kallithea.lib.utils2 import asbool, fmt_date, safe_int, safe_str, shorter
log = logging.getLogger(__name__)
@@ -58,7 +58,7 @@ class FeedController(BaseRepoController)
def __get_desc(self, cs):
desc_msg = [(_('%s committed on %s')
- % (h.person(cs.author), h.fmt_date(cs.date))) + '
']
+ % (h.person(cs.author), fmt_date(cs.date))) + '
']
# branches, tags, bookmarks
for branch in cs.branches:
desc_msg.append('branch: %s
' % branch)
diff --git a/kallithea/lib/helpers.py b/kallithea/lib/helpers.py
--- a/kallithea/lib/helpers.py
+++ b/kallithea/lib/helpers.py
@@ -38,7 +38,8 @@ from kallithea.lib.auth import HasPermis
from kallithea.lib.diffs import BIN_FILENODE, CHMOD_FILENODE, DEL_FILENODE, MOD_FILENODE, NEW_FILENODE, RENAMED_FILENODE
from kallithea.lib.markup_renderer import url_re
from kallithea.lib.pygmentsutils import get_custom_lexer
-from kallithea.lib.utils2 import MENTIONS_REGEX, AttributeDict, age, asbool, credentials_filter, safe_bytes, safe_int, safe_str, shorter, time_to_datetime
+from kallithea.lib.utils2 import (MENTIONS_REGEX, AttributeDict, age, asbool, credentials_filter, fmt_date, safe_bytes, safe_int, safe_str, shorter,
+ time_to_datetime)
from kallithea.lib.vcs.backends.base import BaseChangeset, EmptyChangeset
from kallithea.lib.vcs.exceptions import ChangesetDoesNotExistError
#==============================================================================
@@ -80,6 +81,7 @@ assert HasRepoGroupPermissionLevel
assert HasRepoPermissionLevel
# from utils2
assert age
+assert fmt_date
assert shorter
assert time_to_datetime
# from vcs
@@ -419,12 +421,6 @@ def show_id(cs):
return raw_id
-def fmt_date(date):
- if date:
- return date.strftime("%Y-%m-%d %H:%M:%S")
- return ""
-
-
def is_git(repository):
if hasattr(repository, 'alias'):
_type = repository.alias
diff --git a/kallithea/lib/utils2.py b/kallithea/lib/utils2.py
--- a/kallithea/lib/utils2.py
+++ b/kallithea/lib/utils2.py
@@ -265,6 +265,12 @@ def age(prevdate, show_short_version=Fal
return _('just now')
+def fmt_date(date):
+ if date:
+ return date.strftime("%Y-%m-%d %H:%M:%S")
+ return ""
+
+
def uri_filter(uri):
"""
Removes user:password from given url string
diff --git a/kallithea/model/notification.py b/kallithea/model/notification.py
--- a/kallithea/model/notification.py
+++ b/kallithea/model/notification.py
@@ -33,6 +33,7 @@ from tg import app_globals
from tg import tmpl_context as c
from tg.i18n import ugettext as _
+from kallithea.lib.utils2 import fmt_date
from kallithea.model import db
@@ -102,7 +103,7 @@ class NotificationModel(object):
headers['References'] = ' '.join('<%s>' % x for x in email_kwargs['threading'])
# this is passed into template
- created_on = h.fmt_date(datetime.datetime.now())
+ created_on = fmt_date(datetime.datetime.now())
html_kwargs = {
'subject': subject,
'body': h.render_w_mentions(body, repo_name),