Skip to content

Commit

Permalink
coding style fix
Browse files Browse the repository at this point in the history
  • Loading branch information
SerhoLiu committed Jun 28, 2015
1 parent f3aac24 commit dcefebf
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions tools.py
Expand Up @@ -3,21 +3,23 @@

# 用于创建数据库,请按照下面的要求填写相关的信息,再运行`python create_db.py`,
# 并将生成的数据库拷贝到 blog 目录下

import os
import sys
import getopt
import sqlite3

from miniakio.libs import crypto

# 编辑下面的信息

USERNAME = "SErHo" # 用户名
EMAIL = "serholiu@gmail.com" # 邮箱,登陆的时候使用
PASSWORD = "123456" # 登陆密码
DBFILE = "example/newblog.db" # 数据库名称,请保持和 blog/config.py 中设置的名称相同
USERNAME = "SErHo" # 用户名
EMAIL = "serholiu@gmail.com" # 邮箱,登陆的时候使用
PASSWORD = "123456" # 登陆密码
DBFILE = "example/newblog.db" # 数据库名称,请保持和 blog/config.py 中设置的名称相同

# 请不要改动下面的内容

# 请不要改动下面的内容

def create_db(conn):
c = conn.cursor()
Expand Down Expand Up @@ -63,14 +65,14 @@ def get_secret():
def main(argv):
help = """
Usage: python tools -o <opt>
opt list:
createdb 创建数据库并添加用户信息(请先填写相关信息)
getsecret 随机生成一个 Cookie Secret
"""
"""
opt = ""
try:
opts, args = getopt.getopt(argv,"ho:",["opt="])
opts, args = getopt.getopt(argv, "ho:", ["opt="])
except getopt.GetoptError:
print help
sys.exit(2)
Expand All @@ -80,7 +82,7 @@ def main(argv):
sys.exit()
elif opt in ("-o", "--opt"):
opt = arg

if opt == "createdb":
conn = sqlite3.connect(DBFILE)
print "开始创建数据库..."
Expand All @@ -90,7 +92,7 @@ def main(argv):
conn.close()
print "用户创建成功,请务必将生成的数据库文件拷贝到 blogconfig 中设置的目录里!!!"
elif opt == "getsecret":
print get_secret()
print get_secret()


if __name__ == '__main__':
Expand Down

0 comments on commit dcefebf

Please sign in to comment.