ソースを参照

md5 다시 추가

ect (or 2du) 8 年 前
コミット
bf146929ed
2 ファイル変更8 行追加4 行削除
  1. 3 3
      app.py
  2. 5 1
      views/acme/index.html

+ 3 - 3
app.py

@@ -57,10 +57,10 @@ compress = Compress()
 compress.init_app(app)
 
 # 템플릿 설정
-def regex(find, replace, data):
-    return re.sub(find, replace, data)
+def md5_replace(data):
+    return hashlib.md5(data.encode()).hexdigest()           
 
-app.jinja_env.filters['regex'] = regex
+app.jinja_env.filters['md5_replace'] = md5_replace
 
 # 셋업 부분
 curs.execute("create table if not exists data(title text, data text)")

+ 5 - 1
views/acme/index.html

@@ -80,7 +80,11 @@
                                 {% else %}
                                     <i class="fa fa-user-secret" aria-hidden="true"></i>
                                 {% endif %}
-                                사용자
+                                {% if imp[2][4] != '' %}
+                                    <img src="http://www.gravatar.com/avatar/{{imp[2][4]|md5_replace}}?s=30">
+                                {% else %}
+                                    사용자
+                                {% endif %}
                             </a>
                         </li>  
                     </ul>