Re: [Zope] convert python to dtml
Odesílatel: Exteam <exteam6@yahoo.co.in> hi all, i'm stuck at this point, can some one convert thge following python code in to dtml & help me. i'm not able to convert it in to dtml.
Why do you want to recode into DTML? I think that is piece of good code and much faster than DTML. You could try following replacing (original line of your code, follows with DTML code), but not tested:
rec = context.test_select_sql() <dtml-call "REQUEST.set(rec , test_select_sql())">
print "Fields definitions" Fields definitions
recordset = rec.dictionaries() <dtml-let "recordset = rec.dictionaries()"
rownum = 1 <dtml-call "REQUEST.set(rownum,1)"
for record in recordset: <dtml-in recordset>
print "Row %d" % (rownum), "check", record Row <dtml-var rownum>, check <drml-var sequence-item><br>
rownum = rownum + 1 <dtml-call "REQUEST.set(rownum,rownum+1)" </dtml-in>
and so on on the rest of code.
for key in record.keys(): print key, "=", record[key] print "-" * 80 return printed
Somehow, and not sure how, our session_data objects got deleted. No one admits doing it so no idea what happened. I recreated the objects with the same IDs and even setup the ZODB mount point to point to the right parts. But our SESSION calls won't write the the separate Session.fs storage and it writes every SESION usage to our main Data.fs as an anon transaction. We are on 2.8.10 running ZEO on one server and 5 zope clients on two other servers. The Session.fs file sits along with the Data.fs file but never gets used. Any idea how to reconnect the parts again? Thanks Allen
Allen Schmidt Sr. wrote at 2009-3-5 10:34 -0500:
Somehow, and not sure how, our session_data objects got deleted. No one admits doing it so no idea what happened. I recreated the objects with the same IDs and even setup the ZODB mount point to point to the right parts. But our SESSION calls won't write the the separate Session.fs storage and it writes every SESION usage to our main Data.fs as an anon transaction.
We are on 2.8.10 running ZEO on one server and 5 zope clients on two other servers. The Session.fs file sits along with the Data.fs file but never gets used.
Any idea how to reconnect the parts again?
The so called "session_data_manager" tells Zope where the "session_data" is located. Apparently, your "session_data_manager" does not look at the place of your mount point or your mount point does not work/is not active. First verify the "session_data_manager" configuration (this easy -- look in the ZMI). If this is correct, verify the mount point. That is not so easy. The best way is to start an interactive Python interpreter ("bin/zopectl debug" on *nix). Then use folder = app.unrestrictedTraverse('path_to_folder_containing_the_mount') folder._p_activate() # load the folder folder.__dict__['Id_of_your_mount_point'] You should see an "ZODBMountPoint" (or something along this lines). If you really see a mount point, verify its configuration (that's easy again -- thus, you can do that before the more difficult step): is the mount point really in the storage you want? -- Dieter
I ran the debug to verify the mount point and got this:
folder.__dict__['session_data'] <TransientObjectContainer at session_data>
And in the session_folder object in the root, the session_data objects shows as a TransientObjectContainer and not a ZODB Mount Point. Dieter Maurer wrote:
Allen Schmidt Sr. wrote at 2009-3-5 10:34 -0500:
Somehow, and not sure how, our session_data objects got deleted. No one admits doing it so no idea what happened. I recreated the objects with the same IDs and even setup the ZODB mount point to point to the right parts. But our SESSION calls won't write the the separate Session.fs storage and it writes every SESION usage to our main Data.fs as an anon transaction.
We are on 2.8.10 running ZEO on one server and 5 zope clients on two other servers. The Session.fs file sits along with the Data.fs file but never gets used.
Any idea how to reconnect the parts again?
The so called "session_data_manager" tells Zope where the "session_data" is located.
Apparently, your "session_data_manager" does not look at the place of your mount point or your mount point does not work/is not active.
First verify the "session_data_manager" configuration (this easy -- look in the ZMI). If this is correct, verify the mount point. That is not so easy. The best way is to start an interactive Python interpreter ("bin/zopectl debug" on *nix). Then use
folder = app.unrestrictedTraverse('path_to_folder_containing_the_mount') folder._p_activate() # load the folder folder.__dict__['Id_of_your_mount_point']
You should see an "ZODBMountPoint" (or something along this lines).
If you really see a mount point, verify its configuration (that's easy again -- thus, you can do that before the more difficult step): is the mount point really in the storage you want?
Dieter Maurer wrote:
Allen Schmidt Sr. wrote at 2009-3-5 10:34 -0500:
Somehow, and not sure how, our session_data objects got deleted. No one admits doing it so no idea what happened. I recreated the objects with the same IDs and even setup the ZODB mount point to point to the right parts. But our SESSION calls won't write the the separate Session.fs storage and it writes every SESION usage to our main Data.fs as an anon transaction.
We are on 2.8.10 running ZEO on one server and 5 zope clients on two other servers. The Session.fs file sits along with the Data.fs file but never gets used.
Any idea how to reconnect the parts again?
The so called "session_data_manager" tells Zope where the "session_data" is located.
Apparently, your "session_data_manager" does not look at the place of your mount point or your mount point does not work/is not active.
First verify the "session_data_manager" configuration (this easy -- look in the ZMI). If this is correct, verify the mount point. That is not so easy. The best way is to start an interactive Python interpreter ("bin/zopectl debug" on *nix). Then use
folder = app.unrestrictedTraverse('path_to_folder_containing_the_mount') folder._p_activate() # load the folder folder.__dict__['Id_of_your_mount_point']
You should see an "ZODBMountPoint" (or something along this lines).
If you really see a mount point, verify its configuration (that's easy again -- thus, you can do that before the more difficult step): is the mount point really in the storage you want? I completely missed this response. Still having this issue so going back over this again. Can you identify which things and where for the items above? path_to_folder_containing_the_mount and ID_of_your_mount_point
This is in the zope.conf: <zodb_db session> mount-point /session_folder <zeoclient> server blahblah.com:9999 storage session name session client session var $INSTANCE/var </zeoclient> </zodb_db> This is in the zeo.conf: <filestorage session> path $INSTANCE/var/Session.fs </filestorage> In the ZMI, there are: /session_folder/ ( a regular folder ) session_data ( Transient Object Container ) /session_data_manager ( Session Data Manager ) All the parts seem right but its not working....session writes wind up as anonymous transactions in the main ZODB. Any ideas? Thanks! -Allen
Allen Schmidt Sr. wrote at 2009-8-4 13:45 -0400:
... In the ZMI, there are:
/session_folder/ ( a regular folder ) session_data ( Transient Object Container )
/session_data_manager ( Session Data Manager )
All the parts seem right but its not working....session writes wind up as anonymous transactions in the main ZODB.
Any ideas?
Verify that "session_folder" is a mount point and not a regular folder. This is not trivial as a mount point, once mounted, tries hard to become the mounted object (this happens in its "__of__" method). You must avoid acquisition to check that it is indeed a mount point. One way is to use "app._p_activate(); app.__dict__['session_folder']". This must return a mount point, not a folder. -- Dieter
I verified using your process that it is indeed just a folder. So I deleted the session_folder in the root and then tried to add a ZODB mount point in the root and it showed the session_folder was ready to be created. I made sure that option was checked and clicked Ok. It reloaded the root folder and the new session_folder was there, but it still seems like it is just a regular folder and does not identify itself as a mount point. I also added the session_data object into that folder as a Transient Object Container as it was before. Does the session_data_manager that points to that session_data folder also have to be removed in this process? Could be holding it up somehow?
No. The "session_data" manager contains only the path to the session data. It has nothing to do where the sessions are maintained. You are sure that you have verified via "app.__dict__['temp_folder']" that "temp_folder" is a MountPoint (and have seen it as a normal "Folder")? If you access "temp_folder" normally, it will always look like a normal folder (if mounting was successful). If you have verified correctly, then some magic must have changed your mount point back again to a normal "Folder". I do not know such magic -- therefore, I doubt that your verification was correct. But, you may put your session storage at a different place (say "session_storage") and reconfigure the "session_data_manager" to point to this new place. This way, no magic should be able to modify your mount point. -- Dieter
participants (3)
-
Allen Schmidt Sr. -
Dieter Maurer -
Jaroslav Lukesh