473,782 Members | 2,507 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1811
On Saturday 22 October 2005 12:34 pm, ry********@gmai l.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 anansispacework s.com )
Anansi Spaceworks http://www.anansispaceworks.com

Oct 22 '05 #2
ry********@gmai l.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
1561
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 The Zope Book 2.6 quickly. My problem is that I am confused where to start. I am giving a brief account of what I want to do. I have Identified Following class stuucture.
9
1604
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 which will ontain info like start time & end for task & task description. There will be different projects with different employees & approvers Also I need to genrate reports like timesheet for an employee for this particular week or month.Or...
0
2131
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 X-Trace: fe12.lga 1108528794 24.46.113.251 (Tue, 15 Feb 2005 21:39:54 MST) NNTP-Posting-Date: Tue, 15 Feb 2005 21:39:54 MST Xref: number1.nntp.dca.giganews.com comp.lang.python:398656
0
2399
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 entity manager), I keep getting the following... Exception in thread "AWT-EventQueue-0" javax.persistence.PersistenceException: No Persistence provider for EntityManager named ReceiptingPU: The following providers:...
0
9641
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10146
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9944
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8968
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7494
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6735
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3643
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.