|
(None)++@trellis.perform+defview_it(self):+value=getattr(self.component,self.cell_name,None)+ifNonenotin(self.component,self.cell_name,value):+print&quot;%schangedto:%s&quot;%(self.cell_name,value)</ins></span></pre></div><aid="trunkChandlerPlatformchandlertime_servicespy"></a><divclass="modfile"><h4>Modified:trunk/Chandler-Platform/chandler/time_services.py(33=>34)</h4><preclass="diff"><span><spanclass="info">---trunk/Chandler-Platform/chandler/time_services.py2008-10-1017:51:48UTC(rev33)+++trunk/Chandler-Platform/chandler/time_services.py2008-10-1022:24:21UTC(rev34)</span><spanclass="lines">@@-32,16+32,21@@</span><spanclass="cx">tz=TimeZone.default</span><spanclass="cx">returndatetime.fromtimestamp(activity.Time._now,tz)</span><spanclass="cx"></span><ins>+deftimestamp(dt):+#timegmreturnsanintnumberofseconds,whichisprobablygood+#enoughforourpurposes,butmaketestsexpectafloat,in+#casewedecidetoreplaceitwithsomethingwithalittlemore+#resolution+returnfloat(timegm(dt.astimezone(TimeZone.utc).timetuple()))+</ins><spanclass="cx">defsetNow(dt):</span><spanclass="cx">ifdtisnotNoneanddt.tzinfoisNone:</span><spanclass="cx">dt=dt.replace(tzinfo=ICUtzinfo.default)</span><spanclass="cx"></span><del>-timetuple=dt.astimezone(TimeZone.utc).timetuple()-</del><spanclass="cx">#thisignorescalendar.timegm(ortime.mktime)rangelimitsand</span><spanclass="cx">#MAXYEAR/MINYEAR,sinceanowtimestampreallyshouldn'tbeoutsidethose</span><spanclass="cx">#ranges</span><del>-new_timestamp=timegm(timetuple)</del><ins>+new_timestamp=timestamp(dt)</ins><spanclass="cx"></span><spanclass="cx">activity.Time.auto_update=False</span><spanclass="cx">activity.Time.advance(new_timestamp-activity.Time._now)</span><spanclass="lines">@@-54,7+59,6@@</span><spanclass="cx">&quot;&quot;&quot;ThenumberofsecondsbetwentheUTCepochandnow.&quot;&quot;&quot;</span><spanclass="cx">returnactivity.Time._now</span><spanclass="cx"></span><del>-</del><spanclass="cx">classTimeZone(trellis.Component,context.Service):</span><spanclass="cx"></span><spanclass="cx">default=trellis.attr(ICUtzinfo.default)</span></span></pre></div><aid="trunkHookstxt"></a><divclass="modfile"><h4>Modified:trunk/Hooks.txt(33=>34)</h4><preclass="diff"><span><spanclass="info">---trunk/Hooks.txt2008-10-1017:51:48UTC(rev33)+++trunk/Hooks.txt2008-10-1022:24:21UTC(rev34)</span><spanclass="lines">@@-11,8+11,8@@</span><spanclass="cx">Mainhooks</span><spanclass="cx">==========</span><spanclass="cx"></span><del>-BelowareChandler'smostfrequentlyusedHooks.Seetheindex_fora-completelist.</del><ins>+BelowareChandler'smostfrequentlyusedHooks.See&quot;hook&quot;inthe+index_foracompletelist.</ins><spanclass="cx"></span><spanclass="cx">..</span><spanclass="cx">Whendocumentingahook,addaSphinxindexdirective,like</span><spanclass="lines">t;&gt;&gt;item_triage.manual=99</ins><spanclass="cx">Traceback(mostrecentcalllast):</span><spanclass="cx">...</span><spanclass="cx">TriageRangeError:Can'tsettriagestatusto:99</span><spanclass="cx"></span><ins>+..index::hook;chandler.domain.triage+.._triage-hook:++Autotriage+===========++If:attr:`~Triage.manual`is``None``,:attr:`~Triage.auto`isusedto+determine:attr:`~Triage.calculated`.++The:attr:`~Triage.auto`celliscalculatedbytakingthehighest+weightedvaluefromapplyingthe:ref:`chandler.domain.triage+&lt;triage-hook-central&gt;`hook.Ifnovaluesarefound,:const:`NOW`+isused.++&gt;&gt;&gt;item_triage.manual=None+&gt;&gt;&gt;item_triage.calculated+100.0++</ins><spanclass="cx">XXXtesttriagestatusofunrecognized250,calculatedfallsbackto200</span><spanclass="cx"></span><spanclass="cx">XXXHowdoItest:</span><spanclass="cx">assumingnochandler.triage.typesentrypoints</span><spanclass="cx">addentrypointsincode</span><ins>+</ins></span></pre></div><aid="trunkChandlerAppchandlereventpy"></a><divclass="modfile"><h4>Modified:trunk/Chandler-App/chandler/event.py(33=>34)</h4><preclass="diff"><span><spanclass="info">---trunk/Chandler-App/chandler/event.py2008-10-1017:51:48UTC(rev33)+++trunk/Chandler-App/chandler/event.py2008-10-1022:24:21UTC(rev34)</span><spanclass="lines">@@-1,14+1,16@@</span><spanclass="cx">fromdatetimeimportdatetime,timedelta,time</span><spanclass="cx">importpeak.events.trellisastrellis</span><ins>+importpeak.events.activityasactivity</ins><spanclass="cx">frompeak.util.addonsimportAddOn</span><spanclass="cx"></span><spanclass="cx">fromchandler.coreimport*</span><del>-fromchandler.time_servicesimportTimeZone</del><ins>+fromchandler.time_servicesimportTimeZone,timestamp,nowTimestamp+fromchandler.triageimportTriage,NOW,LATER</ins><spanclass="cx"></span><del>-</del><spanclass="cx">one_hour=timedelta(hours=1)</span><spanclass="cx">zero_delta=timedelta(0)</span><spanclass="cx">midnight=time(0,tzinfo=TimeZone.floating)</span><ins>+EVENT_TRIAGE_WEIGHT=2.0</ins><spanclass="cx"></span><spanclass="cx">classEvent(Extension):</span><spanclass="cx">trellis.attrs(</span><spanclass="lines">@@-30,6+32,12@@</span><spanclass="cx">returndatetime.combine(self.base_start.date(),midnight)</span><spanclass="cx"></span><spanclass="cx">@trellis.compute</span><ins>+defis_started(self):+ifself.startisNone:+returnTrue+returnbool(activity.Time[timestamp(self.start)-nowTimestamp()])++@trellis.compute</ins><spanclass="cx">defduration(self):</span><spanclass="cx">ifnotself.is_day:</span><spanclass="cx">returnself.base_duration</span><spanclass="lines">@@-72,6+80,12@@</span><spanclass="cx">raiseBadDurationError(self.base_duration)</span><spanclass="cx"></span><spanclass="cx"></span><ins>+defevent_triage(item):+ifnotEvent.installed_on(item):+return(-1,None)+status=NOWifEvent(item).is_startedelseLATER+return(EVENT_TRIAGE_WEIGHT,status)+</ins><spanclass="cx">classNaiveTimezoneError(ConstraintError):</span><spanclass="cx">cell_description=&quot;base_start&quot;</span><spanclass="cx"></span><spanclass="lines">@@-113,6+127,7@@</span><spanclass="cx">returnbool(self.eventandnotself.event.implied_transparency)</span><spanclass="cx"></span><spanclass="cx"></span><del>-#impliedtransparency</del><ins>+defevent_triage_position(item):+pass</ins><spanclass="cx"></span><spanclass="cx">#is_between</span></span></pre></div><aid="trunkChandlerAppchandlertriagepy"></a><divclass="modfile"><h4>Modified:trunk/Chandler-App/chandler/triage.py(33=>34)</h4><preclass="diff"><span><spanclass="info">---trunk/Chandler-App/chandler/triage.py2008-10-1017:51:48UTC(rev33)+++trunk/Chandler-App/chandler/triage.py2008-10-1022:24:21UTC(rev34)</span><spanclass="lines">@@-1,4+1,5@@</span><spanclass="cx">importpeak.events.trellisastrellis</span><ins>+frompeak.utilimportplugins</ins><spanclass="cx">frompeak.util.addonsimportAddOn</span><spanclass="cx">fromchandler.time_servicesimportnowTimestamp</span><spanclass="cx">fromchandler.coreimportConstraintError</span><spanclass="lines">@@-9,15+10,34@@</span><spanclass="cx">LATER=200.0</span><spanclass="cx">DONE=300.0</span><spanclass="cx"></span><ins>+TRIAGE_HOOK=plugins.Hook('chandler.domain.triage')+POSITION_HOOK=plugins.Hook('chandler.interaction.triage_position')+</ins><spanclass="cx">###Domainmodel###</span><spanclass="cx"></span><spanclass="cx">classTriage(AddOn,trellis.Component):</span><spanclass="cx">trellis.attrs(</span><ins>+_item=None,</ins><spanclass="cx">manual=None,</span><del>-auto=None</del><ins>+auto_source=None</ins><spanclass="cx">)</span><spanclass="cx"></span><ins>+def__init__(self,item,**kwargs):+self._item=item+</ins><spanclass="cx">@trellis.compute</span><ins>+defauto(self):+ifself.auto_source:+pass#makeuseofauto_sourcewhenremindershavebeenfleshedout+else:+positions=list(TRIAGE_HOOK.query(self._item))+#defaulttoNOWifnothingelseapplies+positions.append((0,NOW))+max_weight,position=max(positions)+returnposition+++@trellis.compute</ins><spanclass="cx">defcalculated(self):</span><spanclass="cx">ifself.manualisnotNone:</span><spanclass="cx">returnself.manual</span></span></pre></div><aid="trunkChandlerAppsetuppy"></a><divclass="modfile"><h4>Modified:trunk/Chandler-App/setup.py(33=>34)</h4><preclass="diff"><span><spanclass="info">---trunk/Chandler-App/setup.py2008-10-1017:51:48UTC(rev33)+++trunk/Chandler-App/setup.py2008-10-1022:24:21UTC(rev34)</span><spanclass="lines">@@-11,5+11,12@@</span><spanclass="cx">install_requires=['Chandler-Platform'],</span><spanclass="cx">test_suite='test_suite',</span><spanclass="cx">packages=find_packages(),</span><del>-namespace_packages=['chandler']</del><ins>+namespace_packages=['chandler'],+entry_points=&quot;&quot;&quot;+[chandler.domain.triage]+event=chandler.event:event_triage++[chandler.interaction.triage_position]+event=chandler.event:event_triage_position+&quot;&quot;&quot;</ins><spanclass="cx">),</span></span></pre></div><aid="trunkChandlerPlatformTimeServicestxt"></a><divclass="modfile"><h4>Modified:trunk/Chandler-Platform/TimeServices.txt(33=>34)</h4><preclass="diff"><span><spanclass="info">---trunk/Chandler-Platform/TimeServices.txt2008-10-1017:51:48UTC(rev33)+++trunk/Chandler-Platform/TimeServices.txt2008-10-1022:24:21UTC(rev34)</span><spanclass="lines">@@-137,8+137,17@@</span><spanclass="cx">&gt;&gt;&gt;getNow()</span><spanclass="cx">datetime.datetime(2008,9,30,10,0,tzinfo=&lt;ICUtzinfo:US/Eastern&gt;)</span><spanclass="cx"></span><ins>+Timestamps+==========++TimestampsarefloatvaluesmeasuringsecondssincetheUTCepoch.+timemachineprovidesaconveniencefunctionforgettingtimestamps:++&gt;&gt;&gt;timestamp(oct1)+1222880400.0+</ins><spanclass="cx">There'salsoatime_services-awarefunctionforgettingacurrent</span><del>-timestamp(secondssincetheUTCepoch).</del><ins>+timestamp.</ins><spanclass="cx">mp;gt;&lt;ins&gt;+ auto_source=None
&lt;/ins&gt;&lt;span class="cx"&gt; )
&lt;/span&gt;&lt;span class="cx"&gt;
&lt;/span&gt;&lt;ins&gt;+ def __init__(self, item, **kwargs):
+ self._item = item
+
&lt;/ins&gt;&lt;span class="cx"&gt; @trellis.compute
&lt;/span&gt;&lt;ins&gt;+ def auto(self):
+ if self.auto_source:
+ pass # make use of auto_source when reminders have been fleshed out
+ else:
+ positions = list(TRIAGE_HOOK.query(self._item))
+ # default to NOW if nothing else applies
+ positions.append((0, NOW))
+ max_weight, position = max(positions)
+ return position
+
+
+ @trellis.compute
&lt;/ins&gt;&lt;span class="cx"&gt; def calculated(self):
&lt;/span&gt;&lt;span class="cx"&gt; if self.manual is not None:
&lt;/span&gt;&lt;span class="cx"&gt; return self.manual
&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;a id="trunkChandlerAppsetuppy"&gt;&lt;/a&gt;
&lt;div class="modfile"&gt;&lt;h4&gt;Modified: trunk/Chandler-App/setup.py (33 =&gt; 34)&lt;/h4&gt;
&lt;pre class="diff"&gt;&lt;span&gt;
&lt;span class="info"&gt;--- trunk/Chandler-App/setup.py 2008-10-10 17:51:48 UTC (rev 33)
+++ trunk/Chandler-App/setup.py 2008-10-10 22:24:21 UTC (rev 34)
&lt;/span&gt;&lt;span class="lines"&gt;@@ -11,5 +11,12 @@
&lt;/span&gt;&lt;span class="cx"&gt; install_requires=['Chandler-Platform'],
&lt;/span&gt;&lt;span class="cx"&gt; test_suite = 'test_suite',
&lt;/span&gt;&lt;span class="cx"&gt; packages = find_packages(),
&lt;/span&gt;&lt;del&gt;- namespace_packages = ['chandler']
&lt;/del&gt;&lt;ins&gt;+ namespace_packages = ['chandá· |
Sat, 07 Apr, 02:32 |
| Parlante |
e</span><spanclass="cx">activity.Time.advance(new_timestamp-activity.Time._now)</span><spanclass="lines">@@-54,7+59,6@@</span><spanclass="cx">&quot;&quot;&quot;Thenum200502250002.j1P02WnP008795@tutu.osafoundation.org> |
Sat, 09 Apr, 03:30 |
| Parlante |
e</span><spanclass="cx">activity.Time.advance(new_timestamp-activity.Time._now)</span><spanclass="lines">@@-54,7+59,6@@</span><spanclass="cx">&quot;&quot;&quot;Thenum200502250002.j1P02WnP008795@tutu.osafoundation.org> |
Sat, 09 Apr, 03:30 |
| Parlante |
e</span><spanclass="cx">activity.Time.advance(new_timestamp-activity.Time._now)</span><spanclass="lines">@@-54,7+59,6@@</span><spanclass="cx">&quot;&quot;&quot;Thenum200502250002.j1P02WnP008795@tutu.osafoundation.org> |
Sat, 09 Apr, 03:30 |
| Parlante |
e</span><spanclass="cx">activity.Time.advance(new_timestamp-activity.Time._now)</span><spanclass="lines">@@-54,7+59,6@@</span><spanclass="cx">&quot;&quot;&quot;Thenum200502250002.j1P02WnP008795@tutu.osafoundation.org> |
Sat, 09 Apr, 03:30 |
| Parlante |
e</span><spanclass="cx">activity.Time.advance(new_timestamp-activity.Time._now)</span><spanclass="lines">@@-54,7+59,6@@</span><spanclass="cx">&quot;&quot;&quot;Thenum200502250002.j1P02WnP008795@tutu.osafoundation.org> |
Sat, 09 Apr, 03:30 |
| b...@code-bear.com |
se</span><spanclass="cx">activity.Time.advance(new_timestamp-activity.Time._now)</span><spanclass="lines">@@-54,7+59,6@@</span><spanclass="cx">&quot;&quot;&quot;Thenum200502250002.j1P02WnP008795@tutu.osafoundation.org> |
Sat, 13 Sep, 09:29 |
| b.@osafoundation.org |
False</span><spanclass="cx">activity.Time.advance(new_timestamp-activity.Time._now)</span><spanclass="lines">@@-54,7+59,6@@</span><spanclass="cx">&quot;&quot;&quot;Thenum200502250002.j1P02WnP008795@tutu.osafoundation.org> |
Thu, 25 Apr, 03:33 |
| drewjensen.in...@gmail.com |
=False</span><spanclass="cx">activity.Time.advance(new_timestamp-activity.Time._now)</span><spanclass="lines">@@-54,7+59,6@@</span><spanclass="cx">&quot;&quot;&quot;Thenum200502250002.j1P02WnP008795@tutu.osafoundation.org> |
Sun, 27 Mar, 21:10 |
| ia |
lt;/span><spanclass="cx">returndatetime.fromtimestamp(activity.Time._now,tz)</span><spanclass="cx"></span><ins>+deftimestamp(dt):+#timegmreturnsanintnumberofseconds,whichisprobablygood+#enoughforourpurposes,butmaketestsexpectafloat,in+#casewedecidetoreplaceitwithsomethingwithalittlemore+#resolution+returnfloat(timegm(dt.astimezone(TimeZone.utc).timetuple()))+</ins><spanclass="cx">defsetNow(dt):</span><spanclass="cx">ifdtisnotNoneanddt.tzinfoisNone:</span><spanclass="cx">dt=dt.replace(tzinfo=ICUtzinfo.default)</span><spanclass="cx"></span><del>-timetuple=dt.astimezone(TimeZone.utc).timetuple()-</del><spanclass="cx">#thisignorescalendar.timegm(ortime.mktime)rangelimitsand</span><spanclass="cx">#MAXYEAR/MINYEAR,sinceanowtimestampreallyshouldn'tbeoutsidethose</span><spanclass="cx">#ranges</span><del>-new_timestamp=timegm(timetuple)</del><ins>+new_timestamp=timestamp(dt)</ins><spanclass="cx"></span><spanclass="cx">activity.Time.auto_update=False</span><spanclass="cx">activity.Time.advance(new_timestamp-activity.Time._now)</span><spanclass="lines">@@-54,7+59,6@@</span><spanclass="cx">&quot;&quot;&quot;ThenumberofsecondsbetwentheUTCepochandnow.&quot;&quot;&quot;</span><spanclass="cx">returnactivity.Time._now</span><spanclass="cx"></span><del>-</del><spanclass="cx">classTimeZone(trellis.Component,context.Service):</span><spanclass="cx"></span><spanclass="cx">default=trellis.attr(ICUtzinfo.default)</span></span></pre></div><aid="trunkHookstxt"></a><divclass="modfile"><h4>Modified:trunk/Hooks.txt(33=>34)</h4><preclass="diff"><span><spanclass="info">---trunk/Hooks.txt2008-10-1017:51:48UTC(rev33)+++trunk/Hooks.txt2008-10-1022:24:21UTC(rev34)</span><spanclass="lines">@@-11,8+11,8@@</span><spanclass="cx">Mainhooks</span><spanclass="cx">==========</span><spanclass="cx"></span><del>-BelowareChandler'smostfrequentlyusedHooks.Seetheindex_fora-completelist.</del><ins>+BelowareChandler'smostfrequentlyusedHooks.See&quot;hook&quot;inthe+index_foracompletelist.</ins><spanclass="cx"></span><spanclass="cx">..</span><spanclass="cx">Whendocumentingahook,addaSphinxindexdirective,like</span><spanclass="lines">t;&gt;&gt;item_triage.manual=99</ins><spanclass="cx">Traceback(mostrecentcalllast):</span><spanclass="cx">...</span><spanclass="cx">TriageRangeError:Can'tsettriagestatusto:99</span><spanclass="cx"></span><ins>+..index::hook;chandler.domain.triage+.._triage-hook:++Autotriage+===========++If:attr:`~Triage.manual`is``None``,:attr:`~Triage.auto`isusedto+determine:attr:`~Triage.calculated`.++The:attr:`~Triage.auto`celliscalculatedbytakingthehighest+weightedvaluefromapplyingthe:ref:`chandler.domain.triage+&lt;triage-hook-central&gt;`hook.Ifnovaluesarefound,:const:`NOW`+isused.++&gt;&gt;&gt;item_triage.manual=None+&gt;&gt;&gt;item_triage.calculated+100.0++</ins><spanclass="cx">XXXtesttriagestatusofunrecognized250,calculatedfallsbackto200</span><spanclass="cx"></span><spanclass="cx">XXXHowdoItest:</span><spanclass="cx">assumingnochandler.triage.typesentrypoints</span><spanclass="cx">addentrypointsincode</span><ins>+</ins></span></pre></div><aid="trunkChandlerAppchandlereventpy"></a><divclass="modfile"><h4>Modified:trunk/Chandler-App/chandler/event.py(33=>34)</h4><preclass="diff"><span><spanclass="info">---trunk/Chandler-App/chandler/event.py2008-10-1017:51:48UTC(rev33)+++trunk/Chandler-App/chandler/event.py2008-10-1022:24:21UTC(rev34)</span><spanclass="lines">@@-1,14+1,16@@</span><spanclass="cx">fromdatetimeimportdatetime,timedelta,time</span><spanclass="cx">importpeak.events.trellisastrellis</span><ins>+importpeak.events.activityasactivity</ins><spanclass="cx">frompeak.util.addonsimportAddOn</span><spanclass="cx"></span><spanclass="cx">fromchandler.coreimport*</span><del>-fromchandler.time_servicesimportTimeZone</del><ins>+fromchandler.time_servicesimportTimeZone,timestamp,nowTimestamp+fromchandler.triageimportTriage,NOW,LATER</ins><spanclass="cx"></span><del>-</del><spanclass="cx">one_hour=timedelta(hours=1)</span><spanclass="cx">zero_delta=timedelta(0)</span><spanclass="cx">midnight=time(0,tzinfo=TimeZone.floating)</span><ins>+EVENT_TRIAGE_WEIGHT=2.0</ins><spanclass="cx"></span><spanclass="cx">classEvent(Extension):</span><spanclass="cx">trellis.attrs(</span><spanclass="lines">@@-30,6+32,12@@</span><spanclass="cx">returndatetime.combine(self.base_start.date(),midnight)</span><spanclass="cx"></span><spanclass="cx">@trellis.compute</span><ins>+defis_started(self):+ifself.startisNone:+returnTrue+returnbool(activity.Time[timestamp(self.start)-nowTimestamp()])++@trellis.compute</ins><spanclass="cx">defduration(self):</span><spanclass="cx">ifnotself.is_day:</span><spanclass="cx">returnself.base_duration</span><spanclass="lines">@@-72,6+80,12@@</span><spanclass="cx">raiseBadDurationError(self.base_duration)</span><spanclass="cx"></span><spanclass="cx"></span><ins>+defevent_triage(item):+ifnotEvent.installed_on(item):+return(-1,None)+status=NOWifEvent(item).is_startedelseLATER+return(EVENT_TRIAGE_WEIGHT,status)+</ins><spanclass="cx">classNaiveTimezoneError(ConstraintError):</span><spanclass="cx">cell_description=&quot;base_start&quot;</span><spanclass="cx"></span><spanclass="lines">@@-113,6+127,7@@</span><spanclass="cx">returnbool(self.eventandnotself.event.implied_transparency)</span><spanclass="cx"></span><spanclass="cx"></span><del>-#impliedtransparency</del><ins>+defevent_triage_position(item):+pass</ins><spanclass="cx"></span><spanclass="cx">#is_between</span></span></pre></div><aid="trunkChandlerAppchandlertriagepy"></a><divclass="modfile"><h4>Modified:trunk/Chandler-App/chandler/triage.py(33=>34)</h4><preclass="diff"><span><spanclass="info">---trunk/Chandler-App/chandler/triage.py2008-10-1017:51:48UTC(rev33)+++trunk/Chandler-App/chandler/triage.py2008-10-1022:24:21UTC(rev34)</span><spanclass="lines">@@-1,4+1,5@@</span><spanclass="cx">importpeak.events.trellisastrellis</span><ins>+frompeak.utilimportplugins</ins><spanclass="cx">frompeak.util.addonsimportAddOn</span><spanclass="cx">fromchandler.time_servicesimportnowTimestamp</span><spanclass="cx">fromchandler.coreimportConstraintError</span><spanclass="lines">@@-9,15+10,34@@</span><spanclass="cx">LATER=200.0</span><spanclass="cx">DONE=300.0</span><spanclass="cx"></span><ins>+TRIAGE_HOOK=plugins.Hook('chandler.domain.triage')+POSITION_HOOK=plugins.Hook('chandler.interaction.triage_position')+</ins><spanclass="cx">###Domainmodel###</span><spanclass="cx"></span><spanclass="cx">classTriage(AddOn,trellis.Component):</span><spanclass="cx">trellis.attrs(</span><ins>+_item=None,</ins><spanclass="cx">manual=None,</span><del>-auto=None</del><ins>+auto_source=None</ins><spanclass="cx">)</span><spanclass="cx"></span><ins>+def__init__(self,item,**kwargs):+self._item=item+</ins><spanclass="cx">@trellis.compute</span><ins>+defauto(self):+ifself.auto_source:+pass#makeuseofauto_sourcewhenremindershavebeenfleshedout+else:+positions=list(TRIAGE_HOOK.query(self._item))+#defaulttoNOWifnothingelseapplies+positions.append((0,NOW))+max_weight,position=max(positions)+returnposition+++@trellis.compute</ins><spanclass="cx">defcalculated(self):</span><spanclass="cx">ifself.manualisnotNone:</span><spanclass="cx">returnself.manual</span></span></pre></div><aid="trunkChandlerAppsetuppy"></a><divclass="modfile"><h4>Modified:trunk/Chandler-App/setup.py(33=>34)</h4><preclass="diff"><span><spanclass="info">---trunk/Chandler-App/setup.py2008-10-1017:51:48UTC(rev33)+++trunk/Chandler-App/setup.py2008-10-1022:24:21UTC(rev34)</span><spanclass="lines">@@-11,5+11,12@@</span><spanclass="cx">install_requires=['Chandler-Platform'],</span><spanclass="cx">test_suite='test_suite',</span><spanclass="cx">packages=find_packages(),</span><del>-namespace_packages=['chandler']</del><ins>+namespace_packages=['chandler'],+entry_points=&quot;&quot;&quot;+[chandler.domain.triage]+event=chandler.event:event_triage++[chandler.interaction.triage_position]+event=chandler.event:event_triage_position+&quot;&quot;&quot;</ins><spanclass="cx">),</span></span></pre><s.compute</span><ins>+defauto( |
Mon, 26 May, 09:29 |
| isse |
t;/span><spanclass="cx">#MAXYEAR/MINYEAR,sinceanowtimestampreallyshouldn'tbeoutsidethose</span><spanclass="cx">#ranges</span><del>-new_timestamp=timegm(timetuple)</del><ins>+new_timestamp=timestamp(dt)</ins><spanclass="cx"></span><spanclass="cx">activity.Time.auto_update=False</span><spanclass="cx">activity.Time.advance(new_timestamp-activity.Time._now)</span><spanclass="lines">@@-54,7+59,6@@</span><spanclass="cx">&quot;&quot;&quot;ThenumberofsecondsbetwentheUTCepochandnow.&quot;&quot;&quot;</span><spanclass="cx">returnactivity.Time._now</span><spanclass="cx"></span><del>-</del><spanclass="cx">classTimeZone(trellis.Component,context.Service):</span><spanclass="cx"></span><spanclass="cx">default=trellis.attr(ICUtzinfo.default)</span></span></pre></div><aid="trunkHookstxt"></a><divclass="modfile"><h4>Modified:trunk/Hooks.txt(33=>34)</h4><preclass="diff"><span><spanclass="info">---trunk/Hooks.txt2008-10-1017:51:48UTC(rev33)+++trunk/Hooks.txt2008-10-1022:24:21UTC(rev34)</span><spanclass="lines">@@-11,8+11,8@@</span><spanclass="cx">Mainhooks</span><spanclass="cx">==========</span><spanclass="cx"></span><del>-BelowareChandler'smostfrequentlyusedHooks.Seetheindex_fora-completelist.</del><ins>+BelowareChandler'smostfrequentlyusedHooks.See&quot;hook&quot;inthe+index_foracompletelist.</ins><spanclass="cx"></span><spanclass="cx">..</span><spanclass="cx">Whendocumentingahook,addaSphinxindexdirective,like</span><spanclass="lines">t;&gt;&gt;item_triage.manual=99</ins><spanclass="cx">Traceback(mostrecentcalllast):</span><spanclass="cx">...</span><spanclass="cx">TriageRangeError:Can'tsettriagestatusto:99</span><spanclass="cx"></span><ins>+..index::hook;chandler.domain.triage+.._triage-hook:++Autotriage+===========++If:attr:`~Triage.manual`is``None``,:attr:`~Triage.auto`isusedto+determine:attr:`~Triage.calculated`.++The:attr:`~Triage.auto`celliscalculatedbytakingthehighest+weightedvaluefromapplyingthe:ref:`chandler.domain.triage+&lt;triage-hook-central&gt;`hook.Ifnovaluesarefound,:const:`NOW`+isused.++&gt;&gt;&gt;item_triage.manual=None+&gt;&gt;&gt;item_triage.calculated+100.0++</ins><spanclass="cx">XXXtesttriagestatusofunrecognized250,calculatedfallsbackto200</span><spanclass="cx"></span><spanclass="cx">XXXHowdoItest:</span><spanclass="cx">assumingnochandler.triage.typesentrypoints</span><spanclass="cx">addentrypointsincode</span><ins>+</ins></span></pre></div><aid="trunkChandlerAppchandlereventpy"></a><divclass="modfile"><h4>Modified:trunk/Chandler-App/chandler/event.py(33=>34)</h4><preclass="diff"><span><spanclass="info">---trunk/Chandler-App/chandler/event.py2008-10-1017:51:48UTC(rev33)+++trunk/Chandler-App/chandler/event.py2008-10-1022:24:21UTC(rev34)</span><spanclass="lines">@@-1,14+1,16@@</span><spanclass="cx">fromdatetimeimportdatetime,timedelta,time</span><spanclass="cx">importpeak.events.trellisastrellis</span><ins>+importpeak.events.activityasactivity</ins><spanclass="cx">frompeak.util.addonsimportAddOn</span><spanclass="cx"></span><spanclass="cx">fromchandler.coreimport*</span><del>-fromchandler.time_servicesimportTimeZone</del><ins>+fromchandler.time_servicesimportTimeZone,timestamp,nowTimestamp+fromchandler.triageimportTriage,NOW,LATER</ins><spanclass="cx"></span><del>-</del><spanclass="cx">one_hour=timedelta(hours=1)</span><spanclass="cx">zero_delta=timedelta(0)</span><spanclass="cx">midnight=time(0,tzinfo=TimeZone.floating)</span><ins>+EVENT_TRIAGE_WEIGHT=2.0</ins><spanclass="cx"></span><spanclass="cx">classEvent(Extension):</span><spanclass="cx">trellis.attrs(</span><spanclass="lines">@@-30,6+32,12@@</span><spanclass="cx">returndatetime.combine(self.base_start.date(),midnight)</span><spanclass="cx"></span><spanclass="cx">@trellis.compute</span><ins>+defis_started(self):+ifself.startisNone:+returnTrue+returnbool(activity.Time[timestamp(self.start)-nowTimestamp()])++@trellis.compute</ins><spanclass="cx">defduration(self):</span><spanclass="cx">ifnotself.is_day:</span><spanclass="cx">returnself.base_duration</span><spanclass="lines">@@-72,6+80,12@@</span><spanclass="cx">raiseBadDurationError(self.base_duration)</span><spanclass="cx"></span><spanclass="cx"></span><ins>+defevent_triage(item):+ifnotEvent.installed_on(item):+return(-1,None)+status=NOWifEvent(item).is_startedelseLATER+return(EVENT_TRIAGE_WEIGHT,status)+</ins><spanclass="cx">classNaiveTimezoneError(ConstraintError):</span><spanclass="cx">cell_description=&quot;base_start&quot;</span><spanclass="cx"></span><spanclass="lines">@@-113,6+127,7@@</span><spanclass="cx">returnbool(self.eventandnotself.event.implied_transparency)</span><spanclass="cx"></span><spanclass="cx"></span><del>-#impliedtransparency</del><ins>+defevent_triage_position(item):+pass</ins><spanclass="cx"></span><spanclass="cx">#is_between</span></span></pre></div><aid="trunkChandlerAppchandlertriagepy"></a><divclass="modfile"><h4>Modified:trunk/Chandler-App/chandler/triage.py(33=>34)</h4><preclass="diff"><span><spanclass="info">---trunk/Chandler-App/chandler/triage.py2008-10-1017:51:48UTC(rev33)+++trunk/Chandler-App/chandler/triage.py2008-10-1022:24:21UTC(rev34)</span><spanclass="lines">@@-1,4+1,5@@</span><spanclass="cx">importpeak.events.trellisastrellis</span><ins>+frompeak.utilimportplugins</ins><spanclass="cx">frompeak.util.addonsimportAddOn</span><spanclass="cx">fromchandler.time_servicesimportnowTimestamp</span><spanclass="cx">fromchandler.coreimportConstraintError</span><spanclass="lines">@@-9,15+10,34@@</span><spanclass="cx">LATER=200.0</span><spanclass="cx">DONE=300.0</span><spanclass="cx"></span><ins>+TRIAGE_HOOK=plugins.Hook('chandler.domain.triage')+POSITION_HOOK=plugins.Hook('chandler.interaction.triage_position')+</ins><spanclass="cx">###Domainmodel###</span><spanclass="cx"></span><spanclass="cx">classTriage(AddOn,trellis.Component):</span><spanclass="cx">trellis.attrs(</span><ins>+_item=None,</ins><spanclass="cx">manual=None,</span><del>-auto=None</del><ins>+auto_source=None</ins><spanclass="cx">)</span><spanclass="cx"></span><ins>+def__init__(self,item,**kwargs):+self._item=item+</ins><spanclass="cx">@trellis.compute</span><ins>+defauto(self):+ifself.auto_source:+pass#makeuseofauto_sourcewhenremindershavebeenfleshedout+else:+positions=list(TRIAGE_HOOK.query(self._item))+#defaulttoNOWifnothingelseapplies+positions.append((0,NOW))+max_weight,position=max(positions)+returnposition+++@trellis.compute</ins><spanclass="cx">defcalculated(self):</span><spanclass="cx">ifself.manualisnotNone:</span><spanclass="cx">returnself.manual</span></span></pre></div><aid="trunkChandlerAppsetuppy"></a><divclass="modfile"><h4>Modified:trunk/Chandler-App/setup.py(33=>34)</h4><preclass="diff"><span><spanclass="info">---trunk/Chandler-App/setup.py2008-10-1017:51:48UTC(rev33)+++trunk/Chandler-App/setup.py2008-10-1022:24:21UTC(rev34)</span><spanclass="lines">@@-11,5+11,12@@</span><spanclass="cx">install_requires=['Chandler-Platform'],</span><spanclass="cx">test_suite='test_suite',</span><spanclass="cx">packages=find_packages(),</span><del>-namespace_packages=['chandler']</del><ins>+namespace_packages=['chandler'],+entry_points=&quot;&quot;&quot;+[chandler.domain.triage]+event=chandler.event:event_triage++[chandler.interaction.triage_position]+event=chandler.event:event_triage_position+&quot;&quot;&quot;</ins><spanclass="cx">),</span></span></pre></div><aid="trunkChandlerPlatformTimeServicestxt"></a><divclass="modfile"><h4>Modified:trunk/Chandler-Platform/TimeServices.txt(33=>34)</h4><preclass="diff"><span><spanclass="info">---trunk/Chandler-Platform/TimeServices.txt2008-10-1017:51:48UTC(rev33)+++trunk/Chandler-Platform/TimeServices.txt2008-10-1022:24:21UTC(rev34)</span><spanclass="lines">@@-137,8+137,17@@</span><spanclass="cx">&gt;&gt;&gt;getNow()</span><spanclass="cx">datetime.datetime(2008,9,30,10,0,tzinfo=&lt;ICUtzinfo:US/Eastern&gt;)</span><spanclass="cx"></span><ins>+Timestamps+==========++TimestampsarefloatvaluesmeasuringsecondssincetheUTCepoch.+timemachineprovidesaconveniencefunctionforgettingtimestamps:++&gt;&gt;&gt;timestamp(oct1)+1222880400.0+</ins><spanclass="cx">There'salsoatime_services-awarefunctionforgettingacurrent</span><del>-timestamp(secondssincetheUTCepoch).</del><ins>+timestamp.</ins><spanclass="cx">mp;gt;&lt;ins&gt;+ auto_source=None
&lt;/ins&gt;&lt;span class="cx"&gt; )
&lt;/span&gt;&lt;span class="cx"&gt;
&lt;/span&gt;&lt;ins&gt;+ def __init__(self, item, **kwargs):
+ self._item = item
+
&lt;/ins&gt;&lt;span class="cx"&gt; @trellis.compute
&lt;/span&gt;&lt;ins&gt;+ def auto(self):
+ if self.auto_source:
+ pass # make use of auto_source when reminders have been fleshed out
+ else:
+ positions = list(TRIAGE_HOOK.query(self._item))
+ # default to NOW if nothing else applies
+ positions.append((0, NOW))
+ max_weight, position = max(positions)
+ return position
+
+
+ @trellis.compute
&lt;/ins&gt;&lt;span class="cx"&gt; def calculated(self):
&lt;/span&gt;&lt;span class="cx"&gt; if self.manual is not None:
&lt;/span&gt;&lt;span class="cx"&gt; return self.manual
&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;a id="trunkChandlerAppsetuppy"&gt;&lt;/a&gt;
&lt;div class="modfile"&gt;&lt;h4&gt;Modified: trunk/Chandler-App/setup.py (33 =&gt; 34)&lt;/h4&gt;
&lt;pre class="diff"&gt;&lt;span&gt;
&lt;span class="info"&gt;--- trunk/Chandler-App/setup.py 2008-10-10 17:51:48 UTC (rev 33)
+++ trunk/Chandler-App/setup.py 2008-10-10 22:24:21 UTC (rev 34)
&lt;/span&gt;&lt;span class="lines"&gt;@@ -11,5 +11,12 @@
&lt;/span&gt;&lt;span class="cx"&gt; install_requires=['Chandler-Platform'],
&lt;/span&gt;&lt;span class="cx"&gt; test_suite = 'test_suite',
&lt;/span&gt;&lt;span class="cx"&gt; packages = find_packages(),
&lt;/span&gt;&lt;del&gt;- namespace_packages = ['chandler']
&lt;/del&gt;&lt;ins&gt;+ namespace_packages = ['chandá· |
Sun, 13 Nov, 20:15 |
| ja...@wordzoo.com |
to_update=False</span><spanclass="cx">activity.Time.advance(new_timestamp-activity.Time._now)</span><spanclass="lines">@@-54,7+59,6@@</span><spanclass="cx">&quot;&quot;&quot;Thenum200502250002.j1P02WnP008795@tutu.osafoundation.org> |
Thu, 24 Apr, 14:24 |
| ja...@wordzoo.com |
to_update=False</span><spanclass="cx">activity.Time.advance(new_timestamp-activity.Time._now)</span><spanclass="lines">@@-54,7+59,6@@</span><spanclass="cx">&quot;&quot;&quot;Thenum200502250002.j1P02WnP008795@tutu.osafoundation.org> |
Thu, 24 Apr, 14:24 |
| ja...@wordzoo.com |
to_update=False</span><spanclass="cx">activity.Time.advance(new_timestamp-activity.Time._now)</span><spanclass="lines">@@-54,7+59,6@@</span><spanclass="cx">&quot;&quot;&quot;Thenum200502250002.j1P02WnP008795@tutu.osafoundation.org> |
Thu, 24 Apr, 14:24 |
| ja...@wordzoo.com |
to_update=False</span><spanclass="cx">activity.Time.advance(new_timestamp-activity.Time._now)</span><spanclass="lines">@@-54,7+59,6@@</span><spanclass="cx">&quot;&quot;&quot;Thenum200502250002.j1P02WnP008795@tutu.osafoundation.org> |
Thu, 24 Apr, 14:24 |
| ja...@wordzoo.com |
to_update=False</span><spanclass="cx">activity.Time.advance(new_timestamp-activity.Time._now)</span><spanclass="lines">@@-54,7+59,6@@</span><spanclass="cx">&quot;&quot;&quot;Thenum200502250002.j1P02WnP008795@tutu.osafoundation.org> |
Thu, 24 Apr, 14:24 |
| ja...@wordzoo.com |
to_update=False</span><spanclass="cx">activity.Time.advance(new_timestamp-activity.Time._now)</span><spanclass="lines">@@-54,7+59,6@@</span><spanclass="cx">&quot;&quot;&quot;Thenum200502250002.j1P02WnP008795@tutu.osafoundation.org> |
Thu, 24 Apr, 14:24 |
| ja...@wordzoo.com |
to_update=False</span><spanclass="cx">activity.Time.advance(new_timestamp-activity.Time._now)</span><spanclass="lines">@@-54,7+59,6@@</span><spanclass="cx">&quot;&quot;&quot;Thenum200502250002.j1P02WnP008795@tutu.osafoundation.org> |
Thu, 24 Apr, 14:24 |
| ja...@wordzoo.com |
to_update=False</span><spanclass="cx">activity.Time.advance(new_timestamp-activity.Time._now)</span><spanclass="lines">@@-54,7+59,6@@</span><spanclass="cx">&quot;&quot;&quot;Thenum200502250002.j1P02WnP008795@tutu.osafoundation.org> |
Thu, 24 Apr, 14:24 |
| ja...@wordzoo.com |
to_update=False</span><spanclass="cx">activity.Time.advance(new_timestamp-activity.Time._now)</span><spanclass="lines">@@-54,7+59,6@@</span><spanclass="cx">&quot;&quot;&quot;Thenum200502250002.j1P02WnP008795@tutu.osafoundation.org> |
Thu, 24 Apr, 14:24 |
| ja...@wordzoo.com |
to_update=False</span><spanclass="cx">activity.Time.advance(new_timestamp-activity.Time._now)</span><spanclass="lines">@@-54,7+59,6@@</span><spanclass="cx">&quot;&quot;&quot;Thenum200502250002.j1P02WnP008795@tutu.osafoundation.org> |
Thu, 24 Apr, 14:24 |
| ja...@wordzoo.com |
to_update=False</span><spanclass="cx">activity.Time.advance(new_timestamp-activity.Time._now)</span><spanclass="lines">@@-54,7+59,6@@</span><spanclass="cx">&quot;&quot;&quot;Thenum200502250002.j1P02WnP008795@tutu.osafoundation.org> |
Thu, 24 Apr, 14:24 |
| m.@osafoundation.org> |
nkChandlerPlatformchandlertime_servicespy"></a><divclass="modfile"><h4>Modified:trunk/Chandler-Platform/chandler/time_services.py(33=>34)</h4><preclass="diff"><span><spanclass="info">---trunk/Chandler-Platform/chandler/time_services.py2008-10-1017:51:48UTC(rev33)+++trunk/Chandler-Platform/chandler/time_services.py2008-10-1022:24:21UTC(rev34)</span><spanclass="lines">@@-32,16+32,21@@</span><spanclass="cx">tz=TimeZone.default</span><spanclass="cx">returndatetime.fromtimestamp(activity.Time._now,tz)</span><spanclass="cx"></span><ins>+deftimestamp(dt):+#timegmreturnsanintnumberofseconds,whichisprobablygood+#enoughforourpurposes,butmaketestsexpectafloat,in+#casewedecidetoreplaceitwithsomethingwithalittlemore+#resolution+returnfloat(timegm(dt.astimezone(TimeZone.utc).timetuple()))+</ins><spanclass="cx">defsetNow(dt):</span><spanclass="cx">ifdtisnotNoneanddt.tzinfoisNone:</span><spanclass="cx">dt=dt.replace(tzinfo=ICUtzinfo.default)</span><spanclass="cx"></span><del>-timetuple=dt.astimezone(TimeZone.utc).timetuple()-</del><spanclass="cx">#thisignorescalendar.timegm(ortime.mktime)rangelimitsand</span><spanclass="cx">#MAXYEAR/MINYEAR,sinceanowtimestampreallyshouldn'tbeoutsidethose</span><spanclass="cx">#ranges</span><del>-new_timestamp=timegm(timetuple)</del><ins>+new_timestamp=timestamp(dt)</ins><spanclass="cx"></span><spanclass="cx">activity.Time.auto_update=False</span><spanclass="cx">activity.Time.advance(new_timestamp-activity.Time._now)</span><spanclass="lines">@@-54,7+59,6@@</span><spanclass="cx">&quot;&quot;&quot;ThenumberofsecondsbetwentheUTCepochandnow.&quot;&quot;&quot;</span><spanclass="cx">returnactivity.Time._now</span><spanclass="cx"></span><del>-</del><spanclass="cx">classTimeZone(trellis.Component,context.Service):</span><spanclass="cx"></span><spanclass="cx">default=trellis.attr(ICUtzinfo.default)</span></span></pre></div><aid="trunkHookstxt"></a><divclass="modfile"><h4>Modified:trunk/Hooks.txt(33=>34)</h4><preclass="diff"><span><spanclass="info">---trunk/Hooks.txt2008-10-1017:51:48UTC(rev33)+++trunk/Hooks.txt2008-10-1022:24:21UTC(rev34)</span><spanclass="lines">@@-11,8+11,8@@</span><spanclass="cx">Mainhooks</span><spanclass="cx">==========</span><spanclass="cx"></span><del>-BelowareChandler'smostfrequentlyusedHooks.Seetheindex_fora-completelist.</del><ins>+BelowareChandler'smostfrequentlyusedHooks.See&quot;hook&quot;inthe+index_foracompletelist.</ins><spanclass="cx"></span><spanclass="cx">..</span><spanclass="cx">Whendocumentingahook,addaSphinxindexdirective,like</span><spanclass="lines">t;&gt;&gt;item_triage.manual=99</ins><spanclass="cx">Traceback(mostrecentcalllast):</span><spanclass="cx">...</span><spanclass="cx">TriageRangeError:Can'tsettriagestatusto:99</span><spanclass="cx"></span><ins>+..index::hook;chandler.domain.triage+.._triage-hook:++Autotriage+===========++If:attr:`~Triage.manual`is``None``,:attr:`~Triage.auto`isusedto+determine:attr:`~Triage.calculated`.++The:attr:`~Triage.auto`celliscalculatedbytakingthehighest+weightedvaluefromapplyingthe:ref:`chandler.domain.triage+&lt;triage-hook-central&gt;`hook.Ifnovaluesarefound,:const:`NOW`+isused.++&gt;&gt;&gt;item_triage.manual=None+&gt;&gt;&gt;item_triage.calculated+100.0++</ins><spanclass="cx">XXXtesttriagestatusofunrecognized250,calculatedfallsbackto200</span><spanclass="cx"></span><spanclass="cx">XXXHowdoItest:</span><spanclass="cx">assumingnochandler.triage.typesentrypoints</span><spanclass="cx">addentrypointsincode</span><ins>+</ins></span></pre></div><aid="trunkChandlerAppchandlereventpy"></a><divclass="modfile"><h4>Modified:trunk/Chandler-App/chandler/event.py(33=>34)</h4><preclass="diff"><span><spanclass="info">---trunk/Chandler-App/chandler/event.py2008-10-1017:51:48UTC(rev33)+++trunk/Chandler-App/chandler/event.py2008-10-1022:24:21UTC(rev34)</span><spanclass="lines">@@-1,14+1,16@@</span><spanclass="cx">fromdatetimeimportdatetime,timedelta,time</span><spanclass="cx">importpeak.events.trellisastrellis</span><ins>+importpeak.events.activityasactivity</ins><spanclass="cx">frompeak.util.addonsimportAddOn</span><spanclass="cx"></span><spanclass="cx">fromchandler.coreimport*</span><del>-fromchandler.time_servicesimportTimeZone</del><ins>+fromchandler.time_servicesimportTimeZone,timestamp,nowTimestamp+fromchandler.triageimportTriage,NOW,LATER</ins><spanclass="cx"></span><del>-</del><spanclass="cx">one_hour=timedelta(hours=1)</span><spanclass="cx">zero_delta=timedelta(0)</span><spanclass="cx">midnight=time(0,tzinfo=TimeZone.floating)</span><ins>+EVENT_TRIAGE_WEIGHT=2.0</ins><spanclass="cx"></span><spanclass="cx">classEvent(Extension):</span><spanclass="cx">trellis.attrs(</span><spanclass="lines">@@-30,6+32,12@@</span><spanclass="cx">returndatetime.combine(self.base_start.date(),midnight)</span><spanclass="cx"></span><spanclass="cx">@trellis.compute</span><ins>+defis_started(self):+ifself.startisNone:+returnTrue+returnbool(activity.Time[timestamp(self.start)-nowTimestamp()])++@trellis.compute</ins><spanclass="cx">defduration(self):</span><spanclass="cx">ifnotself.is_day:</span><spanclass="cx">returnself.base_duration</span><spanclass="lines">@@-72,6+80,12@@</span><spanclass="cx">raiseBadDurationError(self.base_duration)</span><spanclass="cx"></span><spanclass="cx"></span><ins>+defevent_triage(item):+ifnotEvent.installed_on(item):+return(-1,None)+status=NOWifEvent(item).is_startedelseLATER+return(EVENT_TRIAGE_WEIGHT,status)+</ins><spanclass="cx">classNaiveTimezoneError(ConstraintError):</span><spanclass="cx">cell_description=&quot;base_start&quot;</span><spanclass="cx"></span><spanclass="lines">@@-113,6+127,7@@</span><spanclass="cx">returnbool(self.eventandnotself.event.implied_transparency)</span><spanclass="cx"></span><spanclass="cx"></span><del>-#impliedtransparency</del><ins>+defevent_triage_position(item):+pass</ins><spanclass="cx"></span><spanclass="cx">#is_between</span></span></pre></div><aid="trunkChandlerAppchandlertriagepy"></a><divclass="modfile"><h4>Modified:trunk/Chandler-App/chandler/triage.py(33=>34)</h4><preclass="diff"><span><spanclass="info">---trunk/Chandler-App/chandler/triage.py2008-10-1017:51:48UTC(rev33)+++trunk/Chandler-App/chandler/triage.py2008-10-1022:24:21UTC(rev34)</span><spanclass="lines">@@-1,4+1,5@@</span><spanclass="cx">importpeak.events.trellisastrellis</span><ins>+frompeak.utilimportplugins</ins><spanclass="cx">frompeak.util.addonsimportAddOn</span><spanclass="cx">fromchandler.time_servicesimportnowTimestamp</span><spanclass="cx">fromchandler.coreimportConstraintError</span><spanclass="lines">@@-9,15+10,34@@</span><spanclass="cx">LATER=200.0</span><spanclass="cx">DONE=300.0</span><spanclass="cx"></span><ins>+TRIAGE_HOOK=plugins.Hook('chandler.domain.triage')+POSITION_HOOK=plugins.Hook('chandler.interaction.triage_position')+</ins><spanclass="cx">###Domainmodel###</span><spanclass="cx"></span><spanclass="cx">classTriage(AddOn,trellis.Component):</span><spanclass="cx">trellis.attrs(</span><ins>+_item=None,</ins><spanclass="cx">manual=None,</span><del>-auto=None</del><ins>+auto_source=None</ins><spanclass="cx">)</span><spanclass="cx"></span><ins>+def__init__(self,item,**kwargs):+self._item=item+</ins><spanclass="cx">@trellis.compute</span><ins>+defauto(self):+ifself.auto_source:+pass#makeuseofauto_sourcewhenremindershavebeenfleshedout+else:+positions=list(TRIAGE_HOOK.query(self._item))+#defaulttoNOWifnothingelseapplies+positions.append((0,NOW))+max_weight,position=max(positions)+returnposition+++@trellis.compute</ins><spanclass="cx">defcalculated(self):</span><spanclass="cx">ifself.manualisnotNone:</span><spanclass="cx">returnself.manual</span></span></pre></div><aid="trunkChandlerAppsetuppy"></a><divclass="modfile"><h4>Modified:trunk/Chandler-App/setup.py(33=>34)</h4><preclass="diff"><span><spanclass="info">---trunk/Chandler-App/setup.py2008-10-1017:51:48UTC(rev33)+++trunk/Chandler-App/setup.py2008-10-1022:24:21UTC(rev34)</span><spanclass="lines">@@-11,5+11,12@@</span><spanclass="cx">install_requires=['Chandler-Platform'],</span><spanclass="cx">test_suite='test_suite',</span><spanclass="cx">packages=find_packages(),</span><del>-namespace_packages=['chandler']</del><ins>+namespace_packages=['chandler'],+entry_points=&quot;&quot;&quot;+[chandler.domain.triage]+event=chandler.event:event_triage++[chandler.interaction.triage_position]+event=chandler.event:event_triage_position+&quot;&quot;&quot;</ins><spanclass="cx">),</span></span></pre></div><aid="trunkChandlerPlatformTimeServicestxt"></a><divclass="modfile"><h4>Modified:trunk/Chandler-Platform/TimeServices.txt(33=>34)</h4><preclass="diff"><span><spanclass="info">---trunk/Chandler-Platform/TimeServices.txt2008-10-1017:51:48UTC(rev33)+++trunk/Chandler-Platform/TimeServices.txt2008-10-1022:24:21UTC(rev34)</span><spanclass="lines">@@-137,8+137,17@@</span><spanclass="cx">&gt;&gt;&gt;getNow()</span><spanclass="cx">datetime.datetime(2008,9,30,10,0,tzinfo=&lt;ICUtzinfo:US/Eastern&gt;)</span><spanclass="cx"></span><ins>+Timestamps+==========++TimestampsarefloatvaluesmeasuringsecondssincetheUTCepoch.+timemachineprovidesaconveniencefunctionforgettingtimestamps:++&gt;&gt;&gt;timestamp(oct1)+1222880400.0+</ins><spanclass="cx">There'salsoatime_services-awarefunctionforgettingacurrent</span><del>-timestamp(secondssincetheUTCepoch).</del><ins>+timestamp.</ins><spanclass="cx">mp;gt;&lt;ins&gt;+ auto_source=None
&lt;/ins&gt;&lt;span class="cx"&gt; )
&lt;/span&gt;&lt;span class="cx"&gt;
&lt;/span&gt;&lt;ins&gt;+ def __init__(self, item, **kwargs):
+ self._item = item
+
&lt;/ins&gt;&lt;span class="cx"&gt; @trellis.compute
&lt;/span&gt;&lt;ins&gt;+ def auto(self):
+ if self.auto_source:
+ pass # make use of auto_source when reminders have been fleshed out
+ else:
+ positions = list(TRIAGE_HOOK.query(self._item))
+ # default to NOW if nothing else applies
+ positions.append((0, NOW))
+ max_weight, position = max(positions)
+ return position
+
+
+ @trellis.compute
&lt;/ins&gt;&lt;span class="cx"&gt; def calculated(self):
&lt;/span&gt;&lt;span class="cx"&gt; if self.manual is not None:
&lt;/span&gt;&lt;span class="cx"&gt; return self.manual
&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;a id="trunkChandlerAppsetuppy"&gt;&lt;/a&gt;
&lt;div class="modfile"&gt;&lt;h4&gt;Modified: trunk/Chandler-App/setup.py (33 =&gt; 34)&lt;/h4&gt;
&lt;pre class="diff"&gt;&lt;span&gt;
&lt;span class="info"&gt;--- trunk/Chandler-App/setup.py 2008-10-10 17:51:48 UTC (rev 33)
+++ trunk/Chandler-App/setup.py 2008-10-10 22:24:21 UTC (rev 34)
&lt;/span&gt;&lt;span class="lines"&gt;@@ -11,5 +11,12 @@
&lt;/span&gt;&lt;span class="cx"&gt; install_requires=['Chandler-Platform'],
&lt;/span&gt;&lt;span class="cx"&gt; test_suite = 'test_suite',
&lt;/span&gt;&lt;span class="cx"&gt; packages = find_packages(),
&lt;/span&gt;&lt;del&gt;- namespace_packages = ['chandler']
&lt;/del&gt;&lt;ins&gt;+ namespace_packages = ['chandá· |
Mon, 03 May, 09:42 |
| m.@osafoundation.org> |
nkChandlerPlatformchandlertime_servicespy"></a><divclass="modfile"><h4>Modified:trunk/Chandler-Platform/chandler/time_services.py(33=>34)</h4><preclass="diff"><span><spanclass="info">---trunk/Chandler-Platform/chandler/time_services.py2008-10-1017:51:48UTC(rev33)+++trunk/Chandler-Platform/chandler/time_services.py2008-10-1022:24:21UTC(rev34)</span><spanclass="lines">@@-32,16+32,21@@</span><spanclass="cx">tz=TimeZone.default</span><spanclass="cx">returndatetime.fromtimestamp(activity.Time._now,tz)</span><spanclass="cx"></span><ins>+deftimestamp(dt):+#timegmreturnsanintnumberofseconds,whichisprobablygood+#enoughforourpurposes,butmaketestsexpectafloat,in+#casewedecidetoreplaceitwithsomethingwithalittlemore+#resolution+returnfloat(timegm(dt.astimezone(TimeZone.utc).timetuple()))+</ins><spanclass="cx">defsetNow(dt):</span><spanclass="cx">ifdtisnotNoneanddt.tzinfoisNone:</span><spanclass="cx">dt=dt.replace(tzinfo=ICUtzinfo.default)</span><spanclass="cx"></span><del>-timetuple=dt.astimezone(TimeZone.utc).timetuple()-</del><spanclass="cx">#thisignorescalendar.timegm(ortime.mktime)rangelimitsand</span><spanclass="cx">#MAXYEAR/MINYEAR,sinceanowtimestampreallyshouldn'tbeoutsidethose</span><spanclass="cx">#ranges</span><del>-new_timestamp=timegm(timetuple)</del><ins>+new_timestamp=timestamp(dt)</ins><spanclass="cx"></span><spanclass="cx">activity.Time.auto_update=False</span><spanclass="cx">activity.Time.advance(new_timestamp-activity.Time._now)</span><spanclass="lines">@@-54,7+59,6@@</span><spanclass="cx">&quot;&quot;&quot;ThenumberofsecondsbetwentheUTCepochandnow.&quot;&quot;&quot;</span><spanclass="cx">returnactivity.Time._now</span><spanclass="cx"></span><del>-</del><spanclass="cx">classTimeZone(trellis.Component,context.Service):</span><spanclass="cx"></span><spanclass="cx">default=trellis.attr(ICUtzinfo.default)</span></span></pre></div><aid="trunkHookstxt"></a><divclass="modfile"><h4>Modified:trunk/Hooks.txt(33=>34)</h4><preclass="diff"><span><spanclass="info">---trunk/Hooks.txt2008-10-1017:51:48UTC(rev33)+++trunk/Hooks.txt2008-10-1022:24:21UTC(rev34)</span><spanclass="lines">@@-11,8+11,8@@</span><spanclass="cx">Mainhooks</span><spanclass="cx">==========</span><spanclass="cx"></span><del>-BelowareChandler'smostfrequentlyusedHooks.Seetheindex_fora-completelist.</del><ins>+BelowareChandler'smostfrequentlyusedHooks.See&quot;hook&quot;inthe+index_foracompletelist.</ins><spanclass="cx"></span><spanclass="cx">..</span><spanclass="cx">Whendocumentingahook,addaSphinxindexdirective,like</span><spanclass="lines">t;&gt;&gt;item_triage.manual=99</ins><spanclass="cx">Traceback(mostrecentcalllast):</span><spanclass="cx">...</span><spanclass="cx">TriageRangeError:Can'tsettriagestatusto:99</span><spanclass="cx"></span><ins>+..index::hook;chandler.domain.triage+.._triage-hook:++Autotriage+===========++If:attr:`~Triage.manual`is``None``,:attr:`~Triage.auto`isusedto+determine:attr:`~Triage.calculated`.++The:attr:`~Triage.auto`celliscalculatedbytakingthehighest+weightedvaluefromapplyingthe:ref:`chandler.domain.triage+&lt;triage-hook-central&gt;`hook.Ifnovaluesarefound,:const:`NOW`+isused.++&gt;&gt;&gt;item_triage.manual=None+&gt;&gt;&gt;item_triage.calculated+100.0++</ins><spanclass="cx">XXXtesttriagestatusofunrecognized250,calculatedfallsbackto200</span><spanclass="cx"></span><spanclass="cx">XXXHowdoItest:</span><spanclass="cx">assumingnochandler.triage.typesentrypoints</span><spanclass="cx">addentrypointsincode</span><ins>+</ins></span></pre></div><aid="trunkChandlerAppchandlereventpy"></a><divclass="modfile"><h4>Modified:trunk/Chandler-App/chandler/event.py(33=>34)</h4><preclass="diff"><span><spanclass="info">---trunk/Chandler-App/chandler/event.py2008-10-1017:51:48UTC(rev33)+++trunk/Chandler-App/chandler/event.py2008-10-1022:24:21UTC(rev34)</span><spanclass="lines">@@-1,14+1,16@@</span><spanclass="cx">fromdatetimeimportdatetime,timedelta,time</span><spanclass="cx">importpeak.events.trellisastrellis</span><ins>+importpeak.events.activityasactivity</ins><spanclass="cx">frompeak.util.addonsimportAddOn</span><spanclass="cx"></span><spanclass="cx">fromchandler.coreimport*</span><del>-fromchandler.time_servicesimportTimeZone</del><ins>+fromchandler.time_servicesimportTimeZone,timestamp,nowTimestamp+fromchandler.triageimportTriage,NOW,LATER</ins><spanclass="cx"></span><del>-</del><spanclass="cx">one_hour=timedelta(hours=1)</span><spanclass="cx">zero_delta=timedelta(0)</span><spanclass="cx">midnight=time(0,tzinfo=TimeZone.floating)</span><ins>+EVENT_TRIAGE_WEIGHT=2.0</ins><spanclass="cx"></span><spanclass="cx">classEvent(Extension):</span><spanclass="cx">trellis.attrs(</span><spanclass="lines">@@-30,6+32,12@@</span><spanclass="cx">returndatetime.combine(self.base_start.date(),midnight)</span><spanclass="cx"></span><spanclass="cx">@trellis.compute</span><ins>+defis_started(self):+ifself.startisNone:+returnTrue+returnbool(activity.Time[timestamp(self.start)-nowTimestamp()])++@trellis.compute</ins><spanclass="cx">defduration(self):</span><spanclass="cx">ifnotself.is_day:</span><spanclass="cx">returnself.base_duration</span><spanclass="lines">@@-72,6+80,12@@</span><spanclass="cx">raiseBadDurationError(self.base_duration)</span><spanclass="cx"></span><spanclass="cx"></span><ins>+defevent_triage(item):+ifnotEvent.installed_on(item):+return(-1,None)+status=NOWifEvent(item).is_startedelseLATER+return(EVENT_TRIAGE_WEIGHT,status)+</ins><spanclass="cx">classNaiveTimezoneError(ConstraintError):</span><spanclass="cx">cell_description=&quot;base_start&quot;</span><spanclass="cx"></span><spanclass="lines">@@-113,6+127,7@@</span><spanclass="cx">returnbool(self.eventandnotself.event.implied_transparency)</span><spanclass="cx"></span><spanclass="cx"></span><del>-#impliedtransparency</del><ins>+defevent_triage_position(item):+pass</ins><spanclass="cx"></span><spanclass="cx">#is_between</span></span></pre></div><aid="trunkChandlerAppchandlertriagepy"></a><divclass="modfile"><h4>Modified:trunk/Chandler-App/chandler/triage.py(33=>34)</h4><preclass="diff"><span><spanclass="info">---trunk/Chandler-App/chandler/triage.py2008-10-1017:51:48UTC(rev33)+++trunk/Chandler-App/chandler/triage.py2008-10-1022:24:21UTC(rev34)</span><spanclass="lines">@@-1,4+1,5@@</span><spanclass="cx">importpeak.events.trellisastrellis</span><ins>+frompeak.utilimportplugins</ins><spanclass="cx">frompeak.util.addonsimportAddOn</span><spanclass="cx">fromchandler.time_servicesimportnowTimestamp</span><spanclass="cx">fromchandler.coreimportConstraintError</span><spanclass="lines">@@-9,15+10,34@@</span><spanclass="cx">LATER=200.0</span><spanclass="cx">DONE=300.0</span><spanclass="cx"></span><ins>+TRIAGE_HOOK=plugins.Hook('chandler.domain.triage')+POSITION_HOOK=plugins.Hook('chandler.interaction.triage_position')+</ins><spanclass="cx">###Domainmodel###</span><spanclass="cx"></span><spanclass="cx">classTriage(AddOn,trellis.Component):</span><spanclass="cx">trellis.attrs(</span><ins>+_item=None,</ins><spanclass="cx">manual=None,</span><del>-auto=None</del><ins>+auto_source=None</ins><spanclass="cx">)</span><spanclass="cx"></span><ins>+def__init__(self,item,**kwargs):+self._item=item+</ins><spanclass="cx">@trellis.compute</span><ins>+defauto(self):+ifself.auto_source:+pass#makeuseofauto_sourcewhenremindershavebeenfleshedout+else:+positions=list(TRIAGE_HOOK.query(self._item))+#defaulttoNOWifnothingelseapplies+positions.append((0,NOW))+max_weight,position=max(positions)+returnposition+++@trellis.compute</ins><spanclass="cx">defcalculated(self):</span><spanclass="cx">ifself.manualisnotNone:</span><spanclass="cx">returnself.manual</span></span></pre></div><aid="trunkChandlerAppsetuppy"></a><divclass="modfile"><h4>Modified:trunk/Chandler-App/setup.py(33=>34)</h4><preclass="diff"><span><spanclass="info">---trunk/Chandler-App/setup.py2008-10-1017:51:48UTC(rev33)+++trunk/Chandler-App/setup.py2008-10-1022:24:21UTC(rev34)</span><spanclass="lines">@@-11,5+11,12@@</span><spanclass="cx">install_requires=['Chandler-Platform'],</span><spanclass="cx">test_suite='test_suite',</span><spanclass="cx">packages=find_packages(),</span><del>-namespace_packages=['chandler']</del><ins>+namespace_packages=['chandler'],+entry_points=&quot;&quot;&quot;+[chandler.domain.triage]+event=chandler.event:event_triage++[chandler.interaction.triage_position]+event=chandler.event:event_triage_position+&quot;&quot;&quot;</ins><spanclass="cx">),</span></span></pre></div><aid="trunkChandlerPlatformTimeServicestxt"></a><divclass="modfile"><h4>Modified:trunk/Chandler-Platform/TimeServices.txt(33=>34)</h4><preclass="diff"><span><spanclass="info">---trunk/Chandler-Platform/TimeServices.txt2008-10-1017:51:48UTC(rev33)+++trunk/Chandler-Platform/TimeServices.txt2008-10-1022:24:21UTC(rev34)</span><spanclass="lines">@@-137,8+137,17@@</span><spanclass="cx">&gt;&gt;&gt;getNow()</span><spanclass="cx">datetime.datetime(2008,9,30,10,0,tzinfo=&lt;ICUtzinfo:US/Eastern&gt;)</span><spanclass="cx"></span><ins>+Timestamps+==========++TimestampsarefloatvaluesmeasuringsecondssincetheUTCepoch.+timemachineprovidesaconveniencefunctionforgettingtimestamps:++&gt;&gt;&gt;timestamp(oct1)+1222880400.0+</ins><spanclass="cx">There'salsoatime_services-awarefunctionforgettingacurrent</span><del>-timestamp(secondssincetheUTCepoch).</del><ins>+timestamp.</ins><spanclass="cx">mp;gt;&lt;ins&gt;+ auto_source=None
&lt;/ins&gt;&lt;span class="cx"&gt; )
&lt;/span&gt;&lt;span class="cx"&gt;
&lt;/span&gt;&lt;ins&gt;+ def __init__(self, item, **kwargs):
+ self._item = item
+
&lt;/ins&gt;&lt;span class="cx"&gt; @trellis.compute
&lt;/span&gt;&lt;ins&gt;+ def auto(self):
+ if self.auto_source:
+ pass # make use of auto_source when reminders have been fleshed out
+ else:
+ positions = list(TRIAGE_HOOK.query(self._item))
+ # default to NOW if nothing else applies
+ positions.append((0, NOW))
+ max_weight, position = max(positions)
+ return position
+
+
+ @trellis.compute
&lt;/ins&gt;&lt;span class="cx"&gt; def calculated(self):
&lt;/span&gt;&lt;span class="cx"&gt; if self.manual is not None:
&lt;/span&gt;&lt;span class="cx"&gt; return self.manual
&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;a id="trunkChandlerAppsetuppy"&gt;&lt;/a&gt;
&lt;div class="modfile"&gt;&lt;h4&gt;Modified: trunk/Chandler-App/setup.py (33 =&gt; 34)&lt;/h4&gt;
&lt;pre class="diff"&gt;&lt;span&gt;
&lt;span class="info"&gt;--- trunk/Chandler-App/setup.py 2008-10-10 17:51:48 UTC (rev 33)
+++ trunk/Chandler-App/setup.py 2008-10-10 22:24:21 UTC (rev 34)
&lt;/span&gt;&lt;span class="lines"&gt;@@ -11,5 +11,12 @@
&lt;/span&gt;&lt;span class="cx"&gt; install_requires=['Chandler-Platform'],
&lt;/span&gt;&lt;span class="cx"&gt; test_suite = 'test_suite',
&lt;/span&gt;&lt;span class="cx"&gt; packages = find_packages(),
&lt;/span&gt;&lt;del&gt;- namespace_packages = ['chandler']
&lt;/del&gt;&lt;ins&gt;+ namespace_packages = ['chandá· |
Mon, 03 May, 09:42 |
| m.@osafoundation.org> |
imedelta(0)&lt;/span&gt;&lt;spanclass="cx"&gt;midnight=time(0,tzinfo=TimeZone.floating)&lt;/span&gt;&lt;ins&gt;+EVENT_TRIAGE_WEIGHT=2.0&lt;/ins&gt;&lt;spanclass="cx"&gt;&lt;/span&gt;&lt;spanclass="cx"&gt;classEvent(Extension):&lt;/span&gt;&lt;spanclass="cx"&gt;trellis.attrs(&lt;/span&gt;&lt;spanclass="lines"&gt;@@-30,6+32,12@@&lt;/span&gt;&lt;spanclass="cx"&gt;returndatetime.combine(self.base_start.date(),midnight)&lt;/span&gt;&lt;spanclass="cx"&gt;&lt;/span&gt;&lt;spanclass="cx"&gt;@trellis.compute&lt;/span&gt;&lt;ins&gt;+defis_started(self):+ifself.startisNone:+returnTrue+returnbool(activity.Time[timestamp(self.start)-nowTimestamp()])++@trellis.compute&lt;/ins&gt;&lt;spanclass="cx"&gt;defduration(self):&lt;/span&gt;&lt;spanclass="cx"&gt;ifnotself.is_day:&lt;/span&gt;&lt;spanclass="cx"&gt;returnself.base_duration&lt;/span&gt;&lt;spanclass="lines"&gt;@@-72,6+80,12@@&lt;/span&gt;&lt;spanclass="cx"&gt;raiseBadDurationError(self.base_duration)&lt;/span&gt;&lt;spanclass="cx"&gt;&lt;/span&gt;&lt;spanclass="cx"&gt;&lt;/span&gt;&lt;ins&gt;+defevent_triage(item):+ifnotEvent.installed_on(item):+return(-1,None)+status=NOWifEvent(item).is_startedelseLATER+return(EVENT_TRIAGE_WEIGHT,status)+&lt;/ins&gt;&lt;spanclass="cx"&gt;classNaiveTimezoneError(ConstraintError):&lt;/span&gt;&lt;spanclass="cx"&gt;cell_description=&amp;quot;base_start&amp;quot;&lt;/span&gt;&lt;spanclass="cx"&gt;&lt;/span&gt;&lt;spanclass="lines"&gt;@@-113,6+127,7@@&lt;/span&gt;&lt;spanclass="cx"&gt;returnbool(self.eventandnotself.event.implied_transparency)&lt;/span&gt;&lt;spanclass="cx"&gt;&lt;/span&gt;&lt;spanclass="cx"&gt;&lt;/span&gt;&lt;del&gt;-#impliedtransparency&lt;/del&gt;&lt;ins&gt;+defevent_triage_position(item):+pass&lt;/ins&gt;&lt;spanclass="cx"&gt;&lt;/span&gt;&lt;spanclass="cx"&gt;#is_between&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;aid="trunkChandlerAppchandlertriagepy"&gt;&lt;/a&gt;&lt;divclass="modfile"&gt;&lt;h4&gt;Modified:trunk/Chandler-App/chandler/triage.py(33=&gt;34)&lt;/h4&gt;&lt;preclass="diff"&gt;&lt;span&gt;&lt;spanclass="info"&gt;---trunk/Chandler-App/chandler/triage.py2008-10-1017:51:48UTC(rev33)+++trunk/Chandler-App/chandler/triage.py2008-10-1022:24:21UTC(rev34)&lt;/span&gt;&lt;spanclass="lines"&gt;@@-1,4+1,5@@&lt;/span&gt;&lt;spanclass="cx"&gt;importpeak.events.trellisastrellis&lt;/span&gt;&lt;ins&gt;+frompeak.utilimportplugins&lt;/ins&gt;&lt;spanclass="cx"&gt;frompeak.util.addonsimportAddOn&lt;/span&gt;&lt;spanclass="cx"&gt;fromchandler.time_servicesimportnowTimestamp&lt;/span&gt;&lt;spanclass="cx"&gt;fromchandler.coreimportConstraintError&lt;/span&gt;&lt;spanclass="lines"&gt;@@-9,15+10,34@@&lt;/span&gt;&lt;spanclass="cx"&gt;LATER=200.0&lt;/span&gt;&lt;spanclass="cx"&gt;DONE=300.0&lt;/span&gt;&lt;spanclass="cx"&gt;&lt;/span&gt;&lt;ins&gt;+TRIAGE_HOOK=plugins.Hook('chandler.domain.triage')+POSITION_HOOK=plugins.Hook('chandler.interaction.triage_position')+&lt;/ins&gt;&lt;spanclass="cx"&gt;###Domainmodel###&lt;/span&gt;&lt;spanclass="cx"&gt;&lt;/span&gt;&lt;spanclass="cx"&gt;classTriage(AddOn,trellis.Component):&lt;/span&gt;&lt;spanclass="cx"&gt;trellis.attrs(&lt;/span&gt;&lt;ins&gt;+_item=None,&lt;/ins&gt;&lt;spanclass="cx"&gt;manual=None,&lt;/span&gt;&lt;del&gt;-auto=None&lt;/del&gt;&lt;ins&gt;+auto_source=None&lt;/ins&gt;&lt;spanclass="cx"&gt;)&lt;/span&gt;&lt;spanclass="cx"&gt;&lt;/span&gt;&lt;ins&gt;+def__init__(self,item,**kwargs):+self._item=item+&lt;/ins&gt;&lt;spanclass="cx"&gt;@trellis.compute&lt;/span&gt;&lt;ins&gt;+defauto(self):+ifself.auto_source:+pass#makeuseofauto_sourcewhenremindershavebeenfleshedout+else:+positions=list(TRIAGE_HOOK.query(self._item))+#defaulttoNOWifnothingelseapplies+positions.append((0,NOW))+max_weight,position=max(positions)+returnposition+++@trellis.compute&lt;/ins&gt;&lt;spanclass="cx"&gt;defcalculated(self):&lt;/span&gt;&lt;spanclass="cx"&gt;ifself.manualisnotNone:&lt;/span&gt;&lt;spanclass="cx"&gt;returnself.manual&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;aid="trunkChandlerAppsetuppy"&gt;&lt;/a&gt;&lt;divclass="modfile"&gt;&lt;h4&gt;Modified:trunk/Chandler-App/setup.py(33=&gt;34)&lt;/h4&gt;&lt;preclass="diff"&gt;&lt;span&gt;&lt;spanclass="info"&gt;---trunk/Chandler-App/setup.py2008-10-1017:51:48UTC(rev33)+++trunk/Chandler-App/setup.py2008-10-1022:24:21UTC(rev34)&lt;/span&gt;&lt;spanclass="lines"&gt;@@-11,5+11,12@@&lt;/span&gt;&lt;spanclass="cx"&gt;install_requires=['Chandler-Platform'],&lt;/span&gt;&lt;spanclass="cx"&gt;test_suite='test_suite',&lt;/span&gt;&lt;spanclass="cx"&gt;packages=find_packages(),&lt;/span&gt;&lt;del&gt;-namespace_packages=['chandler']&lt;/del&gt;&lt;ins&gt;+namespace_packages=['chandler'],+entry_points=&amp;quot;&amp;quot;&amp;quot;+[chandler.domain.triage]+event=chandler.event:event_triage++[chandler.interaction.triage_position]+event=chandler.event:event_triage_position+&amp;quot;&amp;quot;&amp;quot;&lt;/ins&gt;&lt;spanclass="cx"&gt;),&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;aid="trunkChandlerPlatformTimeServicestxt"&gt;&lt;/a&gt;&lt;divclass="modfile"&gt;&lt;h4&gt;Modified:trunk/Chandler-Platform/TimeServices.txt(33=&gt;34)&lt;/h4&gt;&lt;preclass="diff"&gt;&lt;span&gt;&lt;spanclass="info"&gt;---trunk/Chandler-Platform/TimeServices.txt2008-10-1017:51:48UTC(rev33)+++trunk/Chandler-Platform/TimeServices.txt2008-10-1022:24:21UTC(rev34)&lt;/span&gt;&lt;spanclass="lines"&gt;@@-137,8+137,17@@&lt;/span&gt;&lt;spanclass="cx"&gt;&amp;gt;&amp;gt;&amp;gt;getNow()&lt;/span&gt;&lt;spanclass="cx"&gt;datetime.datetime(2008,9,30,10,0,tzinfo=&amp;lt;ICUtzinfo:US/Eastern&amp;gt;)&lt;/span&gt;&lt;spanclass="cx"&gt;&lt;/span&gt;&lt;ins&gt;+Timestamps+==========++TimestampsarefloatvaluesmeasuringsecondssincetheUTCepoch.+timemachineprovidesaconveniencefunctionforgettingtimestamps:++&amp;gt;&amp;gt;&amp;gt;timestamp(oct1)+1222880400.0+&lt;/ins&gt;&lt;spanclass="cx"&gt;There'salsoatime_services-awarefunctionforgettingacurrent&lt;/span&gt;&lt;del&gt;-timestamp(secondssincetheUTCepoch).&lt;/del&gt;&lt;ins&gt;+timestamp.&lt;/ins&gt;&lt;spanclass="cx"&gt;&lt;/span&gt;&lt;spanclass="cx"&gt;&amp;gt;&amp;gt;&amp;gt;nowTimestamp()&lt;/span&gt;&lt;spanclass="cx"&gt;1222783200.0&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;aid="trunkChandlerPlatformchandlercorepy"&gt;&lt;/a&gt;&lt;divclass="modfile"&gt;&lt;h4&gt;Modified:trunk/Chandler-Platform/chandler/core.py(33=&gt;34)&lt;/h4&gt;&lt;preclass="diff"&gt;&lt;span&gt;&lt;spanclass="info"&gt;---trunk/Chandler-Platform/chandler/core.py2008-10-1017:51:48UTC(rev33)+++trunk/Chandler-Platform/chandler/core.py2008-10-1022:24:21UTC(rev34)&lt;/span&gt;&lt;spanclass="lines"&gt;@@-66,3+66,16@@&lt;/span&gt;&lt;spanclass="cx"&gt;def__str__(self):&lt;/span&gt;&lt;spanclass="cx"&gt;returnself.msg%{'cell_description':self.cell_description,&lt;/span&gt;&lt;spanclass="cx"&gt;'cell_value':self.cell_value}&lt;/span&gt;&lt;ins&gt;+++####Utility#####++classViewer(trellis.Component):+component=trellis.attr(None)+cell_name=trellis.attr(None)++@trellis.perform+defview_it(self):+value=getattr(self.component,self.cell_name,None)+ifNonenotin(self.component,self.cell_name,value):+print&amp;quot;%schangedto:%s&amp;quot;%(self.cell_name,value)&lt;/ins&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;aid="trunkChandlerPlatformchandlertime_servicespy"&gt;&lt;/a&gt;&lt;divclass="modfile"&gt;&lt;h4&gt;Modified:trunk/Chandler-Platform/chandler/time_services.py(33=&gt;34)&lt;/h4&gt;&lt;preclass="diff"&gt;&lt;span&gt;&lt;spanclass="info"&gt;---trunk/Chandler-Platform/chandler/time_services.py2008-10-1017:51:48UTC(rev33)+++trunk/Chandler-Platform/chandler/time_services.py2008-10-1022:24:21UTC(rev34)&lt;/span&gt;&lt;spanclass="lines"&gt;@@-32,16+32,21@@&lt;/span&gt;&lt;spanclass="cx"&gt;tz=TimeZone.default&lt;/span&gt;&lt;spanclass="cx"&gt;returndatetime.fromtimestamp(activity.Time._now,tz)&lt;/span&gt;&lt;spanclass="cx"&gt;&lt;/span&gt;&lt;ins&gt;+deftimestamp(dt):+#timegmreturnsanintnumberofseconds,whichisprobablygood+#enoughforourpurposes,butmaketestsexpectafloat,in+#casewedecidetoreplaceitwithsomethingwithalittlemore+#resolution+returnfloat(timegm(dt.astimezone(TimeZone.utc).timetuple()))+&lt;/ins&gt;&lt;spanclass="cx"&gt;defsetNow(dt):&lt;/span&gt;&lt;spanclass="cx"&gt;ifdtisnotNoneanddt.tzinfoisNone:&lt;/span&gt;&lt;spanclass="cx"&gt;dt=dt.replace(tzinfo=ICUtzinfo.default)&lt;/span&gt;&lt;spanclass="cx"&gt;&lt;/span&gt;&lt;del&gt;-timetuple=dt.astimezone(TimeZone.utc).timetuple()-&lt;/del&gt;&lt;spanclass="cx"&gt;#thisignorescalendar.timegm(ortime.mktime)rangelimitsand&lt;/span&gt;&lt;spanclass="cx"&gt;#MAXYEAR/MINYEAR,sinceanowtimestampreallyshouldn'tbeoutsidethose&lt;/span&gt;&lt;spanclass="cx"&gt;#ranges&lt;/span&gt;&lt;del&gt;-new_timestamp=timegm(timetuple)&lt;/del&gt;&lt;ins&gt;+new_timestamp=timestamp(dt)&lt;/ins&gt;&lt;spanclass="cx"&gt;&lt;/span&gt;&lt;spanclass="cx"&gt;activity.Time.auto_update=False&lt;/span&gt;&lt;spanclass="cx"&gt;activity.Time.advance(new_timestamp-activity.Time._now)&lt;/span&gt;&lt;spanclass="lines"&gt;@@-54,7+59,6@@&lt;/span&gt;&lt;spanclass="cx"&gt;&amp;quot;&amp;quot;&amp;quot;Thenum200502250002.j1P02WnP008795@tutu.osafoundation.org> |
Mon, 03 May, 09:42 |
| nen |
t;spanclass="cx"></span><spanclass="cx">activity.Time.auto_update=False</span><spanclass="cx">activity.Time.advance(new_timestamp-activity.Time._now)</span><spanclass="lines">@@-54,7+59,6@@</span><spanclass="cx">&quot;&quot;&quot;ThenumberofsecondsbetwentheUTCepochandnow.&quot;&quot;&quot;</span><spanclass="cx">returnactivity.Time._now</span><spanclass="cx"></span><del>-</del><spanclass="cx">classTimeZone(trellis.Component,context.Service):</span><spanclass="cx"></span><spanclass="cx">default=trellis.attr(ICUtzinfo.default)</span></span></pre></div><aid="trunkHookstxt"></a><divclass="modfile"><h4>Modified:trunk/Hooks.txt(33=>34)</h4><preclass="diff"><span><spanclass="info">---trunk/Hooks.txt2008-10-1017:51:48UTC(rev33)+++trunk/Hooks.txt2008-10-1022:24:21UTC(rev34)</span><spanclass="lines">@@-11,8+11,8@@</span><spanclass="cx">Mainhooks</span><spanclass="cx">==========</span><spanclass="cx"></span><del>-BelowareChandler'smostfrequentlyusedHooks.Seetheindex_fora-completelist.</del><ins>+BelowareChandler'smostfrequentlyusedHooks.See&quot;hook&quot;inthe+index_foracompletelist.</ins><spanclass="cx"></span><spanclass="cx">..</span><spanclass="cx">Whendocumentingahook,addaSphinxindexdirective,like</span><spanclass="lines">t;&gt;&gt;item_triage.manual=99</ins><spanclass="cx">Traceback(mostrecentcalllast):</span><spanclass="cx">...</span><spanclass="cx">TriageRangeError:Can'tsettriagestatusto:99</span><spanclass="cx"></span><ins>+..index::hook;chandler.domain.triage+.._triage-hook:++Autotriage+===========++If:attr:`~Triage.manual`is``None``,:attr:`~Triage.auto`isusedto+determine:attr:`~Triage.calculated`.++The:attr:`~Triage.auto`celliscalculatedbytakingthehighest+weightedvaluefromapplyingthe:ref:`chandler.domain.triage+&lt;triage-hook-central&gt;`hook.Ifnovaluesarefound,:const:`NOW`+isused.++&gt;&gt;&gt;item_triage.manual=None+&gt;&gt;&gt;item_triage.calculated+100.0++</ins><spanclass="cx">XXXtesttriagestatusofunrecognized250,calculatedfallsbackto200</span><spanclass="cx"></span><spanclass="cx">XXXHowdoItest:</span><spanclass="cx">assumingnochandler.triage.typesentrypoints</span><spanclass="cx">addentrypointsincode</span><ins>+</ins></span></pre></div><aid="trunkChandlerAppchandlereventpy"></a><divclass="modfile"><h4>Modified:trunk/Chandler-App/chandler/event.py(33=>34)</h4><preclass="diff"><span><spanclass="info">---trunk/Chandler-App/chandler/event.py2008-10-1017:51:48UTC(rev33)+++trunk/Chandler-App/chandler/event.py2008-10-1022:24:21UTC(rev34)</span><spanclass="lines">@@-1,14+1,16@@</span><spanclass="cx">fromdatetimeimportdatetime,timedelta,time</span><spanclass="cx">importpeak.events.trellisastrellis</span><ins>+importpeak.events.activityasactivity</ins><spanclass="cx">frompeak.util.addonsimportAddOn</span><spanclass="cx"></span><spanclass="cx">fromchandler.coreimport*</span><del>-fromchandler.time_servicesimportTimeZone</del><ins>+fromchandler.time_servicesimportTimeZone,timestamp,nowTimestamp+fromchandler.triageimportTriage,NOW,LATER</ins><spanclass="cx"></span><del>-</del><spanclass="cx">one_hour=timedelta(hours=1)</span><spanclass="cx">zero_delta=timedelta(0)</span><spanclass="cx">midnight=time(0,tzinfo=TimeZone.floating)</span><ins>+EVENT_TRIAGE_WEIGHT=2.0</ins><spanclass="cx"></span><spanclass="cx">classEvent(Extension):</span><spanclass="cx">trellis.attrs(</span><spanclass="lines">@@-30,6+32,12@@</span><spanclass="cx">returndatetime.combine(self.base_start.date(),midnight)</span><spanclass="cx"></span><spanclass="cx">@trellis.compute</span><ins>+defis_started(self):+ifself.startisNone:+returnTrue+returnbool(activity.Time[timestamp(self.start)-nowTimestamp()])++@trellis.compute</ins><spanclass="cx">defduration(self):</span><spanclass="cx">ifnotself.is_day:</span><spanclass="cx">returnself.base_duration</span><spanclass="lines">@@-72,6+80,12@@</span><spanclass="cx">raiseBadDurationError(self.base_duration)</span><spanclass="cx"></span><spanclass="cx"></span><ins>+defevent_triage(item):+ifnotEvent.installed_on(item):+return(-1,None)+status=NOWifEvent(item).is_startedelseLATER+return(EVENT_TRIAGE_WEIGHT,status)+</ins><spanclass="cx">classNaiveTimezoneError(ConstraintError):</span><spanclass="cx">cell_description=&quot;base_start&quot;</span><spanclass="cx"></span><spanclass="lines">@@-113,6+127,7@@</span><spanclass="cx">returnbool(self.eventandnotself.event.implied_transparency)</span><spanclass="cx"></span><spanclass="cx"></span><del>-#impliedtransparency</del><ins>+defevent_triage_position(item):+pass</ins><spanclass="cx"></span><spanclass="cx">#is_between</span></span></pre></div><aid="trunkChandlerAppchandlertriagepy"></a><divclass="modfile"><h4>Modified:trunk/Chandler-App/chandler/triage.py(33=>34)</h4><preclass="diff"><span><spanclass="info">---trunk/Chandler-App/chandler/triage.py2008-10-1017:51:48UTC(rev33)+++trunk/Chandler-App/chandler/triage.py2008-10-1022:24:21UTC(rev34)</span><spanclass="lines">@@-1,4+1,5@@</span><spanclass="cx">importpeak.events.trellisastrellis</span><ins>+frompeak.utilimportplugins</ins><spanclass="cx">frompeak.util.addonsimportAddOn</span><spanclass="cx">fromchandler.time_servicesimportnowTimestamp</span><spanclass="cx">fromchandler.coreimportConstraintError</span><spanclass="lines">@@-9,15+10,34@@</span><spanclass="cx">LATER=200.0</span><spanclass="cx">DONE=300.0</span><spanclass="cx"></span><ins>+TRIAGE_HOOK=plugins.Hook('chandler.domain.triage')+POSITION_HOOK=plugins.Hook('chandler.interaction.triage_position')+</ins><spanclass="cx">###Domainmodel###</span><spanclass="cx"></span><spanclass="cx">classTriage(AddOn,trellis.Component):</span><spanclass="cx">trellis.attrs(</span><ins>+_item=None,</ins><spanclass="cx">manual=None,</span><del>-auto=None</del><ins>+auto_source=None</ins><spanclass="cx">)</span><spanclass="cx"></span><ins>+def__init__(self,item,**kwargs):+self._item=item+</ins><spanclass="cx">@trellis.compute</span><ins>+defauto(self):+ifself.auto_source:+pass#makeuseofauto_sourcewhenremindershavebeenfleshedout+else:+positions=list(TRIAGE_HOOK.query(self._item))+#defaulttoNOWifnothingelseapplies+positions.append((0,NOW))+max_weight,position=max(positions)+returnposition+++@trellis.compute</ins><spanclass="cx">defcalculated(self):</span><spanclass="cx">ifself.manualisnotNone:</span><spanclass="cx">returnself.manual</span></span></pre></div><aid="trunkChandlerAppsetuppy"></a><divclass="modfile"><h4>Modified:trunk/Chandler-App/setup.py(33=>34)</h4><preclass="diff"><span><spanclass="info">---trunk/Chandler-App/setup.py2008-10-1017:51:48UTC(rev33)+++trunk/Chandler-App/setup.py2008-10-1022:24:21UTC(rev34)</span><spanclass="lines">@@-11,5+11,12@@</span><spanclass="cx">install_requires=['Chandler-Platform'],</span><spanclass="cx">test_suite='test_suite',</span><spanclass="cx">packages=find_packages(),</span><del>-namespace_packages=['chandler']</del><ins>+namespace_packages=['chandler'],+entry_points=&quot;&quot;&quot;+[chandler.domain.triage]+event=chandler.event:event_triage++[chandler.interaction.triage_position]+event=chandler.event:event_triage_position+&quot;&quot;&quot;</ins><spanclass="cx">),</span></span></pre></div><aid="trunkChandlerPlatformTimeServicestxt"></a><divclass="modfile"><h4>Modified:trunk/Chandler-Platform/TimeServices.txt(33=>34)</h4><preclass="diff"><span><spanclass="info">---trunk/Chandler-Platform/TimeServices.txt2008-10-1017:51:48UTC(rev33)+++trunk/Chandler-Platform/TimeServices.txt2008-10-1022:24:21UTC(rev34)</span><spanclass="lines">@@-137,8+137,17@@</span><spanclass="cx">&gt;&gt;&gt;getNow()</span><spanclass="cx">datetime.datetime(2008,9,30,10,0,tzinfo=&lt;ICUtzinfo:US/Eastern&gt;)</span><spanclass="cx"></span><ins>+Timestamps+==========++TimestampsarefloatvaluesmeasuringsecondssincetheUTCepoch.+timemachineprovidesaconveniencefunctionforgettingtimestamps:++&gt;&gt;&gt;timestamp(oct1)+1222880400.0+</ins><spanclass="cx">There'salsoatime_services-awarefunctionforgettingacurrent</span><del>-timestamp(secondssincetheUTCepoch).</del><ins>+timestamp.</ins><spanclass="cx">mp;gt;&lt;ins&gt;+ auto_source=None
&lt;/ins&gt;&lt;span class="cx"&gt; )
&lt;/span&gt;&lt;span class="cx"&gt;
&lt;/span&gt;&lt;ins&gt;+ def __init__(self, item, **kwargs):
+ self._item = item
+
&lt;/ins&gt;&lt;span class="cx"&gt; @trellis.compute
&lt;/span&gt;&lt;ins&gt;+ def auto(self):
+ if self.auto_source:
+ pass # make use of auto_source when reminders have been fleshed out
+ else:
+ positions = list(TRIAGE_HOOK.query(self._item))
+ # default to NOW if nothing else applies
+ positions.append((0, NOW))
+ max_weight, position = max(positions)
+ return position
+
+
+ @trellis.compute
&lt;/ins&gt;&lt;span class="cx"&gt; def calculated(self):
&lt;/span&gt;&lt;span class="cx"&gt; if self.manual is not None:
&lt;/span&gt;&lt;span class="cx"&gt; return self.manual
&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;a id="trunkChandlerAppsetuppy"&gt;&lt;/a&gt;
&lt;div class="modfile"&gt;&lt;h4&gt;Modified: trunk/Chandler-App/setup.py (33 =&gt; 34)&lt;/h4&gt;
&lt;pre class="diff"&gt;&lt;span&gt;
&lt;span class="info"&gt;--- trunk/Chandler-App/setup.py 2008-10-10 17:51:48 UTC (rev 33)
+++ trunk/Chandler-App/setup.py 2008-10-10 22:24:21 UTC (rev 34)
&lt;/span&gt;&lt;span class="lines"&gt;@@ -11,5 +11,12 @@
&lt;/span&gt;&lt;span class="cx"&gt; install_requires=['Chandler-Platform'],
&lt;/span&gt;&lt;span class="cx"&gt; test_suite = 'test_suite',
&lt;/span&gt;&lt;span class="cx"&gt; packages = find_packages(),
&lt;/span&gt;&lt;del&gt;- namespace_packages = ['chandler']
&lt;/del&gt;&lt;ins&gt;+ namespace_packages = ['chandá· |
Wed, 11 Jan, 14:11 |
| nen |
t;spanclass="cx"></span><spanclass="cx">activity.Time.auto_update=False</span><spanclass="cx">activity.Time.advance(new_timestamp-activity.Time._now)</span><spanclass="lines">@@-54,7+59,6@@</span><spanclass="cx">&quot;&quot;&quot;ThenumberofsecondsbetwentheUTCepochandnow.&quot;&quot;&quot;</span><spanclass="cx">returnactivity.Time._now</span><spanclass="cx"></span><del>-</del><spanclass="cx">classTimeZone(trellis.Component,context.Service):</span><spanclass="cx"></span><spanclass="cx">default=trellis.attr(ICUtzinfo.default)</span></span></pre></div><aid="trunkHookstxt"></a><divclass="modfile"><h4>Modified:trunk/Hooks.txt(33=>34)</h4><preclass="diff"><span><spanclass="info">---trunk/Hooks.txt2008-10-1017:51:48UTC(rev33)+++trunk/Hooks.txt2008-10-1022:24:21UTC(rev34)</span><spanclass="lines">@@-11,8+11,8@@</span><spanclass="cx">Mainhooks</span><spanclass |