Hi, list,

I am just trying to migrate a existing application from Zope2 to
Zope3, and had to feel around for my ways to do things correctly.

I have following view.pt snippet:

<span tal:replace="context/item_name">Item Name</span>
<p>specification: <span tal:replace="context/specification" /></p>
<p>Price: <span tal:replace="context/sales_price" /></p>

The template is registered like this:

    <browser:page
        for="homemaster.item.interfaces.IItem"
        name="index.html"
        template="view.pt"
        permission="zope.View" />

What I get is output looking this:

卡朗妮专供出口环保型虹吸式连体座便器(坑距300mm)

specification: 720x370x630mm

Price: <security proxied decimal.Decimal instance at 0x899443c>

What does the last line mean? How can I get the numeric value for the
item's price? I defined the three attributes of the item identically,
why only the price is security proxied? Following is the interface
definition:

class IItem(ISQLAlchemyObjectContained):
    """Information about an item"""

    item_name = zope.schema.TextLine(
        title=_(u'Item Name'),
        description=_(u'Name of the item'),
        required=True)

    specification = zope.schema.TextLine(
        title=_(u'Item Specification'),
        description=_(u'Specification of the item'),
        required=True)

    sales_price = zope.schema.Float(
        title=_(u'Sales Price'),
        description=_(u'Sales price of the item'),
        required=True)

For your information, I am using z3c.zalchemy to retrieve the item
object from RDB. Has it anything to do with the security proxy?

Best Regards,

-- 
Hong Yuan

大管家网上建材超市
装修装潢建材一站式购物
http://www.homemaster.cn
_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users

Reply via email to