[Zope] show filesize in LocalFS

Michael Bleijerveld michael@bleijerveld.nl
Wed, 16 Jul 2003 09:09:12 +0200


Hi John,

I used fileIds() not only for displaying the filesize but also for batching
the output and the use of  'a href' (getting the URL of the file).
With fileValues() is doesn't work.

Greetings.

Michael

----- Original Message ----- 
From: "John Ziniti" <jziniti@speakeasy.org>
To: <zope@zope.org>
Sent: Wednesday, July 16, 2003 12:41 AM
Subject: Re: [Zope] show filesize in LocalFS


> Sorry.  My mistake.  The method is fileValues, not
> fileObjects ... Try the following (I made a few
> modifications to your code:
>
> <dtml-in "admin.fileValues()">
>   <dtml-var id> <dtml-var size missing="oops"><br>
> </dtml-in>
>
> If that works, try this next (I'm not sure about
> using bobobase_modification_time:
>
> <dtml-in "admin.fileValues()">
>   <dtml-var id> <dtml-var "bobobase_modification_time()">  <dtml-var size
missing="oops"><br>
> </dtml-in>
>
> Careful of my typos .... I am in a hurry as I send this
> off and don't have time to check it  :-)
>
> HTH,
>
> JZ
>
>
>
> Michael Bleijerveld wrote:
>
> >Hi,
> >
> >Still receive an error message ''Error Type: AttributeError  Error Value:
> >fileObjects" when using these statements.
> >
> ><dtml-var size missing="oops">
> ><dtml-in "admin.fileObjects()">
> >  <dtml-var sequence-item>  <dtml-var "bobobase_modification_time()">
> ></dtml-in>
> >
> >Michael
> >
> >----- Original Message ----- 
> >From: "John Ziniti" <jziniti@speakeasy.org>
> >To: <zope@zope.org>
> >Sent: Wednesday, July 16, 2003 12:14 AM
> >Subject: Re: [Zope] show filesize in LocalFS
> >
> >
> >
> >
> >>You *did* make sure to use admin.fileObjects() as well,
> >>right?  That's more important.  If you did and are still
> >>getting errors, I would recommend some debugging
> >>stuff that will make sure that the objects you are
> >>iterating are correct.  Also, I don't know if directories
> >>have a "size" attribute, so you may want to catch
> >>that:
> >>
> >><dtml-var size missing="oops">
> >>
> >>Other than that, I am out of ideas.  Things work OK
> >>for me over here ...
> >>
> >>JZ
> >>
> >>
> >>Michael Bleijerveld wrote:
> >>
> >>
> >>
> >>>Hi,
> >>>
> >>>I tried <dtml-var size> but I get the same error.
> >>>
> >>>Regards,
> >>>
> >>>Michael
> >>>
> >>>
> >>>----- Original Message ----- 
> >>>From: "John Ziniti" <jziniti@speakeasy.org>
> >>>To: "Michael Bleijerveld" <michael@bleijerveld.nl>
> >>>Cc: <Zope@zope.org>
> >>>Sent: Tuesday, July 15, 2003 9:16 PM
> >>>Subject: Re: [Zope] show filesize in LocalFS
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>>><dtml-in "admin.fileIds()">
> >>>>><dtml-var sequence-item>  <dtml-var "bobobase_modification_time()">
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>><dtml-var "get_size()">
> >>>
> >>>
> >>>
> >>>
> >>>>></dtml-in>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>"fileIds()" returns only a *list* of files in the directory,
> >>>>in this case "admin".  What you want to use is
> >>>><dtml-in "admin.fileObjects()">.  But I still don't think
> >>>>that "get_size()" is a method of LocalFile objects.  I
> >>>>think you should use <dtml-var size>, which indicates
> >>>>the size of the file in bytes, as returned by
> >>>>"os.stat(path)[stat.ST_SIZE]".
> >>>>
> >>>>HTH,
> >>>>
> >>>>JZ
> >>>>
> >>>>
> >>>>_______________________________________________
> >>>>Zope maillist  -  Zope@zope.org
> >>>>http://mail.zope.org/mailman/listinfo/zope
> >>>>**   No cross posts or HTML encoding!  **
> >>>>(Related lists -
> >>>>http://mail.zope.org/mailman/listinfo/zope-announce
> >>>>http://mail.zope.org/mailman/listinfo/zope-dev )
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>
> >>>_______________________________________________
> >>>Zope maillist  -  Zope@zope.org
> >>>http://mail.zope.org/mailman/listinfo/zope
> >>>**   No cross posts or HTML encoding!  **
> >>>(Related lists -
> >>>http://mail.zope.org/mailman/listinfo/zope-announce
> >>>http://mail.zope.org/mailman/listinfo/zope-dev )
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>_______________________________________________
> >>Zope maillist  -  Zope@zope.org
> >>http://mail.zope.org/mailman/listinfo/zope
> >>**   No cross posts or HTML encoding!  **
> >>(Related lists -
> >> http://mail.zope.org/mailman/listinfo/zope-announce
> >> http://mail.zope.org/mailman/listinfo/zope-dev )
> >>
> >>
> >>
> >>
> >
> >
> >
> >_______________________________________________
> >Zope maillist  -  Zope@zope.org
> >http://mail.zope.org/mailman/listinfo/zope
> >**   No cross posts or HTML encoding!  **
> >(Related lists -
> > http://mail.zope.org/mailman/listinfo/zope-announce
> > http://mail.zope.org/mailman/listinfo/zope-dev )
> >
> >
> >
> >
>
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )
>