[Zope] More REQUEST.set not incrementing SUCCESS!

Jerry.Spicklemire@IFLYATA.COM Jerry.Spicklemire@IFLYATA.COM
Wed, 12 Jan 2000 09:51:22 -0500


Thanks to all the folks who responded with a bunch of good ides. The prize
for the most appropriate solution for this particular problem goes to Jim
Sanford, and here's the final code that did the trick :

<dtml-call "REQUEST.set('z_t',_.string.split(_.str(ZopeTime()))[0])">
<dtml-call "REQUEST.set('u_all',_.string.atoi('0'))">
<dtml-call "REQUEST.set('u_logged',_.string.atoi('0'))">
<dtml-call "REQUEST.set('u_today',_.string.atoi('0'))">
<dtml-call "REQUEST.set('u_not',_.string.atoi('0'))">

 <dtml-var u_all> <dtml-var u_logged> <dtml-var u_today><br>
 <dtml-in count_users_logged>
  <dtml-let t_all="u_all+1">
   <dtml-call "REQUEST.set('u_all',t_all)">
  </dtml-let>
  <dtml-if logged_on>
   <dtml-let t_logged="u_logged+1">
    <dtml-call "REQUEST.set('u_logged',t_logged)">
   </dtml-let>
   <dtml-if "_['z_t']==_.string.split(_.str(_.DateTime(logged_on)))[0]">
    <dtml-let t_today="u_today+1">
     <dtml-call "REQUEST.set('u_today',t_today)">
    </dtml-let>
   </dtml-if>
  <dtml-else>
   <dtml-let t_not="u_not+1">
    <dtml-call "REQUEST.set('u_not',t_not)">
   </dtml-let>
  </dtml-if>
 </dtml-in>

It looks (to me) like the reason this works, and other permutations failed,
is that <dtml-let> bahaves slightly differently than <dtml-call
"REQUEST.set">, as far as persistence of values. 

I'm not sure if this way of getting there suffers from the data.fs bloat
problem,  but I'll be watching to see if there's anything detectable.

Of course the SQL Gurus out there will be thinking that a series of "select
count queries might be faster, but we need to track new logins, which
requires checking every row every day, so why not let Zope handle it.

Thanks again,
Jerry S.