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

2005-10-31 Thread Jean-Marc Orliaguet
Wade Leftwich wrote:

 Stephan Richter wrote:



 Why not have those templates on the file system? Is there a need for
 users to modify those templates?


 Yes, users with the job description web producers, which is to say
 people who can do HTML and a bit of scripting, but who do not get
 access to the file system. Kind of like the Zope 2 model. We even use
 acquisition.

 Also, it seemed to me unwieldy to put 50 directories in the filesystem
 to contain the templates for all the sites. But because of my
 experience with Zope 2, I assumed TTW was the best way to customize
 the application for each site, and I guess I should re-examine that
 assumption.

Hi!
there is indeed such a category of users, i.e. somewhere between
filesystem developers and application users. There will be support for
this kind of TTW editing in cpsskins (cf Custom Portlet), but it will be
purely limited to simple presentation  logic.

cf. http://www.z3lab.org/sections/front-page/design-features/custom-portlet

the difference with the Zope2 model I think is that web producers are
not going to be ZPT programmers, but more like site composers with the
ability to do minimal TTW template editing such as shown in the animation.

/JM
___
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-31 Thread Wade Leftwich

Jean-Marc Orliaguet wrote:

Wade Leftwich wrote:



Stephan Richter wrote:




Why not have those templates on the file system? Is there a need for
users to modify those templates?



Yes, users with the job description web producers, which is to say
people who can do HTML and a bit of scripting, but who do not get
access to the file system. Kind of like the Zope 2 model. We even use
acquisition.

Also, it seemed to me unwieldy to put 50 directories in the filesystem
to contain the templates for all the sites. But because of my
experience with Zope 2, I assumed TTW was the best way to customize
the application for each site, and I guess I should re-examine that
assumption.



Hi!
there is indeed such a category of users, i.e. somewhere between
filesystem developers and application users. There will be support for
this kind of TTW editing in cpsskins (cf Custom Portlet), but it will be
purely limited to simple presentation  logic.

cf. http://www.z3lab.org/sections/front-page/design-features/custom-portlet

the difference with the Zope2 model I think is that web producers are
not going to be ZPT programmers, but more like site composers with the
ability to do minimal TTW template editing such as shown in the animation.

/JM




Yes, that's the kind of user I'm talking about, and the Custom Portlet 
tool looks really good. Cool animation, too. I've been planning to check 
out the Z3ECM project, but am trying to get a better grasp of Zope 3 
itself first.


-- Wade Leftwich

___
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-30 Thread Stephan Richter
On Saturday 29 October 2005 20:50, Wade Leftwich wrote:
 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.

Why not have those templates on the file system? Is there a need for users to 
modify those templates?

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

Maybe, I don't know.

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

Again, we do not support TTW development. If you do such experiments that's 
great, but you cannot expect much help.

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-30 Thread Wade Leftwich

Stephan Richter wrote:

On Saturday 29 October 2005 20:50, Wade Leftwich wrote:


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.



Why not have those templates on the file system? Is there a need for users to 
modify those templates?


Yes, users with the job description web producers, which is to say 
people who can do HTML and a bit of scripting, but who do not get access 
to the file system. Kind of like the Zope 2 model. We even use acquisition.


Also, it seemed to me unwieldy to put 50 directories in the filesystem 
to contain the templates for all the sites. But because of my experience 
with Zope 2, I assumed TTW was the best way to customize the application 
for each site, and I guess I should re-examine that assumption.







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



Maybe, I don't know.



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



Again, we do not support TTW development. If you do such experiments that's 
great, but you cannot expect much help.


Well, my project is  _mostly_ filesystem, and only _partly_ TTW. But OK, 
I won't expect much help.




Regards,
Stephan


Thanks
Wade

___
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