fixed pep8 in apps
This commit is contained in:
@@ -2,10 +2,10 @@ from gluon.fileutils import read_file, write_file
|
||||
|
||||
if DEMO_MODE or MULTI_USER_MODE:
|
||||
session.flash = T('disabled in demo mode')
|
||||
redirect(URL('default','site'))
|
||||
redirect(URL('default', 'site'))
|
||||
if not have_mercurial:
|
||||
session.flash=T("Sorry, could not find mercurial installed")
|
||||
redirect(URL('default','design',args=request.args(0)))
|
||||
session.flash = T("Sorry, could not find mercurial installed")
|
||||
redirect(URL('default', 'design', args=request.args(0)))
|
||||
|
||||
_hgignore_content = """\
|
||||
syntax: glob
|
||||
@@ -22,6 +22,7 @@ sessions/*
|
||||
errors/*
|
||||
"""
|
||||
|
||||
|
||||
def hg_repo(path):
|
||||
import os
|
||||
uio = ui.ui()
|
||||
@@ -37,13 +38,14 @@ def hg_repo(path):
|
||||
write_file(hgignore, _hgignore_content)
|
||||
return repo
|
||||
|
||||
|
||||
def commit():
|
||||
app = request.args(0)
|
||||
path = apath(app, r=request)
|
||||
repo = hg_repo(path)
|
||||
form = FORM('Comment:',INPUT(_name='comment',requires=IS_NOT_EMPTY()),
|
||||
INPUT(_type='submit',_value=T('Commit')))
|
||||
if form.accepts(request.vars,session):
|
||||
form = FORM('Comment:', INPUT(_name='comment', requires=IS_NOT_EMPTY()),
|
||||
INPUT(_type='submit', _value=T('Commit')))
|
||||
if form.accepts(request.vars, session):
|
||||
oldid = repo[repo.lookup('.')]
|
||||
addremove(repo)
|
||||
repo.commit(text=form.vars.comment)
|
||||
@@ -51,32 +53,33 @@ def commit():
|
||||
response.flash = 'no changes'
|
||||
try:
|
||||
files = TABLE(*[TR(file) for file in repo[repo.lookup('.')].files()])
|
||||
changes = TABLE(TR(TH('revision'),TH('description')))
|
||||
changes = TABLE(TR(TH('revision'), TH('description')))
|
||||
for change in repo.changelog:
|
||||
ctx=repo.changectx(change)
|
||||
ctx = repo.changectx(change)
|
||||
revision, description = ctx.rev(), ctx.description()
|
||||
changes.append(TR(A(revision,_href=URL('revision',
|
||||
args=(app,revision))),
|
||||
changes.append(TR(A(revision, _href=URL('revision',
|
||||
args=(app, revision))),
|
||||
description))
|
||||
except:
|
||||
files = []
|
||||
changes = []
|
||||
return dict(form=form,files=files,changes=changes,repo=repo)
|
||||
return dict(form=form, files=files, changes=changes, repo=repo)
|
||||
|
||||
|
||||
def revision():
|
||||
app = request.args(0)
|
||||
path = apath(app, r=request)
|
||||
repo = hg_repo(path)
|
||||
revision = request.args(1)
|
||||
ctx=repo.changectx(revision)
|
||||
form=FORM(INPUT(_type='submit',_value=T('Revert')))
|
||||
ctx = repo.changectx(revision)
|
||||
form = FORM(INPUT(_type='submit', _value=T('Revert')))
|
||||
if form.accepts(request.vars):
|
||||
hg.update(repo, revision)
|
||||
session.flash = "reverted to revision %s" % ctx.rev()
|
||||
redirect(URL('default','design',args=app))
|
||||
redirect(URL('default', 'design', args=app))
|
||||
return dict(
|
||||
files=ctx.files(),
|
||||
rev=str(ctx.rev()),
|
||||
desc=ctx.description(),
|
||||
form=form
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user