Permalink
Browse files

Small performance fix

  • Loading branch information...
1 parent c41f97f commit 268be01780a467b18c8e66b88b98d04f72397de4 Orf committed May 8, 2012
Showing with 4 additions and 1 deletion.
  1. +4 −1 simple.py
View
@@ -6,13 +6,16 @@
import datetime
import markdown
from werkzeug.security import check_password_hash
+import time
app = Flask(__name__)
app.config.from_object('settings')
db = SQLAlchemy(app)
_punct_re = re.compile(r'[\t !"#$%&\'()*\-/<=>?@\[\\\]^_`{|},.]+')
+markdown_parser = markdown.Markdown(extensions=['fenced_code'], output_format="html5", safe_mode=True)
+
class Post(db.Model):
__tablename__ = "posts"
id = db.Column(db.Integer, primary_key=True)
@@ -25,7 +28,7 @@ class Post(db.Model):
updated_at = db.Column(db.DateTime)
def render_content(self):
- return markdown.Markdown(extensions=['fenced_code'], output_format="html5", safe_mode=True).convert(self.text)
+ return markdown_parser.convert(self.text)
try:
db.create_all()

0 comments on commit 268be01

Please sign in to comment.