473,406 Members | 2,710 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,406 software developers and data experts.

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:
"<TextileClass 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 1391
"Junkmail" <ju******@chipworks.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:
"<TextileClass 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.index_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_html()" 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
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...
27
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...
5
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...
4
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...
2
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',...
2
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...
3
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. ...
15
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...
3
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...
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: 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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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,...
0
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...

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.