473,804 Members | 3,038 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Zope: Adding a layer causes valid output to become an object reference?

I've been playing with Zope for about a year and took the plunge last
week into making a product.

To keep it [arguably] simple I used a ZClass to wrap an external
method. My ZClass works and returns the output I expect.

What doesn't work is when I refer to an object I've created from a
dtml-var or a tal:content or tal:replace statement. Instead of the
proper output I receive: <TextileClass at home> where TextileClass is
my class name and home is the Object ID I'm referencing. The fact that
the < and > surround the output make it invisible in the browser and
had me chasing ghosts for a while. I'd bet I'm not groking something
here.

So if I call /home I get the proper HTML output: "<b>What I am looking
for</b>" but when in another object I reference <dtml-var home> I get:
"<TextileCl ass at home>".

Any thoughts are appreciated.

Mike

PS: Yes it is a wrapper for Textile ver 2 and I plan on publishing it.
It is however limited to Zope 2.7+ due to the implementation of Textile
requiring Python 2.3

Jul 18 '05 #1
2 1409
"Junkmail" <ju******@chipw orks.net> writes on 10 Feb 2005 18:26:52 -0800:
I've been playing with Zope for about a year and took the plunge last
week into making a product.
You should send Zope related questions to the Zope mailing list.
You will need to subcribe. You can do this at "http://www.zope.org".
...
What doesn't work is when I refer to an object I've created from a
dtml-var or a tal:content or tal:replace statement. Instead of the
proper output I receive: <TextileClass at home> where TextileClass is
my class name and home is the Object ID I'm referencing.
There is a fundamental difference when you "call" an object
with ZPublisher (i.e. via the Web) and when you use it
in a template.

ZPublisher effectively "calls" "index_html " and if
this is "None", it calls the object.

A template (usually) calls the object (if it is callable) and
then converts the result into a string.
Apparently, your ZInstance is not callable.
Therefore, it is converted into a string.
Apparently, it does not have a custom "__str__",
therefore, you get the standard string conversion for instances
(that's what you see).
The fact that
the < and > surround the output make it invisible in the browser and
had me chasing ghosts for a while. I'd bet I'm not groking something
here.
This should not happen in ZPT (unless you use "structure" ).
So if I call /home I get the proper HTML output: "<b>What I am looking
for</b>" but when in another object I reference <dtml-var home> I get:
"<TextileCl ass at home>".

Any thoughts are appreciated.


Call a method on your ZInstance.

To get the same result as via ZPublisher (the Web),
call its "index_html ". This may need arguments (I do not know).
Dieter
Jul 18 '05 #2
Dieter,

Thanks for the reply. I ran across an article in the Zope FAQ that
nailed the problem on the head. Basically it said the same thing you
are saying. For those that follow in my footsteps one day...

ZPublisher Implicitly calls the method of a url which in the case of a
zclass is a call to index_html. From ZPT and DTML however you must
Explicitly call the method of your zclass, for example:

<dtml-var "get_users.inde x_html()">

The paren () on the end are important!!

To make matters worse my external script references parameters in the
actual object I'm calling, but since I'm not calling a DTML method and
I have to explicitly reference the method I want to call, the DTML
namespace gets shipped to my external method instead of the namespace
of my called object. I read "groking acquisition" 4 times before I
groked it. To fix that I changed the index_html of my zclass to a
python script and call my external script from there so I can pass the
proper namespaces to the external script. I suppose I can do that from
a DTML method, but the python script makes it absolutely clear what the
intention is.

I think the proper thing for the long term is re-write this as a
Product and emulate the way a DTML method accepts a call so I can avoid
all the "blah.index_htm l()" references and provide something a bit less
error prone (more standard).

I'm highly tempted to hack the existing DTML method into a new product
and leave DTML in it so I can combine Textile with DTML in a single
object.

Thanks,

Mike

Jul 18 '05 #3

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

Similar topics

4
2016
by: webmaster | last post by:
Hi, I'm desperatly trying to use Kinfxdb, but I have numerous segmentation faults, who lead my Zope to crash. It mostly occurs when I try to work with "date" fields (with an Informix Online database). I got it here : http://zope.org/Members/papa/ I'm running a RH7.3 Server, with the latest Informix SDK available on IBM website. Any idea ?
27
2019
by: Michele Simionato | last post by:
> Hello, my name is Skip and I am metaclass-unaware. I've been programming in > Python for about ten years and I have yet to write a metaclass. At first I > thought it was just that metaclasses were new to the language, but now as > more and more people use them and proclaim their widespread benefits, I have > come to realize that through years of abuse my brain has become addicted to > classic classes. I began using Python since...
5
2272
by: jsmilan | last post by:
Hi, all; I'm strictly an amateur developer who has dabbled in a half dozen languages on eight or nine systems over 20 years or so. I have never devoted the time or energy to thoroughly learn any one of them, so I have become a true JOATAMON (Jack Of All Trades And Master Of None). I apologize in advance for any truly newb sounding questions. I did Google for this in several places first (Zope.org, Gentoo forums, and Google UseNet...
4
1605
by: Avery Warren | last post by:
I am investigating converting a wiki site to plone. I am having a lot of difficulty finding good documentation programmatically accessing the ZODB API. A lot of the user feedback is centered on how difficult it is to get good documentation on developing using these technologies. My question to comp.lang.python is "what is your opinion of zope?" For those who don't know, zope is a web application server for python developers.
2
3480
by: misower | last post by:
var c = document.getElementById("PanelTree"); // PanelTree is a <div> element! var n = document.createElement("div"); n.setAttribute('id', 'nu'); n.setAttribute('style', 'position:absolute;left:0px;top:0px;'); var tmp2 = document.createTextNode('hello'); n.appendChild(tmp2);
2
3780
by: silversurfer | last post by:
Hello, I am a little unsure whether this method really makes sense. The goal is to add an element to a vector. This is the struct and method I am using: std::vector<Entry> models; struct Entry{ int index; FeatureVector* value;
3
1366
by: waheed azad | last post by:
Hi, I have a been developing an accounting system for a non-profit organization. I had decided to to divide the solution, in three layers, presentation, business layer and database layer. My business layer is composed of objects like Account, Transaction, Voucher etc. And my database layer is composed of objects like AccountDB, TransactionDB, VoucherDB. Now each of my layer is residing in a seperate project under the same solution....
15
1198
by: Jens | last post by:
Hello Everyone. I am relatively new to Zope(using it for a work project) and I was wondering if someone here could help me out or at least refer me to a decent documentationg for Zope/DTML/Python (at the detail level of php.net or Java API reference). http://www.zope.org/Documentation/Books/ZopeBook/2_6Edition/ isn't really detailed enough for my taste. if it doesn't contain a exhautive description of all available base classes it's...
3
9698
by: jehugaleahsa | last post by:
Hello: I am binding a DataGridView with a BindingList<T>, where T is a custom business object that implements INotifyPropertyChanged. When you bind a DataGridView to a DataTable, it has this cool little feature - it will not call DataTable.Rows.Add until after you leave the DataGridView row. This is cool because it lets your user edit the record as much as needed to get it into a valid state before actually adding it to the DataTable.
0
9579
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
10326
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
9143
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
7615
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
6851
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
5520
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3815
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2990
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.