Re: [Zope3-Users] /++apidoc++

2005-10-29 Thread Stephan Richter
On Friday 28 October 2005 18:42, Paul Dumais wrote:
 I have installed both the release version and the svn checkout version
 of the latest Zope3. I notice that the /++apidoc++ page is not
 available in the checked out version. It worked fine in the release.
 How can I debug this for my install? I noticed that I did not make an
 instance this time around. Is that important? My tests ran without a
 hitch, so I wonder why this isn't working.

apidoc is only turned on in devmode. Due to my lack of understanding of 
ZConfig, it was turned off by default. I fixed it finally to be turned on 
again. Just update your checkout.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics  Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Help us! Calling a Python Script from ZPT

2005-10-29 Thread Paolo Cilmo
Hello! I've read all the Philipp book and Zope3book.
I've  visited whole zope.org site. In these books and
sites are explained a lot of things, but only for
developing new packages. I need to develop a site
using ZMI (Zope2 typical using) and especially i want
to develop this applications:
1- I've a package with a class and into the class a
method
2- with browser:addMenuItem in zcml i can insert a
package into zmi from add menu
3- I've a Page Template into ZMI
ASK: how i call from the Page Template the script,
passig parameters and to have a response from script?
Please help 






___ 
Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB 
http://mail.yahoo.it
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Help us! Calling a Python Script from ZPT

2005-10-29 Thread Stephan Richter
On Saturday 29 October 2005 11:35, Paolo Cilmo wrote:
 I need to develop a site
 using ZMI (Zope2 typical using) and especially i want
 to develop this applications:

We do not support TTW development.

 1- I've a package with a class and into the class a
 method
 2- with browser:addMenuItem in zcml i can insert a
 package into zmi from add menu
 3- I've a Page Template into ZMI
 ASK: how i call from the Page Template the script,
 passig parameters and to have a response from script?

Why do you need to have this Page Template in ZMI? Why not on the file system?

Regards,
Stephan
-- 
Stephan Richter
CBU Physics  Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Help us! Calling a Python Script from ZPT

2005-10-29 Thread Wade Leftwich

Stephan Richter wrote:

On Saturday 29 October 2005 11:35, Paolo Cilmo wrote:


I need to develop a site
using ZMI (Zope2 typical using) and especially i want
to develop this applications:



We do not support TTW development.



1- I've a package with a class and into the class a
method
2- with browser:addMenuItem in zcml i can insert a
package into zmi from add menu
3- I've a Page Template into ZMI
ASK: how i call from the Page Template the script,
passig parameters and to have a response from script?



Why do you need to have this Page Template in ZMI? Why not on the file system?



I'm working on an application where Page Templates belong in the ZMI, at 
least I think so. The content being displayed is a business directory, 
with suppliers, products, and categories for those products. We will be 
implementing 50 different directories, with the same basic content 
structure but very different designs. Each of those directories will use 
5 or 6 page templates, which go in the ZMI.


It seems like this is a common pattern for content management applications.

Repeating my own posting from 10/9, here's how I made an adapter
to use a file system view with a ZMI template:


class ZPTViewAdapter(ZPTPage):
Adapt a ZPTPage instance to set up its namespace
like zope.app.pagetemplate.viewpagetemplatefile.ViewPageTemplateFile,
so it can be called by a View Class.

implements(IPageTemplateSubclassing)
adapts(ZPTPage)

def __init__(self, ob):
self.ob = ob

def pt_getContext(self, instance, request, **kw):
instance is a View component
namespace = super(ZPTViewAdapter, self).pt_getContext(instance, 
request, **kw)

namespace['nothing'] = None
namespace['template'] = self.ob
namespace['container'] = self.ob.__parent__
namespace['request'] = request
namespace['view'] = instance
namespace['context'] = context = instance.context
namespace['views'] = ViewMapper(context, request)
namespace['options'] = kw
print 'ZPTPage namespace', namespace.keys()
return namespace

def __call__(self, instance, *args, **keywords):
namespace = self.pt_getContext(
request=instance.request,
instance=instance, args=args, options=keywords)
debug_flags = instance.request.debug
s = self.ob.pt_render(
namespace,
showtal=getattr(debug_flags, 'showTAL', 0),
sourceAnnotations=getattr(debug_flags, 'sourceAnnotations', 0),
)
response = instance.request.response
if not response.getHeader(Content-Type):
response.setHeader(Content-Type, self.ob.content_type)
return s


# View class that uses the adapter

class MessageView(object):
A webpage saying hello

def message(self):
return '%s %s!' % (self.context.greeting, self.context.subject)

class KustomView(MessageView):
Pick up a template from parent container if available;
if not, use the filebased one.

def __call__(self):
template = self.context.__parent__.get('kustom.pt')
if template is not None:
template = getAdapter(template, IPageTemplateSubclassing, 
zptViewAdapter)

else:
template = ViewPageTemplateFile('stock.pt')

return template(self)

###

-- Wade Leftwich
Ithaca, NY


___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users