[Zope] More REQUEST.set not incrementing SUCCESS!

Jeff K. Hoffman jeff@goingv.com
Wed, 12 Jan 2000 12:05:46 -0500 (EST)


On Wed, 12 Jan 2000 Jerry.Spicklemire@IFLYATA.COM wrote:

> <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>

Out of curiosity, does the following work?

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

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

If not, what does it do wrong?

I don't know about you, but the above looks MUCH easier to read to me, and
seems less redundant.

> 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.

It should not have any effect on Data.fs. Data.fs is only affected when
something in the ZODB is changed. In this case, nothing is being touched
in the ZODB; in this case, variables are set in the REQUEST and
incremented inside the <dtml-in> construct, which is not altering any
persistent data, AFAICT.

> Jerry S.

--Jeff

---
Jeff K. Hoffman                                         704.849.0731 x108
Chief Technology Officer                                mailto:jeff@goingv.com
Going Virtual, L.L.C.                                   http://www.goingv.com/