[Zope] More REQUEST.set not incrementing SUCCESS!

Jerry.Spicklemire@IFLYATA.COM Jerry.Spicklemire@IFLYATA.COM
Wed, 12 Jan 2000 12:46:50 -0500


Jeff Hoffman suggested the following code, that's quite a bit cleaner than
what I came up with, and it also works quite well.

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

I'm a bit mystified that the only detectable difference between this version
and *many* that I tried without success looks to be the spaces between
objects and keywords in expressions, along with the complete absence of
<dtml-let>.

e.g <dtml-call "REQUEST.set('u_logged', u_logged + 1)">

vs. <dtml-call "REQUEST.set('u_logged',u_logged+1)">

I've looked at lot's of code samples that have no spaces, and have seen
enough error messages to think very hard about random spaces in expressions.
This is a good example of how code lore (superstition) gets proliferated,
but it's hard to argue with working examples.

Thanks again, to Jeff, Jim, Pavlos, et. al.
Jerry S.