--- a/review/web_ui.py Fri Jun 11 20:54:10 2010 -0400
+++ b/review/web_ui.py Fri Jun 11 20:59:24 2010 -0400
@@ -54,79 +54,57 @@
datastore = None
site_read_only = False
-def render(template, **kwargs):
- return render_template(template,
- read_only=site_read_only, utils=utils, datastore=datastore,
- **kwargs)
+def _render(template, **kwargs):
+ return render_template(template, read_only=site_read_only, utils=utils,
+ datastore=datastore, **kwargs)
+
@app.route('/')
def index():
rev_max = datastore.target['tip'].rev()
rev_min = rev_max - LOG_PAGE_LEN if rev_max >= LOG_PAGE_LEN else 0
rcsets = [datastore[r] for r in xrange(rev_max, rev_min, -1)]
-
- return render('index.html', title='', rcsets=rcsets)
+ return _render('index.html', title='', rcsets=rcsets)
+@app.route('/changeset/<revhash>/')
+def changeset(revhash):
+ #if kwargs and not self.read_only:
+ #signoff = kwargs.get('signoff', None)
+ #if signoff:
+ #if signoff not in ['yes', 'no', 'neutral']:
+ #return 'Invalid signoff type.'
+ #if signoff == 'neutral':
+ #signoff = ''
+ #body = kwargs.get('new-signoff-body', '')
+ #rcset = self.datastore[rev_id]
+ #rcset.add_signoff(body, signoff, force=True)
+ #raise cherrypy.HTTPRedirect("/changeset/%s/" % rev_id)
+
+ #filename = kwargs.get('filename', '')
+ #lines = str(kwargs['lines']) if 'lines' in kwargs else ''
+ #if lines:
+ #lines = lines.split(',')
+ #body = kwargs['new-comment-body']
+
+ #if body:
+ #rcset = self.datastore[rev_id]
+ #rcset.add_comment(body, filename, lines)
+
+ #raise cherrypy.HTTPRedirect("/changeset/%s/" % rev_id)
+
+ rcset = datastore[revhash]
+ rev = rcset.target[revhash]
+
+ cu_signoffs = rcset.signoffs_for_current_user()
+ cu_signoff = cu_signoffs[0] if cu_signoffs else None
+
+ return _render('changeset.html',
+ title='%s:%s' % (rev.rev(), short(rev.node())),
+ rcset=rcset, rev=rev, cu_signoff=cu_signoff
+ )
#class ReviewWebUI(object):
- #def __init__(self, datastore, read_only):
- #self.datastore = datastore
- #self.read_only = read_only
- #@cherrypy.expose
- #def index(self):
- #rev_max = self.datastore.target['tip'].rev()
- #rev_min = rev_max - LOG_PAGE_LEN if rev_max >= LOG_PAGE_LEN else 0
- #rcsets = [self.datastore[r] for r in xrange(rev_max, rev_min, -1)]
-
- #return jinja_env.get_template('index.html').render(
- #read_only=self.read_only,
- #utils=utils, datastore=self.datastore, title='',
- #rcsets=rcsets,
- #)
- #@cherrypy.expose
- #def changeset(self, *args, **kwargs):
- #if len(args) != 1:
- #return 'OH GOD HOW DID THIS GET HERE I AM NOT GOOD WITH LINKS'
- #rev_id = args[0]
-
- #if kwargs and not self.read_only:
- #signoff = kwargs.get('signoff', None)
- #if signoff:
- #if signoff not in ['yes', 'no', 'neutral']:
- #return 'Invalid signoff type.'
- #if signoff == 'neutral':
- #signoff = ''
- #body = kwargs.get('new-signoff-body', '')
- #rcset = self.datastore[rev_id]
- #rcset.add_signoff(body, signoff, force=True)
- #raise cherrypy.HTTPRedirect("/changeset/%s/" % rev_id)
-
- #filename = kwargs.get('filename', '')
- #lines = str(kwargs['lines']) if 'lines' in kwargs else ''
- #if lines:
- #lines = lines.split(',')
- #body = kwargs['new-comment-body']
-
- #if body:
- #rcset = self.datastore[rev_id]
- #rcset.add_comment(body, filename, lines)
-
- #raise cherrypy.HTTPRedirect("/changeset/%s/" % rev_id)
-
- #rcset = self.datastore[rev_id]
- #rev = rcset.target[rev_id]
-
- #cu_signoffs = rcset.signoffs_for_current_user()
- #cu_signoff = cu_signoffs[0] if cu_signoffs else None
- #print cu_signoff
-
- #return jinja_env.get_template('changeset.html').render(
- #read_only=self.read_only,
- #utils=utils, datastore=self.datastore,
- #title='%s:%s' % (rev.rev(), short(rev.node())),
- #rcset=rcset, rev=rev, cu_signoff=cu_signoff
- #)
#@cherrypy.expose
#def pull(self, **kwargs):
#if not self.read_only: