Skip to content
Permalink
Browse files

various fixes; docstrings everywhere

Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Jan 13, 2015
1 parent 4422725 commit 57fa7bee4091d21c5c81c695dfe69126e181011b
Showing with 10 additions and 4 deletions.
  1. +4 −1 comet/__main__.py
  2. +4 −2 comet/init.py
  3. +2 −1 comet/web.py
@@ -64,17 +64,20 @@ def main():


def init(arguments):
u"""Run comet init."""
import comet.init
return comet.init.init()


def write_users(arguments):
u"""Write users to the DB."""
import comet.init
u = comet.utils.ask("Redis URL", "redis://")
u = comet.utils.ask("Redis URL", "redis://localhost:6379/0")
return comet.init.write_users(u)


def devserver(arguments):
u"""Run a development server."""
import comet.web
if comet.web.app:
port = int(arguments['--port'])
@@ -26,18 +26,20 @@
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

from __future__ import print_function, unicode_literals
from comet.utils import PERMISSIONS, parse_redis
from comet.utils import PERMISSIONS
import redis

__all__ = ['init', 'write_users']


def init():
"""Initialize a site."""
print("ERROR: Not implemented.")
return 255


def write_users(dburl):
"""Write users to the DB."""
data = {
'username': 'admin',
'realname': 'Website Administrator',
@@ -48,7 +50,7 @@ def write_users(dburl):
for p in PERMISSIONS:
data[p] = '1'

db = redis.StrictRedis(**parse_redis(dburl))
db = redis.StrictRedis.from_url(dburl)
db.hmset('user:1', data)
db.hset('users', 'admin', '1')
if not db.exists('last_uid'):
@@ -526,7 +526,7 @@ def index():
return render('comet_index.tmpl', context)


# TODO: delete (with redirects) as soon as `comet init` and real docs exist
# TODO: delete (with redirects) as soon as `comet init` exists
@app.route('/setup')
def setup():
"""TEMPORARY setup function."""
@@ -942,6 +942,7 @@ def acp_users_permissions():
action = 'edit'

def display_permission(user, permission):
"""Display a permission."""
checked = 'checked' if getattr(user, permission) else ''
if permission == 'wants_all_posts' and not user.can_edit_all_posts:
# If this happens, permissions are damaged.

0 comments on commit 57fa7be

Please sign in to comment.
You can’t perform that action at this time.