<br><br><div class="gmail_quote">On Thu, Mar 15, 2012 at 4:26 AM, Jerry Vonau <span dir="ltr"><<a href="mailto:jvonau@shaw.ca">jvonau@shaw.ca</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Thu, 2012-03-15 at 12:07 +0530, Ajay Garg wrote:<br>
</div><div class="im">> diff --git a/extensions/cpsection/updater/model.py b/extensions/cpsection/updater/model.py<br>
> index 974c050..60195c7 100755<br>
> --- a/extensions/cpsection/updater/model.py<br>
> +++ b/extensions/cpsection/updater/model.py<br>
> @@ -413,7 +413,11 @@ class UpdateList(gtk.ListStore):<br>
> zf.getinfo('%s/activity/<a href="http://activity.info" target="_blank">activity.info</a>' % activity_base)<br>
> is_activity = True<br>
> except KeyError:<br>
> - is_activity = False<br>
> + try:<br>
> + zf.getinfo('%s/library/<a href="http://library.info" target="_blank">library.info</a>' % activity_base)<br>
> + is_activity = True<br>
> + except:<br>
> + is_activity = False<br>
> if is_activity:<br>
> cp = actutils.activity_info_from_zipfile(zf)<br>
> SECTION = 'Activity'<br>
<br>
</div>How about this:<br>
<div class="im">--- src/model.py.orig 2011-05-30 15:16:53.000000000 -0500<br>
</div>+++ src/model.py 2012-03-15 03:59:53.630674825 -0500<br>
@@ -411,16 +411,18 @@<br>
<div class="im"> activity_base = actutils.bundle_base_from_zipfile(zf)<br>
try:<br>
zf.getinfo('%s/activity/<a href="http://activity.info" target="_blank">activity.info</a>' % activity_base)<br>
- is_activity = True<br>
</div>- except KeyError:<br>
- is_activity = False<br>
- if is_activity:<br>
<div class="im HOEnZb"> cp = actutils.activity_info_from_zipfile(zf)<br>
SECTION = 'Activity'<br>
</div><div class="im HOEnZb">- else:<br>
- cp = actutils.library_info_from_zipfile(zf)<br>
- SECTION = 'Library'<br>
- act_id = None<br>
+ except KeyError:<br>
+ try:<br>
+ # grab data from <a href="http://library.info" target="_blank">library.info</a> file<br>
</div><div class="im HOEnZb">+ zf.getinfo('%s/library/<a href="http://library.info" target="_blank">library.info</a>' %<br>
activity_base)<br>
</div><div class="im HOEnZb">+ act_id = None<br>
+ cp = actutils.library_info_from_zipfile(zf)<br>
+ SECTION = 'Library'<br>
+ execpt:<br>
+ raise RuntimeError("zf not found for %s" %zf)<br>
+<br>
for fieldname in ('bundle_id', 'service_name',<br>
'global_name'):<br>
if cp.has_option(SECTION, fieldname):<br>
act_id = cp.get(SECTION, fieldname)<br>
<br>
<br>
<br>
<br>
</div><div class="HOEnZb"><div class="h5">_______________________________________________<br>
Dextrose mailing list<br>
<a href="mailto:Dextrose@lists.sugarlabs.org">Dextrose@lists.sugarlabs.org</a><br>
<a href="http://lists.sugarlabs.org/listinfo/dextrose" target="_blank">http://lists.sugarlabs.org/listinfo/dextrose</a><br>
</div></div></blockquote></div><br><div>An outsider comment:</div><div><br></div><div>Jerry's solution is more informative, although both </div><div>(Ajay and Jerry) reach the same ends it's better to have more descriptive ifs and errors. </div>
<div><br></div><div>Cheers.</div><div><br></div>