[ZPT] RE: DreamWeaver files - ZPTs: How?

2005-05-23 Thread Ken Winter
Chris -

Thanks for your help.  At the time you sent it, I thought I didn't need it
(because I had learned how to use PUT_FACTORY to get Zope to accept .htm
extensions as ZPTs) - but now I do.  

And it works fine, except for the one more thing it turns out I really need:
to have DW recognize files with NO extension as HTML pages.  The reason I
need this is that Python insists on treating mypage.html as the html
attribute of a mypage object (which of course it can't find) rather than
as a reference to an object named mypage.html.  

I have tried every syntax I can think of to designate an empty string in
those configuration files ('', , and just an empty entry in the list).
But in all cases, when I rename a file (in DW) from mypage.html to
mypage_html and then try to open it, DW says Can't find a valid editor
for this file extension.

Any suggestions?

- Thanks, Ken


 -Original Message-
 From: Chris Beaven [mailto:[EMAIL PROTECTED]
 Sent: Monday, May 09, 2005 9:41 PM
 To: [EMAIL PROTECTED]
 Subject: Re: DreamWeaver files - ZPTs: How?
 
 Ken Winter wrote:
 
  I know you can do it by naming the file in DW with the *.pt extension.
  But the trouble with this is, subsequently DreamWeaver doesn't recognize
  it as anything that it can edit.
 
 
 Here's how to make DW work with pt, zpt, dtm and dtml extensions
 
 
 Open Program Files\Macromedia\Dreamweaver MX
 2004\Configuration\DocumentTypes\MMDocumentTypes.xml
 
 
 Change:
   documenttype id=HTML internaltype=HTML
 winfileextension=htm,html,shtml,shtm,stm,tpl,lasso,xhtml
 macfileextension=htm,html,shtml,shtm,tpl,lasso,xhtml
 file=Default.html writebyteordermark=false
 To:
   documenttype id=HTML internaltype=HTML
 winfileextension=htm,html,shtml,shtm,stm,tpl,lasso,xhtml,pt,zpt
 macfileextension=htm,html,shtml,shtm,tpl,lasso,xhtml,pt,zpt
 file=Default.html writebyteordermark=false
 
 
 
 
 Open Documents and Settings\{USERNAME}\Application
 Data\Macromedia\Dreamweaver MX 2004\Configuration\Extensions.txt
 
 
 Add the first line from:
 
 HTM,HTML,SHTM,SHTML,HTA,HTC,XHTML,STM,SSI,JS,AS,ASC,ASR,XML,XSL,XSD,DTD,XS
 LT,RSS,RDF,LBI,DWT,ASP,ASA,ASPX,ASCX,ASMX,CONFIG,CS,CSS,CFM,CFML,CFC,TLD,T
 XT,PHP,PHP3,PHP4,PHP5,TPL,LASSO,JSP,JSF,VB,VBS,VTM,VTML,INC,JAVA,EDML,WML:
 All
 Documents
 
 To:
 
 HTM,HTML,SHTM,SHTML,HTA,HTC,XHTML,STM,SSI,JS,AS,ASC,ASR,XML,XSL,XSD,DTD,XS
 LT,RSS,RDF,LBI,DWT,ASP,ASA,ASPX,ASCX,ASMX,CONFIG,CS,CSS,CFM,CFML,CFC,DTM,D
 TML,TLD,TXT,PHP,PHP3,PHP4,PHP5,PT,TPL,LASSO,JSP,JSF,VB,VBS,VTM,VTML,INC,JA
 VA,EDML,WML,ZPT:All
 Documents
 
 
 
 Add these lines (After ...:HTML Documents line is good):
 
 DTM,DTML:Zope DTML Documents
 PT,ZPT:Zope Page Templates


___
ZPT mailing list
ZPT@zope.org
http://mail.zope.org/mailman/listinfo/zpt


RE: [ZPT] RE: DreamWeaver files - ZPTs: How?

2005-05-23 Thread Ken Winter
 -Original Message-
 From: Ian Bicking [mailto:[EMAIL PROTECTED]
 Sent: Monday, May 23, 2005 4:53 PM
 To: [EMAIL PROTECTED]
 Cc: 'Chris Beaven'; zpt@zope.org
 Subject: Re: [ZPT] RE: DreamWeaver files - ZPTs: How?
 
 Ken Winter wrote:
  Chris -
 
  Thanks for your help.  At the time you sent it, I thought I didn't need
 it
  (because I had learned how to use PUT_FACTORY to get Zope to accept .htm
  extensions as ZPTs) - but now I do.
 
  And it works fine, except for the one more thing it turns out I really
 need:
  to have DW recognize files with NO extension as HTML pages.  The reason
 I
  need this is that Python insists on treating mypage.html as the html
  attribute of a mypage object (which of course it can't find) rather
 than
  as a reference to an object named mypage.html.
 
 Instead of obj.mypage.html, use obj['mypage.html']
 
I'm afraid this doesn't work.  Here's the Python script, with the suggested
syntax in the last line:

d = [{'person_id':p.person_id,\
  'first_name':p.first_name,\
  'middle_names':p.middle_names,\
  'last_name':p.last_name}\
 for p in context.read_all_people()]
return context['studentlist.htm'](data=d)

This gets the error message:

Site Error
An error was encountered while publishing this resource.
Error Type: KeyError
Error Value: 'studentlist.htm'

The same thing happens if I rename the ZPT as 'studentlist_htm and use this
syntax.  The only version that works is this:

return context.studentlist_htm(data=d)

...which of course gets back to the original problem: DW doesn't handle
extension-less files.  

Any suggestions?

- Thanks, Ken


___
ZPT mailing list
ZPT@zope.org
http://mail.zope.org/mailman/listinfo/zpt


Re: [ZPT] RE: DreamWeaver files - ZPTs: How?

2005-05-23 Thread Ian Bicking

Ken Winter wrote:

Instead of obj.mypage.html, use obj['mypage.html']



I'm afraid this doesn't work.  Here's the Python script, with the suggested
syntax in the last line:

d = [{'person_id':p.person_id,\
  'first_name':p.first_name,\
  'middle_names':p.middle_names,\
  'last_name':p.last_name}\
 for p in context.read_all_people()]
return context['studentlist.htm'](data=d)

This gets the error message:

Site Error
An error was encountered while publishing this resource.
Error Type: KeyError
Error Value: 'studentlist.htm'

The same thing happens if I rename the ZPT as 'studentlist_htm and use this
syntax.  The only version that works is this:

return context.studentlist_htm(data=d)


This is the realm of things I don't understand well, but I think 
obj.value uses a somewhat different lookup algorithm (using Acquisition) 
than obj['value'].  Try getattr(context, 'studentlist.htm').


--
Ian Bicking  /  [EMAIL PROTECTED]  /  http://blog.ianbicking.org
___
ZPT mailing list
ZPT@zope.org
http://mail.zope.org/mailman/listinfo/zpt


Re: [ZPT] RE: DreamWeaver files - ZPTs: How?

2005-05-23 Thread Phillip Hutchings
 I'm afraid this doesn't work.  Here's the Python script, with the suggested
 syntax in the last line:
 
 d = [{'person_id':p.person_id,\
   'first_name':p.first_name,\
   'middle_names':p.middle_names,\
   'last_name':p.last_name}\
  for p in context.read_all_people()]
 return context['studentlist.htm'](data=d)
 
 This gets the error message:
 
 Site Error
 An error was encountered while publishing this resource.
 Error Type: KeyError
 Error Value: 'studentlist.htm'
 
 The same thing happens if I rename the ZPT as 'studentlist_htm and use this
 syntax.  The only version that works is this:
 
 return context.studentlist_htm(data=d)
 
 ...which of course gets back to the original problem: DW doesn't handle
 extension-less files.
 
 Any suggestions?

The problem being that Python uses . as the object hierarchy
separator. Personally, I use a real text editor for Zope work.

This code works however, unless you have some oddball version of Zope.
It'll give nasty errors if studentlist.html doesn't exist, but there
you go.
getattr(context, studentlist.html)(data=d)

-- 
Phillip Hutchings
http://www.sitharus.com/
[EMAIL PROTECTED] / [EMAIL PROTECTED]
___
ZPT mailing list
ZPT@zope.org
http://mail.zope.org/mailman/listinfo/zpt