Thanks Derek, Paul, and Cameron. I appreciate the help. I created the EVENT_LOG_FILE environment variable and then took the "s" off "constructors" and I did get an error in the log. It really helps to know where to look and I appreciate the time you guys took to respond. I'm still running into confusing errors. I have a form that adds a new user that looks like this; <dtml-in valid_roles> <dtml-if expr="_vars['sequence-item'] != 'Anonymous'"> Zope is giving me this; Error Type: SyntaxError Error Value:Line 2:"_vars" is an invalid variable name because it starts with "_" The lines are coming out of The Zope Book. I went over the file twice to see if I had mistyped something but I don't see anything. Is the book wrong? There's nothing in my class called _vars so I assume this is supposed to be internal to Zope. Does anyone know what I might be doing wrong? I'm not very good at typing things in so I've ended up with a lot of typos. I can find and fix them pretty easily but I've noticed that my changes don't get loaded into zope automatically. I restart zope but the original syntax error stays unless I delete the product before I restart. Is there an easier way to force the product to reload? Thanks again for the help.
On Sat, 2003-11-22 at 15:57, Goldthwaite, Joe wrote:
Thanks Derek, Paul, and Cameron. I appreciate the help. I created the EVENT_LOG_FILE environment variable and then took the "s" off "constructors" and I did get an error in the log. It really helps to know where to look and I appreciate the time you guys took to respond.
I'm still running into confusing errors. I have a form that adds a new user that looks like this;
<dtml-in valid_roles> <dtml-if expr="_vars['sequence-item'] != 'Anonymous'">
Here's what you really want: <dtml-in valid_roles prefix=role> <dtml-if "role_item != 'Anonymous'"> The basic problem is that "sequence-item" is not a valid name in Python... it will be interpreted as "seguence minus item" and those probably aren't names you've initialized. The underscore/bracket syntax is a way of working around this problem, but a pretty weak one. You're far better off, IMO, getting in the habit of using the prefix attribute of <dtml-in>. It allows you to nest loops and ensures that all your loop variables are valid Python names. HTH, Dylan
Goldthwaite, Joe wrote:
I'm still running into confusing errors. I have a form that adds a new user that looks like this;
<dtml-in valid_roles> <dtml-if expr="_vars['sequence-item'] != 'Anonymous'">
Zope is giving me this; Error Type: SyntaxError Error Value:Line 2:"_vars" is an invalid variable name because it starts with "_"
The lines are coming out of The Zope Book. I went over the file twice to see if I had mistyped something but I don't see anything. Is the book wrong? There's nothing in my class called _vars so I assume this is supposed to be internal to Zope. Does anyone know what I might be doing wrong?
I don't deal much with DTML so I may be a little rusty, but probably it meant:: <dtml-in valid_roles> <dtml-if expr="_['sequence-item'] != 'Anonymous'"> The underscore is the namespace variable. So this syntax looks up the value with key 'sequence-item' in the namespace.
I'm not very good at typing things in so I've ended up with a lot of typos. I can find and fix them pretty easily but I've noticed that my changes don't get loaded into zope automatically. I restart zope but the original syntax error stays unless I delete the product before I restart. Is there an easier way to force the product to reload?
If you're working on a Product, a restart should re-parse all the code. I've never seen it work any other way. You should also look at the Product refresh functionality. Put a 'refresh.txt' in your product directory and when you visit the Product in the control panel, you can refresh it under the 'Refresh' tab. No restart required: it's great. --jcc -- "My point and period will be throughly wrought, Or well or ill, as this day's battle's fought."
Thanks Dylan. And thanks again Paul and Cameron. First I need to apologize for saying that the example comes from The Zope Book. It's actually from The Book of Zope from No Starch Press. For some reason, I keep calling it The Zope Book. Does anyone know where I can get printed copy of The Zope Book? Amazon and Barnes & Noble have it but the publish date is from 2001. Is a newer version available? Changing _vars['sequence-item'] to _['sequence-item'] fixed my. I guess there's a typo in The Book of Zope. I checked their web site for updates before I posted my questions but there was nothing. I guess I'm the only one who has tried the sample since the book was published in 2001! Dylan, your suggestion; <dtml-in valid_roles prefix=role> <dtml-if "role_item != 'Anonymous'"> is helpful. Neither The Book of Zope or the Zope Web Application Construction Kit had any information on the prefix attribute. Luckily, the Zope Bible documents it. After reading it over, I understand what your saying here. Thanks. I'm still having problems where changes to the DTML files in my project are not showing up in Zope. I added the refresh.txt file to the project directory but refreshing still isn't bringing in the changes. Here's an example, I have a new_EISUser.dtml file in my project\public subdirectory. Edit the file externally and change the dtml to dtmx, I can refresh the project, restart Zope, manually start and stop the Zope service, or even reboot the machine but the change doesn't not show up in Zope. If I delete my instance of the product and then restart Zope, the change comes in. Could it be the cache isn't refreshing correctly? Or maybe it has something to do with running Zope under Windows? Is this a problem with external dtml files stored in a project? Joe Goldthwaite
Goldthwaite, Joe wrote:
First I need to apologize for saying that the example comes from The Zope Book. It's actually from The Book of Zope from No Starch Press. For some reason, I keep calling it The Zope Book. Does anyone know where I can get printed copy of The Zope Book? Amazon and Barnes & Noble have it but the publish date is from 2001. Is a newer version available?
I think there hasn't been a reprint of the Zope Book (as from zope.org), even though the newer versions are much enhanced.
... I'm still having problems where changes to the DTML files in my project are not showing up in Zope. I added the refresh.txt file to the project directory but refreshing still isn't bringing in the changes. Here's an example, I have a new_EISUser.dtml file in my project\public subdirectory. Edit the file externally and change the dtml to dtmx, I can refresh the project, restart Zope, manually start and stop the Zope service, or even reboot the machine but the change doesn't not show up in Zope. If I delete my instance of the product and then restart Zope, the change comes in.
Could it be the cache isn't refreshing correctly? Or maybe it has something to do with running Zope under Windows? Is this a problem with external dtml files stored in a project?
Well, that's a different story, and I think I can explain it. DTML documents are stored as objects in Zope, as you can probably tell from the way they're used, and once created don't refer back to their on-disk sources. So you must destroy and recreate such a thing in order to see any changes. If a DTML object is stored as an attribute of the class, DTML objects with the behaviour of the filesystem code at the time of instantiation will persist in that instance. I suspect you're doing this. Create them instead as attributes of the module, which is destroyed on Zope shutdown and re-run on startup (or refresh). Or it could be your browser cache. --jcc -- "My point and period will be throughly wrought, Or well or ill, as this day's battle's fought."
On Mon, 2003-11-24 at 10:25, Goldthwaite, Joe wrote:
Does anyone know where I can get printed copy of The Zope Book? Amazon and Barnes & Noble have it but the publish date is from 2001. Is a newer version available?
The latest version is here: http://www.zope.org/Documentation/Books/ZopeBook/2_6Edition/view There's also a PDF version if you want to print it.
I'm still having problems where changes to the DTML files in my project are not showing up in Zope. I added the refresh.txt file to the project directory but refreshing still isn't bringing in the changes. Here's an example, I have a new_EISUser.dtml file in my project\public subdirectory. Edit the file externally and change the dtml to dtmx, I can refresh the project, restart Zope, manually start and stop the Zope service, or even reboot the machine but the change doesn't not show up in Zope. If I delete my instance of the product and then restart Zope, the change comes in.
You should ensure that the names of your DTMLFile objects are *class* variables, not instance variables (i.e., they're defined at the same indentation level as your class "def" statements). Defining them as instance variables (e.g. in __init__) is the only thing I could think of that would produce the behavior you describe. And don't change the .dtml suffix... that's required. If that doesn't do it, some more detail about how you're coding and calling your dtml objects would be helpful. HTH, Dylan
On Sat, Nov 22, 2003 at 04:57:58PM -0700, Goldthwaite, Joe wrote:
I'm still running into confusing errors. I have a form that adds a new user that looks like this;
<dtml-in valid_roles> <dtml-if expr="_vars['sequence-item'] != 'Anonymous'">
Zope is giving me this; Error Type: SyntaxError Error Value:Line 2:"_vars" is an invalid variable name because it starts with "_"
The lines are coming out of The Zope Book.
OK, that's a mistake in the Zope Book, as Dylan and J have pointed out. Can you find the appropriate spot in the online Zope Book and add a comment? The comments are really useful for the editors. If/when there is another release of the zope book, we can fix it. -- Paul Winkler http://www.slinkp.com Look! Up in the sky! It's NOT SO NINJA HEAD! (random hero from isometric.spaceninja.com)
participants (4)
-
Dylan Reinhardt -
Goldthwaite, Joe -
J. Cameron Cooper -
Paul Winkler