소스 검색

Tweaked the recent comments list.

Michael Hope 3 년 전
부모
커밋
3c464e3427
4개의 변경된 파일10개의 추가작업 그리고 6개의 파일을 삭제
  1. 1 0
      .gitignore
  2. 2 0
      Makefile
  3. 6 5
      niche.py
  4. 1 1
      templates/layout.html

+ 1 - 0
.gitignore 파일 보기

@@ -2,3 +2,4 @@
2 2
 *.pyc
3 3
 ignore/
4 4
 sessions/
5
+version.py

+ 2 - 0
Makefile 파일 보기

@@ -0,0 +1,2 @@
1
+version.py: Makefile
2
+	echo __version__ = \'$(shell git describe --always --dirty --long)\' > $@

+ 6 - 5
niche.py 파일 보기

@@ -19,6 +19,7 @@ from passlib.apps import custom_app_context as pwd_context
19 19
 
20 20
 import strings
21 21
 import utils
22
+import version
22 23
 
23 24
 # pylint: disable=redefined-builtin
24 25
 # pylint: disable=redefined-outer-name
@@ -67,7 +68,7 @@ ALLOWED_ATTRIBUTES = {
67 68
     'img': ['src', 'alt'],
68 69
 }
69 70
 
70
-# Default configuration
71
+# Default configuration.
71 72
 DEFAULTS = [
72 73
     ( 'general', {
73 74
             'dateformat': '%B %d, %Y',
@@ -76,6 +77,7 @@ DEFAULTS = [
76 77
             'limit': 50,
77 78
             'server_type': 'dev',
78 79
             'user_fields': 'realname email homepage gravatar_email team location twitter facebook google_plus_ skype aim',
80
+            'history_days': 7,
79 81
             }),
80 82
     ( 'groups', {
81 83
             'admins': '',
@@ -128,7 +130,7 @@ def get_features(config):
128 130
 features = get_features(config)
129 131
 
130 132
 def get_version():
131
-    return subprocess.check_output('git describe --always --dirty --long'.split()).strip()
133
+    return version.__version__
132 134
 
133 135
 def get_string(id):
134 136
     """Get a string gettext style.  Splits the strings from the
@@ -376,9 +378,8 @@ class Model:
376 378
             return '%d %ss' % (value, name)
377 379
 
378 380
     def get_new(self):
379
-        # Go back two days.
380
-        since = now() - 60*60*24*3
381
-        comments = db.select('1_comments', where='timestamp >= $since', vars={'since': since}, order='timestamp ASC')
381
+        since = now() - 60*60*24*config.get('general', 'history_days')
382
+        comments = db.select('1_comments', where='timestamp >= $since', order='timestamp ASC', limit=50, vars={'since': since}, )
382 383
         # Pull out the unique links.
383 384
         ids = {}
384 385
         for comment in comments:

+ 1 - 1
templates/layout.html 파일 보기

@@ -55,7 +55,7 @@ $ active = model.get_active()
55 55
                   $ link = comment.link
56 56
                   <a href="link/$link.linkID#comment_$comment.commentID">
57 57
                     $if not link.URL: $link.title
58
-                    $else: $link.URL_description
58
+                    $else: $:link.URL_description
59 59
                   </a>
60 60
                   $if not loop.last: ..
61 61
                 </p>