[Pythonmac-SIG] appscript with todos in iCal seams very slow

Marcin Komorowski marcink at ieee.org
Wed Aug 9 15:05:07 CEST 2006


Has,
Thank you.  Unfortunately, I have a list of UIDs for the todos I want  
to modify, so I think the best I can do is:
for uid in uid_list:
     todo = [ t for t in app('iCal').calendars.todos.filter( its.uid  
== uid ).get() if t != k.MissingValue ][0]
     todo.stamp_date.set( datetime.datetime.today() )

Still, the list is never long so the script runs relatively fast.  My  
largest bottleneck was getting the original list of all todos and  
their properties, and your previous suggestion made a huge difference  
in execution speed.

Thank You,
Marcin

On 8-Aug-06, at 11:50 AM, has wrote:

> On 8 Aug 2006, at 01:49, Marcin Komorowski wrote:
>
>> I guess when I get to updating individual values in selected todos
>> records, I will have to use a relatively slow request-per-update
>> method.  Is there a trick to update a field of a todo with a given
>> uid in a single request?
>
> You can set multiple properties in a single command  by assigning a
> record containing values for the properties you want to change to the
> 'properties' property, e.g.:
>
>      myevent.properties.set({k.start_time: t1, k.end_time: t2})
>
> If you have a multi-object reference, you can assign the same value
> to properties in all of those objects using a single 'set' command,
> e.g.:
>
>      mycalendar.todos.priority.set(k.high_priority)
>
>
> That's about the limit of it though, e.g. if you've got a list of
> references or want to assign different values to each then you have
> to do them individually.
>
> BTW, the next version of appscript has a number of performance
> improvements that should speed things up a bit at the Python end.
> I'll have a copy up shortly.
>
> has
> -- 
> http://freespace.virgin.net/hamish.sanderson/
>
>
> _______________________________________________
> Pythonmac-SIG maillist  -  Pythonmac-SIG at python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20060809/42f9d0a1/attachment.htm 


More information about the Pythonmac-SIG mailing list