473,383 Members | 1,876 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Zope and Persistence

I don't know if this is the appropriate place to post a Zope question
but I figure many here are familiar with it. I'm confused about the
role of the ZMI when it comes to development. I want to write a simple
script that logs page hits. I wrote it in what was called a Script
(Python) resource in the ZMI. When I access the page it gives an error
saying that this file cannot import Persistence, etc. This makes sense
but where would I put this script and how would I invoke it? It is only
supposed to store an integer in Data.fs. Thanks.

Oct 22 '05 #1
2 1785
On Saturday 22 October 2005 12:34 pm, ry********@gmail.com wrote:
I don't know if this is the appropriate place to post a Zope question
but I figure many here are familiar with it.
You will do much better to use the Zope users' mailing list. Go to
zope.org and follow the mailing lists link to sign up.
I'm confused about the
role of the ZMI when it comes to development. I want to write a simple
script that logs page hits. I wrote it in what was called a Script
(Python) resource in the ZMI. When I access the page it gives an error
saying that this file cannot import Persistence, etc.
Python scripts are NOT Python modules, and you should not have to
import anything to make use of persistence. Objects you manipulate
using the ZMI interface are pretty much always objects in the ZODB
database (anything that shows up as an "object" or a "property" in
the ZMI is a persistent object).

What you want to do is add an integer "property" to the folder containing
the script (i.e. "context" or "container", depending on whether you want
to maintain a count in the directory from which the script is called,
or one unique counter where the script is stored). That's your counter.

Also, be sure to follow the "help" link in the ZMI and use the online
API documentation.
This makes sense
but where would I put this script and how would I invoke it? It is only
supposed to store an integer in Data.fs. Thanks.


If you actually needed imports and access to the internal ZODB machinery,
then you would need to write a "Product", not work in the ZMI at all.

But you don't.

Cheers,
Terry

--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks http://www.anansispaceworks.com

Oct 22 '05 #2
ry********@gmail.com wrote:
I don't know if this is the appropriate place to post a Zope question
Nope. You'd better use the zope mailing-list for this.

<OT> but I figure many here are familiar with it. I'm confused about the
role of the ZMI when it comes to development.
As it's name implies, the ZMI is a *management* interface. Real Zope
developpement is better made with filesystem "Products" (Zope components).
I want to write a simple
script that logs page hits.
That's a typical case of reinventig the square wheel. Ever looked at
<you-zope-instance-folder-here>/log/Z2.log ? It's an apache-like access
log. And there are a whole lot of tools for building stats from apache
access logs.

I wrote it in what was called a Script
(Python) resource in the ZMI. When I access the page it gives an error
saying that this file cannot import Persistence, etc.
Why would you import Persistence in a Python Script ? This is already a
persistent object.
This makes sense
but where would I put this script
Whereever seems to fit - this depends on your application.
and how would I invoke it?
Like any other Zope object.
It is only
supposed to store an integer in Data.fs. Thanks.


This is another problem, and I think you'd better start with the zope book.

But for you current use case, first have a look at Zope's access log.
</OT>

--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'o****@xiludom.gro'.split('@')])"
Oct 24 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: mir nazim | last post by:
Hi, I am a PHP deleloper. i am currently studying Zope and want to migrate to it. I have developped a school management system in PHP. but now I want to implement it in Zope. I have worked through...
9
by: john | last post by:
Hi I am developing a timesheet system. It will have 3 levels of access 1)Administrator 2)Approver -- Will approve or reject the timesheet filled by employees 3)Employees -- Fill in the timesheet...
0
by: Unigroup of New York | last post by:
Content-Type: multipart/mixed; boundary="------------C465DF38DCB38DD2AF7117E0" Lines: 327 Date: Tue, 15 Feb 2005 23:36:38 -0500 NNTP-Posting-Host: 24.46.113.251 X-Complaints-To: abuse@cv.net...
0
myusernotyours
by: myusernotyours | last post by:
Hi all, Am trying to create a Java Desktop App that uses Java Persistence in Netbeans. The database is MS Access but I tried with Mysql and got the same error. When I run the app( Create the...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.