def process_request(self, req): src = req.args.get('src_page','') dest = req.args.get('dest_page') if not dest: req.hdf['wikirename.src'] = src return 'wikirename.cs', 'text/html' else: rename_page(self.env, src, dest, req.authname, req.remote_addr) req.redirect(self.env.href.wiki(dest))
def process_request(self, req): src = req.args.get('src_page', '') dest = req.args.get('dest_page') if not dest: req.hdf['wikirename.src'] = src return 'wikirename.cs', 'text/html' else: rename_page(self.env, src, dest, req.authname, req.remote_addr) req.redirect(self.env.href.wiki(dest))
def main(*argv): parser = optparse.OptionParser(usage='Usage: %prog old-name new-name trac-env', version='RenamePage 2.0') parser.add_option('-d','--debug',help='Activate debugging', action='store_true', default=False) (options, args) = parser.parse_args(list(argv[1:])) if len(args) < 3: parser.error("Not enough arguments") oldname = args[0] newname = args[1] envpath = args[2] env = Environment(envpath) rename_page(env, oldname, newname, username(), '127.0.0.1', debug=options.debug)
def render_admin_panel(self, req, cat, page, path_info): data = { 'src': urllib.unquote_plus(req.args.get('src_page','')), 'dest': urllib.unquote_plus(req.args.get('dest_page','')), 'redir': req.args.get('redirect','') == '1', } if req.method == 'POST': if not data['src'] or not data['dest']: raise TracError, "Please provide both the old and new names" rename_page(self.env, data['src'], data['dest'], req.authname, req.remote_addr, debug=self.log.debug) if data['redir']: req.redirect(req.href.wiki(data['dest'])) # Reset for the next display data['src'] = '' data['dest'] = '' return 'admin_wikirename.html', data
def process_admin_request(self, req, cat, page, path_info): src = req.args.get('src_page','') dest = req.args.get('dest_page','') redir = req.args.get('redirect') if 'submit' in req.args.keys(): if not src or not dest: raise TracError, "Please provide both the old and new names" rename_page(self.env, src, dest, req.authname, req.remote_addr) if redir: req.redirect(self.env.href.wiki(dest)) # Reset for the next display src = '' dest = '' req.hdf['wikirename.src'] = src req.hdf['wikirename.dest'] = dest req.hdf['wikirename.redir'] = redir return 'wikirename_admin.cs', None
def process_admin_request(self, req, cat, page, path_info): src = req.args.get('src_page', '') dest = req.args.get('dest_page', '') redir = req.args.get('redirect') if 'submit' in req.args.keys(): if not src or not dest: raise TracError, "Please provide both the old and new names" rename_page(self.env, src, dest, req.authname, req.remote_addr) if redir: req.redirect(self.env.href.wiki(dest)) # Reset for the next display src = '' dest = '' req.hdf['wikirename.src'] = src req.hdf['wikirename.dest'] = dest req.hdf['wikirename.redir'] = redir return 'wikirename_admin.cs', None
def main(*argv): parser = optparse.OptionParser( usage='Usage: %prog old-name new-name trac-env', version='RenamePage 2.0') parser.add_option('-d', '--debug', help='Activate debugging', action='store_true', default=False) (options, args) = parser.parse_args(list(argv[1:])) if len(args) < 3: parser.error("Not enough arguments") oldname = args[0] newname = args[1] envpath = args[2] env = Environment(envpath) rename_page(env, oldname, newname, username(), '127.0.0.1', debug=options.debug)
def render_admin_panel(self, req, cat, page, path_info): data = { 'src': urllib.unquote_plus(req.args.get('src_page', '')), 'dest': urllib.unquote_plus(req.args.get('dest_page', '')), 'redir': req.args.get('redirect', '') == '1', } if req.method == 'POST': if not data['src'] or not data['dest']: raise TracError, "Please provide both the old and new names" rename_page(self.env, data['src'], data['dest'], req.authname, req.remote_addr, debug=self.log.debug) if data['redir']: req.redirect(req.href.wiki(data['dest'])) # Reset for the next display data['src'] = '' data['dest'] = '' return 'admin_wikirename.html', data
def process_admin_request(self, req, cat, page, path_info): src = req.args.get('src_page','') dest = req.args.get('dest_page','') redir = req.args.get('redirect','') == '1' # Handle escaped chars (#TH672) src = urllib.unquote_plus(src) dest = urllib.unquote_plus(dest) if 'submit' in req.args.keys(): if not src or not dest: raise TracError, "Please provide both the old and new names" rename_page(self.env, src, dest, req.authname, req.remote_addr, debug=self.log.debug) if redir: req.redirect(req.href.wiki(dest)) # Reset for the next display src = '' dest = '' req.hdf['wikirename.src'] = src req.hdf['wikirename.dest'] = dest req.hdf['wikirename.redir'] = redir return 'wikirename_admin.cs', None