From ColdFusion to Zope: help with <dtml-if>?
Hi, One of our business line developers is used to working with ColdFusion and is struggling, as we all are-:), with Zope. We are literally surrounded with piles of documents, e-books, and e-mail messages "explaining" the different aspects of Zope. We are slowly "getting it" and liking it... However... The developer (and myself) have been trying to figure this out for two days and push is now coming to shove and I'm hoping the list can help. I asked her write down in plain English what she is trying to accomplish and I would post it and see if anyone has a solution or solid direction to pursue. The system she developed publishes hundreds of multipage reports using MS Access and Acrobat (pdf). Access holds the links to every report, they are dated and published throughout a two week cycle. The reports themselves reside on numbered folders on a local drive (e:) In ColdFusion she would do something like, IF Fileexists (001delingprt) then .....and so on through the reports... Here is what she wrote ___________________________________________________________________________ Ok, here it is in plain English... I need to determine if a certain file exists. The filename is located in a certain variable. If it does exist do something, else do something else. For example: Say the file is called e:\test.pdf. This path exists in a variable called vartest If vartest exists then show the current month's file else show last month's file. Hope there's an answer. Sheree Beaudette, AVP Applications Support Analyst Banknorth Group, Commercial Services sbeaudette@banknorth.com Thanks, Bob Campbell Business Line Intranet Development Banknorth Group 207-761-8595 bcampbell@banknorth.com
Dtml has no access to the filesystem. Either put your records into Zope, or write an external method in Python / Perl to do this. Cheers. -- Andy McKay. ----- Original Message ----- From: "Bob Campbell" <rcam@psouth.net> To: <Zope@zope.org> Sent: Wednesday, July 18, 2001 3:51 PM Subject: [Zope] From ColdFusion to Zope: help with <dtml-if>?
Hi, One of our business line developers is used to working with ColdFusion and is struggling, as we all are-:), with Zope. We are literally surrounded with piles of documents, e-books, and e-mail messages "explaining" the different aspects of Zope. We are slowly "getting it" and liking it... However...
The developer (and myself) have been trying to figure this out for two days and push is now coming to shove and I'm hoping the list can help.
I asked her write down in plain English what she is trying to accomplish and I would post it and see if anyone has a solution or solid direction to pursue. The system she developed publishes hundreds of multipage reports using MS Access and Acrobat (pdf). Access holds the links to every report, they are dated and published throughout a two week cycle. The reports themselves reside on numbered folders on a local drive (e:) In ColdFusion she would do something like, IF Fileexists (001delingprt) then .....and so on through the reports... Here is what she wrote
___________________________________________________________________________
Ok, here it is in plain English...
I need to determine if a certain file exists. The filename is located in
a
certain variable. If it does exist do something, else do something else.
For example: Say the file is called e:\test.pdf. This path exists in a variable called vartest
If vartest exists then show the current month's file else show last month's file.
Hope there's an answer.
Sheree Beaudette, AVP Applications Support Analyst Banknorth Group, Commercial Services sbeaudette@banknorth.com
Thanks, Bob Campbell Business Line Intranet Development Banknorth Group 207-761-8595 bcampbell@banknorth.com
_______________________________________________ Zope maillist - Zope@zope.org 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 )
Hi, I'm probably not explaining right, (certainly wouldn't be the first time). She is connecting through an ODBC connection and she can run a select * and pull up all the links for the reports. The links are hardcoded in the db. When, for example, the Zope page is requested it runs the select all query and presents a list with dates and report name.(for 8 banks). That works fine.... The the problem comes in when she has to ask if a link to a file is available (it may or may not be) if it is then put it up, if it isn't, put up the old file. Thanks, Bob ----- Original Message ----- From: "Andy McKay" <andym@ActiveState.com> To: "Bob Campbell" <rcam@psouth.net>; <Zope@zope.org> Sent: Wednesday, July 18, 2001 7:06 PM Subject: Re: [Zope] From ColdFusion to Zope: help with <dtml-if>?
Dtml has no access to the filesystem. Either put your records into Zope, or write an external method in Python / Perl to do this.
Cheers. -- Andy McKay.
----- Original Message ----- From: "Bob Campbell" <rcam@psouth.net> To: <Zope@zope.org> Sent: Wednesday, July 18, 2001 3:51 PM Subject: [Zope] From ColdFusion to Zope: help with <dtml-if>?
Hi, One of our business line developers is used to working with ColdFusion and is struggling, as we all are-:), with Zope. We are literally surrounded with piles of documents, e-books, and e-mail messages "explaining" the different aspects of Zope. We are slowly "getting it" and liking it... However...
The developer (and myself) have been trying to figure this out for two days and push is now coming to shove and I'm hoping the list can help.
I asked her write down in plain English what she is trying to accomplish and I would post it and see if anyone has a solution or solid direction to pursue. The system she developed publishes hundreds of multipage reports using MS Access and Acrobat (pdf). Access holds the links to every report, they are dated and published throughout a two week cycle. The reports themselves reside on numbered folders on a local drive (e:) In ColdFusion she would do something like, IF Fileexists (001delingprt) then .....and so on through the reports... Here is what she wrote
___________________________________________________________________________
Ok, here it is in plain English...
I need to determine if a certain file exists. The filename is located
in a
certain variable. If it does exist do something, else do something else.
For example: Say the file is called e:\test.pdf. This path exists in a variable called vartest
If vartest exists then show the current month's file else show last month's file.
Hope there's an answer.
Sheree Beaudette, AVP Applications Support Analyst Banknorth Group, Commercial Services sbeaudette@banknorth.com
Thanks, Bob Campbell Business Line Intranet Development Banknorth Group 207-761-8595 bcampbell@banknorth.com
_______________________________________________ Zope maillist - Zope@zope.org 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 maillist - Zope@zope.org 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 )
[Bob Campbell]
I'm probably not explaining right, (certainly wouldn't be the first time). She is connecting through an ODBC connection and she can run a select * and pull up all the links for the reports. The links are hardcoded in the db. When, for example, the Zope page is requested it runs the select all query and presents a list with dates and report name.(for 8 banks). That works fine.... The the problem comes in when she has to ask if a link to a file is available (it may or may not be) if it is then put it up, if it isn't, put up the old file.
If the variable is known to exist but might be an empty string, you can test with a <dtml-if>: <dtml-if filevar>...</dtml-if> If the variable might or might not exist, you can look up how to check for the existence of a variable that might be known to a dtml page. If you need to check the file system to see if a named file is actually there, you need to use Python (as others have said) or install the LocalFS product (easy to do). LocalFS knows how to access the file system for you. Cheers, Tom P
This is actually more a Python question, as Zope doesn't deal directly with files in any way. A function which checks for the existence of a file follows: def fileExists(path): import os return os.path.exists(path) and os.path.isfile(path) You'd use this as an external method in Zope like so: <dtml-if "fileExists('/home/chrism/afile')">do soemthing <dtml-else>do something else </dtml-if> In her case, it'd be: <dtml-if "fileExists(varfile)">show current month's file <dtml-else>show last month's file </dtml-if> HTH, - C Bob Campbell wrote:
Hi, One of our business line developers is used to working with ColdFusion and is struggling, as we all are-:), with Zope. We are literally surrounded with piles of documents, e-books, and e-mail messages "explaining" the different aspects of Zope. We are slowly "getting it" and liking it... However...
The developer (and myself) have been trying to figure this out for two days and push is now coming to shove and I'm hoping the list can help.
I asked her write down in plain English what she is trying to accomplish and I would post it and see if anyone has a solution or solid direction to pursue. The system she developed publishes hundreds of multipage reports using MS Access and Acrobat (pdf). Access holds the links to every report, they are dated and published throughout a two week cycle. The reports themselves reside on numbered folders on a local drive (e:) In ColdFusion she would do something like, IF Fileexists (001delingprt) then .....and so on through the reports... Here is what she wrote ___________________________________________________________________________
Ok, here it is in plain English...
I need to determine if a certain file exists. The filename is located in a certain variable. If it does exist do something, else do something else.
For example: Say the file is called e:\test.pdf. This path exists in a variable called vartest
If vartest exists then show the current month's file else show last month's file.
Hope there's an answer.
Sheree Beaudette, AVP Applications Support Analyst Banknorth Group, Commercial Services sbeaudette@banknorth.com
Thanks, Bob Campbell Business Line Intranet Development Banknorth Group 207-761-8595 bcampbell@banknorth.com
_______________________________________________ Zope maillist - Zope@zope.org 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 )
Thanks, she asked about functions and I couldn't give her answer. (We're both going for Python and Zope training) She's a VB progammer, i'm not a programmer at all.. at least not yet. Thanks again, Bob ----- Original Message ----- From: "Chris McDonough" <chrism@digicool.com> To: "Bob Campbell" <rcam@psouth.net> Cc: <Zope@zope.org> Sent: Wednesday, July 18, 2001 7:14 PM Subject: Re: [Zope] From ColdFusion to Zope: help with <dtml-if>?
This is actually more a Python question, as Zope doesn't deal directly with files in any way.
A function which checks for the existence of a file follows:
def fileExists(path): import os return os.path.exists(path) and os.path.isfile(path)
You'd use this as an external method in Zope like so:
<dtml-if "fileExists('/home/chrism/afile')">do soemthing <dtml-else>do something else </dtml-if>
In her case, it'd be:
<dtml-if "fileExists(varfile)">show current month's file <dtml-else>show last month's file </dtml-if>
HTH,
- C
Bob Campbell wrote:
Hi, One of our business line developers is used to working with ColdFusion
and
is struggling, as we all are-:), with Zope. We are literally surrounded with piles of documents, e-books, and e-mail messages "explaining" the different aspects of Zope. We are slowly "getting it" and liking it... However...
The developer (and myself) have been trying to figure this out for two days and push is now coming to shove and I'm hoping the list can help.
I asked her write down in plain English what she is trying to accomplish and I would post it and see if anyone has a solution or solid direction to pursue. The system she developed publishes hundreds of multipage reports using MS Access and Acrobat (pdf). Access holds the links to every report, they are dated and published throughout a two week cycle. The reports themselves reside on numbered folders on a local drive (e:) In ColdFusion she would do something like, IF Fileexists (001delingprt) then .....and so on through the reports... Here is what she wrote
Ok, here it is in plain English...
I need to determine if a certain file exists. The filename is located
in a
certain variable. If it does exist do something, else do something else.
For example: Say the file is called e:\test.pdf. This path exists in a variable called vartest
If vartest exists then show the current month's file else show last month's file.
Hope there's an answer.
Sheree Beaudette, AVP Applications Support Analyst Banknorth Group, Commercial Services sbeaudette@banknorth.com
Thanks, Bob Campbell Business Line Intranet Development Banknorth Group 207-761-8595 bcampbell@banknorth.com
_______________________________________________ Zope maillist - Zope@zope.org 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 maillist - Zope@zope.org 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 )
Thanks to all who replied on this...It is great how this has worked out for us...Andy McKay stopped us from running 'round the wrong circles, Sheree ended up taking Chris McDonough's function and had the system up and running in 10 minutes, (I will give her the security stuff from Troy tomorrow, hopefully it won't be critical on an Intranet...) and I ended up using the LocalFS suggested by Tino to place 90 MS Word forms in Zope. For whatever reason, the forms would not go with FTP or Webdav. I was about to begin loading them 1x1. Thank you, Bob Campbell Banknorth Group 207-761-8595
On Thu, 19 Jul 2001, Bob Campbell wrote:
Thanks to all who replied on this...It is great how this has worked out for us...Andy McKay stopped us from running 'round the wrong circles, Sheree ended up taking Chris McDonough's function and had the system up and running in 10 minutes, (I will give her the security stuff from Troy tomorrow, hopefully it won't be critical on an Intranet...) and I ended up using the LocalFS suggested by Tino to place 90 MS Word forms in Zope. For whatever reason, the forms would not go with FTP or Webdav. I was about to begin loading them 1x1.
Never load 1x1, Bob. You have better things to do w/your life. Look into load_site.py (util script that comes w/Zope) or ZipFolder, which lets you send an entire folder of stuff to Zope in a zip archive. -- Joel Burton <jburton@scw.org> Director of Information Systems, Support Center of Washington
Hi Bob, may be LocalFS http://www.zope.org/Members/jfarr/Products/LocalFS/ Is what you want here. HTH Tino Wildenhain --On Mittwoch, 18. Juli 2001 18:51 -0400 Bob Campbell <rcam@psouth.net> wrote:
Hi, One of our business line developers is used to working with ColdFusion and is struggling, as we all are-:), with Zope. We are literally surrounded with piles of documents, e-books, and e-mail messages "explaining" the different aspects of Zope. We are slowly "getting it" and liking it... However...
The developer (and myself) have been trying to figure this out for two days and push is now coming to shove and I'm hoping the list can help.
I asked her write down in plain English what she is trying to accomplish and I would post it and see if anyone has a solution or solid direction to pursue. The system she developed publishes hundreds of multipage reports using MS Access and Acrobat (pdf). Access holds the links to every report, they are dated and published throughout a two week cycle. The reports themselves reside on numbered folders on a local drive (e:) In ColdFusion she would do something like, IF Fileexists (001delingprt) then .....and so on through the reports... Here is what she wrote _________________________________________________________________________ __
Ok, here it is in plain English...
I need to determine if a certain file exists. The filename is located in a certain variable. If it does exist do something, else do something else.
For example: Say the file is called e:\test.pdf. This path exists in a variable called vartest
If vartest exists then show the current month's file else show last month's file.
Hope there's an answer.
Sheree Beaudette, AVP Applications Support Analyst Banknorth Group, Commercial Services sbeaudette@banknorth.com
Thanks, Bob Campbell Business Line Intranet Development Banknorth Group 207-761-8595 bcampbell@banknorth.com
_______________________________________________ Zope maillist - Zope@zope.org 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 )
participants (6)
-
Andy McKay -
Bob Campbell -
Chris McDonough -
Joel Burton -
Thomas B. Passin -
Tino Wildenhain