Re: [Zope] displaying based on date

2000-09-25 Thread Marco Mariani

On Mon, Sep 25, 2000 at 05:00:47PM -0500, Timothy Wilson wrote:

 I've created a ZClass and I'm using an HTML table to display certain
 properties of the class. One of the properties is a date, and I want to
 display in the table only those instances of the ZClass for which this
 certain date property is in the future. (It's a job posting ZClass, and I
 only want to display jobs that haven't yet closed.)
 
 I see in the ZQR that there is an 'isFuture' test that looks like it is
 associated with fmt. ZQR says for isFuture, "Return true if this object
 represents a date/time later than the time of the call."
 
 Can I combine this with a dtml-if? Is there a more elegant way?

Yes, like in:

dtml-in some_items sort=date
dtml-if "date.isFuture()"

 [...]

/dtml-if
/dtml-in

Where some_items is a list of objects with a date property.

I think it's nice enough.

You may even collapse everything in a row (untested):


dtml-in "filter(lambda x:x.date.isFuture(), some_items)" sort=date

/dtml-in




-- 
"This company has performed an illegal operation and will be shut down.
 If the problem persists, contact your vendor or appeal to a higher court."
 - Signal11 on slashdot

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] Is Zope slow?

2000-07-06 Thread Marco Mariani

On Thu, Jul 06, 2000 at 04:13:31AM -0400, Firestar wrote:

 Of course if i have time, i will play ard with it and see how good it is.
 Problem is that time is not really on my side and i need to decide on my
 next development tool fast(i have yet to try out other stuff e.g. ASP,
 JSP, Servlet..) I heard that the learning curve for Zope is quite steep,
 plus the documentation is not(?) that comprehensive, compared to e.g.
 PHP. What are your comments though? i may be wrong here...

Of course, the PHP book I have is really nice, phplib is a godsend too,
but I've tried it and I'm here now.

If you take the time to go beyond the "i will do it with external method
in python because that's all I know" stage, you will find at home sooner
or later depending on wether:

 - you already know python (I did)
 - you understand the difference between dtml-var pippo and dtml-var "pippo"
 - you understand how to wisely use REQUEST and RESPONSE
 - you don't need complex new products or zclasses
 - you post any doubt here (nice place isn't it?)
 - you give a deep read at the ZSQL documentation
 - you can apply full-time (I couldn't)

given that, most of the howtos and tips are redundant :-)

Of course I'm a newbie, but I'm a confident newbie.
 



-- 
"This company has performed an illegal operation and will be shut down.
 If the problem persists, contact your vendor or appeal to a higher court."
 - Signal11 on slashdot

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] how to invalidate an object in the cache?

2000-07-02 Thread Marco Mariani

On Sun, Jul 02, 2000 at 03:56:39PM +1000, Marc Boschma wrote:


 Sounds like you need to manipulate the expiry time for the objects. I'd
 suggest that that can either be done in the RESPONSE or via meta tags in the
 standard_html_header to mark the page and the image as non-cacheable.
 
 I'm actually interested in a Guru's response on this as I will need to set
 the expiry explicitly to save load on the server for content that is
 dynamically generated but doesn't change often.


It would work, but I'd have to set up meta tags for LocalFS objects..



I've found a better kludge: when I call the index page, I pass a "refresh" variable 
along
the URL which contains the number of the modified image.

Within the index method, I then call:


   dtml-call "REQUEST.set('id2',id+'_0.jpg')"
   dtml-let img="store[id][id2]"

   A HREF="imageForm?fnum=dtml.url_quote-id;"IMG
   SRC="dtml-var 
"img.absolute_url()+['','?%s'%_.random.random()][REQUEST.get('refresh')==id]""
   
^^
   WIDTH="dtml-var "img.width""
   HEIGHT="dtml-var "img.height""
   ALT="dtml-id;"/A

   /dtml-let


This way, the refreshed image is called with a trailing "?0.283759872" that tricks 
Netscape
to think it's a new object, and reloads.


