[Pythonmac-SIG] Please critique my first appscript - a fix for Palm sync of iCal Tasks (for kGTD)
Marcin Komorowski
marcink at ieee.org
Fri Sep 1 06:58:56 CEST 2006
Hey Has,
Thanks for all of your suggestions. (thanks to everyone else for
their suggestions too....)
I am in the process of upgrading appscript per your post, but I have
noticed that installer 1.4.1 (which holds the individual appscript
0.16.2 installers) does not include documentation.
Specifically, I run the uninstall script, which removed /Applications/
Utilities/appscript, than run the "Appscript Installer (Python 2.3,
OS 10.4 i386).mpkg" installer and it did not re-install the removed
content. Would that be available anywhere?
Thanks,
Marcin
On 30-Aug-06, at 9:53 AM, has wrote:
> Marcin Komorowski wrote:
>
>> Please kindly critique my code - what could I have done better?
>> What would have made this code more Pythonic?
>
> Not familiar with Palm syncing or related iCal issues, but a few
> minor pointers on the appscript side, FWIW:
>
> (Note: these comments apply to the latest appscript 0.16.2 release,
> though I recommend upgrading as soon as is convenient.)
>
>
>> #!/usr/bin/env /usr/bin/pythonw
>
> 'pythonw' is no longer required by appscript; 'python' is fine.
> 'pythonw' is only needed when using the osax package to display
> dialog boxes.
>
>
>> cal_todos = appCal.calendars.filter(its.name !=
>> '').todos.properties()
>
> The filter() method will be going away in appscript 0.17.0. The new
> filter syntax is:
>
> cal_todos = appCal.calendars[its.name != ''].todos.properties()
>
> The current release supports both forms to provide users a period of
> grace in which to update their existing scripts.
>
>
>> if task[ k.class__ ] == k.todo:
>
> This test shouldn't be necessary, as the previous query should only
> return todos.
>
> Also, not sure where the k.class__ thing was coming from (presumably
> a bug in an earlier version) but it's now k.class_, which is correct.
>
>
>> k_decode = {
>> k.priority : "k.priority",
>> k.due_date : "k.due_date",
>> k.completion_date : "k.completion_date",
>> k.description : "k.description",
>> k.url : "k.url",
>> k.uid : "k.uid",
>> k.summary : "k.summary",
>> k.class__ : "k.class__"
>> }
>
> This table is unnecessary as Keyword objects can provide their own
> string representations. Just delete it and change:
>
>> myDebug( " field %s: " % k_decode[field] );
>
> to:
>
> myDebug( " field %s: " % field )
>
> HTH
>
> has
> --
> http://freespace.virgin.net/hamish.sanderson/
>
>
> _______________________________________________
> Pythonmac-SIG maillist - Pythonmac-SIG at python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig
More information about the Pythonmac-SIG
mailing list