[Kimchi-devel] [PATCH] pep8 cleanup for root.py

Sheldon shaohef at linux.vnet.ibm.com
Mon Dec 30 14:52:52 UTC 2013


so strangely, I can not rebase to master.

even I resolved the conflict of the root.py, I can still not "git rebase 
--continue"

$ git rebase master
First, rewinding head to replay your work on top of it...
Applying: pep8 cleanup for root.py
Using index info to reconstruct a base tree...
M Makefile.am
M src/kimchi/root.py
Falling back to patching base and 3-way merge...
Auto-merging src/kimchi/root.py
CONFLICT (content): Merge conflict in src/kimchi/root.py
Failed to merge in the changes.
Patch failed at 0001 pep8 cleanup for root.py
The copy of the patch that failed is found in:
/home/shhfeng/work/workdir/kimchi/.git/rebase-apply/patch

When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase 
--abort".


$ git diff
diff --cc src/kimchi/root.py
index 46403ab,d1fe818..0000000
--- a/src/kimchi/root.py
+++ b/src/kimchi/root.py
@@@ -58,14 -58,14 +58,22 @@@ class Root(controller.Resource)
self.plugins = controller.Plugins(model)
self.api_schema = json.load(open(get_api_schema_file()))

++<<<<<<< HEAD
+ def error_production_handler(self, status, message, traceback, version):
++=======
+ def error_production_handler(status, message, traceback, version):
++>>>>>>> pep8 cleanup for root.py
data = {'code': status, 'reason': message}
res = template.render('error.html', data)
if type(res) is unicode:
res = res.encode("utf-8")
return res

++<<<<<<< HEAD
+ def error_development_handler(self, status, message, traceback, version):
++=======
+ def error_development_handler(status, message, traceback, version):
++>>>>>>> pep8 cleanup for root.py
data = {'code': status, 'reason': message,
'call_stack': cherrypy._cperror.format_exc()}
res = template.render('error.html', data)

$ git add src/kimchi/root.py
[shhfeng at localhost kimchi]$ git diff
[shhfeng at localhost kimchi]$ git rebase --continue
Applying: pep8 cleanup for root.py
No changes - did you forget to use 'git add'?
If there is nothing left to stage, chances are that something else
already introduced the same changes; you might want to skip this patch.

When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase 
--abort".



On 12/21/2013 05:18 AM, Rodrigo Trujillo wrote:
>
> Reviewed-by: Rodrigo Trujillo <rodrigo.trujillo at linux.vnet.ibm.com>
>
> On 12/20/2013 12:36 PM, Aline Manera wrote:
>> From: Aline Manera <alinefm at br.ibm.com>
>>
>> This patch cleans up pep8 style issue in root.py
>>
>> Also move error_production_handler and error_development_handler 
>> functions
>> to Root() class as they are used only in it.
>>
>> Signed-off-by: Aline Manera <alinefm at br.ibm.com>
>> ---
>> Makefile.am | 1 +
>> src/kimchi/root.py | 49 
>> +++++++++++++++++++++++++++----------------------
>> 2 files changed, 28 insertions(+), 22 deletions(-)
>>
>> diff --git a/Makefile.am b/Makefile.am
>> index e57d3b6..622d4f0 100644
>> --- a/Makefile.am
>> +++ b/Makefile.am
>> @@ -41,6 +41,7 @@ PEP8_WHITELIST = \
>> src/kimchi/asynctask.py \
>> src/kimchi/config.py.in \
>> src/kimchi/disks.py \
>> + src/kimchi/root.py \
>> src/kimchi/server.py \
>> plugins/__init__.py \
>> plugins/sample/__init__.py \
>> diff --git a/src/kimchi/root.py b/src/kimchi/root.py
>> index c43897c..d1fe818 100644
>> --- a/src/kimchi/root.py
>> +++ b/src/kimchi/root.py
>> @@ -19,7 +19,7 @@
>> #
>> # You should have received a copy of the GNU Lesser General Public
>> # License along with this library; if not, write to the Free Software
>> -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 
>> 02110-1301 USA
>> +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 
>> 02110-1301 USA
>>
>> import cherrypy
>> import json
>> @@ -30,30 +30,19 @@ from kimchi import template
>> from kimchi.config import get_api_schema_file
>>
>>
>> -def error_production_handler(status, message, traceback, version):
>> - data = {'code': status, 'reason': message}
>> - res = template.render('error.html', data)
>> - if type(res) is unicode:
>> - res = res.encode("utf-8")
>> - return res
>> -
>> -def error_development_handler(status, message, traceback, version):
>> - data = {'code': status, 'reason': message, 'call_stack': 
>> cherrypy._cperror.format_exc()}
>> - res = template.render('error.html', data)
>> - if type(res) is unicode:
>> - res = res.encode("utf-8")
>> - return res
>> -
>> -
>> class Root(controller.Resource):
>> - _handled_error = ['error_page.400',
>> - 'error_page.404', 'error_page.405',
>> - 'error_page.406', 'error_page.415', 'error_page.500']
>> def __init__(self, model, dev_env):
>> + self._handled_error = ['error_page.400', 'error_page.404',
>> + 'error_page.405', 'error_page.406',
>> + 'error_page.415', 'error_page.500']
>> +
>> if not dev_env:
>> - self._cp_config = dict([(key, error_production_handler) for key in 
>> self._handled_error])
>> + self._cp_config = dict([(key, self.error_production_handler)
>> + for key in self._handled_error])
>> else:
>> - self._cp_config = dict([(key, error_development_handler) for key in 
>> self._handled_error])
>> + self._cp_config = dict([(key, self.error_development_handler)
>> + for key in self._handled_error])
>> +
>> controller.Resource.__init__(self, model)
>> self.vms = controller.VMs(model)
>> self.templates = controller.Templates(model)
>> @@ -69,6 +58,21 @@ class Root(controller.Resource):
>> self.plugins = controller.Plugins(model)
>> self.api_schema = json.load(open(get_api_schema_file()))
>>
>> + def error_production_handler(status, message, traceback, version):
>> + data = {'code': status, 'reason': message}
>> + res = template.render('error.html', data)
>> + if type(res) is unicode:
>> + res = res.encode("utf-8")
>> + return res
>> +
>> + def error_development_handler(status, message, traceback, version):
>> + data = {'code': status, 'reason': message,
>> + 'call_stack': cherrypy._cperror.format_exc()}
>> + res = template.render('error.html', data)
>> + if type(res) is unicode:
>> + res = res.encode("utf-8")
>> + return res
>> +
>> def get(self):
>> return self.default('kimchi-ui.html')
>>
>> @@ -77,8 +81,9 @@ class Root(controller.Resource):
>> if page.endswith('.html'):
>> return template.render(page, None)
>> raise cherrypy.HTTPError(404)
>> +
>> @cherrypy.expose
>> def tabs(self, page, **kwargs):
>> if page.endswith('.html'):
>> - return template.render('tabs/'+ page, None)
>> + return template.render('tabs/' + page, None)
>> raise cherrypy.HTTPError(404)
>
> _______________________________________________
> Kimchi-devel mailing list
> Kimchi-devel at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/kimchi-devel
>
>


-- 
Sheldon Feng(冯少合)<shaohef at linux.vnet.ibm.com>
IBM Linux Technology Center




More information about the Kimchi-devel mailing list