This could work for you too, maybe.



-- 
"This company has performed an illegal operation and will be shut down.
 If the problem persists, contact your vendor or appeal to a higher court."
 - Signal11 on slashdot

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




[Zope] sort=id, _.map, _.lambda woes

2000-07-01 Thread Marco Mariani

Hi all!

I need the following:

dtml-in "store.fileValues()" sort=id

where "id" is a filename representing a number.
Of course, sort uses it like a string and sorts it wrong.

Maybe, since sortexpr= is not implemented (yet?) I could
get away with:

dtml-in "_.map(_.int,store.fileValues())" sort=id

but _.map doesn't exist (nor _.lambda. Why?)


What is the Right Thing to do?

I already know the easy answer (external method) :-)

Of couse I cannot add an order property to the file objects,
as they're in LocalFS.


Thanks

-- 
"This company has performed an illegal operation and will be shut down.
 If the problem persists, contact your vendor or appeal to a higher court."
 - Signal11 on slashdot

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




[Zope] how to invalidate an object in the cache?

2000-07-01 Thread Marco Mariani


I am working with photo rotating/resizing, via PIL on external
method.

All the images are kept on LocalFS.

There is a thumbnail bonanza page, when I select a thumbnail a
form is shown, and I can adjust rotation/contrast/brightness.
Upon submit, the new image+thumbnail is calculated and written
to the filesystem.

Then the method calls RESPONSE.redirect to show the index page again.

When I go back to the index thumbnail page, the
image I've just rotated is displayed with the right size (which means
that Zope gets it right), but not rotated (which means that Netscape
reads the old image from the cache). I mean, if it was 320x200 and is
now 200x320, the browser displays the old 320x200 image stretched to
200x320.

I'm not digging into contrast and brightness, but the same happens.

Is there a way to force the browser to discard the cache for that
image? If I go "right-button, view image, shift+reload" the new
image is displayed.

Any idea? I'm not very knowledgeable on this matter, I don't design
pages for a living.

Might javascript help?


Thank you.

-- 
"This company has performed an illegal operation and will be shut down.
 If the problem persists, contact your vendor or appeal to a higher court."
 - Signal11 on slashdot

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] (no subject)

2000-06-23 Thread Marco Mariani

On Fri, Jun 23, 2000 at 04:32:39PM +1000, Jay, Dylan wrote:

 It seems to me that a few tweaks to the dtml-if syntax would be beneficial
 
 something like the following would certainly clean up some of the logic I
 end up writing.
 
 dtml-if X
  a href="a_url"
 dtml-always
  link text
 dtml-else
  (no link currently available)
 dtml-then
  /a
 /dtml-if

dtml-if X
   a href="a_url"
   link text
   /a
dtml-else
   link text
   (no link...)
/dtml-if

Now what's cleaner and easier to the eyes?

Or for the obfuscated DTML context:

dtml-var "['A HREF=',''][not X]"
   link text
dtml-var "['/A','(no link...)'][not X]"


:-)


-- 
"This company has performed an illegal operation and will be shut down.
 If the problem persists, contact your vendor or appeal to a higher court."
 - Signal11 on slashdot

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




[Zope] del dict[kw] in DTML

2000-06-13 Thread Marco Mariani

I can't find a way to emulate the pythonesque "del dict[kw]" within
DTML without rebuilding the dictionary from scratch. May I?


-- 
"This company has performed an illegal operation and will be shut down.
 If the problem persists, contact your vendor or appeal to a higher court."
 - Signal11 on slashdot

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




[Zope] ZOPE ITALIAN Mailing List

2000-05-24 Thread Marco Mariani

Sorry for bothering you. This is a one-time spam. A dozen
people are being mailed in the back (blind carbon copy :-)

I'd like to know if there's a need for an italian Zope list.

Altough I'm OK reading or writing english, such a list could
free some CPU cicles from my brain that I can devote to the
Zen Of Zope or helping newbies.

If somebody is interested, or can host the list, please reply
privately.

Thank you.

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )