[Zope-dev] dtml-try with z-sql
Hi all, I have DTML-Method like below dtml-try dtml-call deleteUser(USERNAME=USERNAME) dtml-except An error occurred. Entry was bNOT/b deleted. /dtml-try deleteUser is Z-SQL method.USERNAME is the argument in Z-SQL method also column name. When i click erase button it succesfully deletes record.But if i enter an invalid username it did not throw any exceptions. Please help REgards ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] dtml-try with z-sql
I'm not familiar with DTML, I would like to: deleteUser(USERNAME=invalid USERNAME) Does not throw an exception, Should be judged through a function return value. 2013/2/1 murat bilal murat.bi...@gmail.com Hi all, I have DTML-Method like below dtml-try dtml-call deleteUser(USERNAME=USERNAME) dtml-except An error occurred. Entry was bNOT/b deleted. /dtml-try deleteUser is Z-SQL method.USERNAME is the argument in Z-SQL method also column name. When i click erase button it succesfully deletes record.But if i enter an invalid username it did not throw any exceptions. Please help REgards ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope ) ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] dtml-try with z-sql
I'm not familiar with DTML. In my opinion: deleteUser(USERNAME=invalid USERNAME) Does not throw an exception, Should be judged through a function return value. 2013/2/1 Jian Aijun jianai...@gmail.com I'm not familiar with DTML, I would like to: deleteUser(USERNAME=invalid USERNAME) Does not throw an exception, Should be judged through a function return value. 2013/2/1 murat bilal murat.bi...@gmail.com Hi all, I have DTML-Method like below dtml-try dtml-call deleteUser(USERNAME=USERNAME) dtml-except An error occurred. Entry was bNOT/b deleted. /dtml-try deleteUser is Z-SQL method.USERNAME is the argument in Z-SQL method also column name. When i click erase button it succesfully deletes record.But if i enter an invalid username it did not throw any exceptions. Please help REgards ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope ) ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] dtml-try with z-sql
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 02/01/2013 04:27 AM, murat bilal wrote: I have DTML-Method like below dtml-try dtml-call deleteUser(USERNAME=USERNAME) dtml-except An error occurred. Entry was bNOT/b deleted. /dtml-try deleteUser is Z-SQL method.USERNAME is the argument in Z-SQL method also column name. When i click erase button it succesfully deletes record.But if i enter an invalid username it did not throw any exceptions. This issue is unrelated to DTML / ZSQLMethods. SQL statements like the following:: DELETE FROM some_table WHERE id = 123; don't cause exceptions to be raised for an unknown value like 123; they just affect no rows. If you need an error raised, you need to do something like create a stored procedure on the server which does that. Tres. - -- === Tres Seaver +1 540-429-0999 tsea...@palladion.com Palladion Software Excellence by Designhttp://palladion.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with undefined - http://www.enigmail.net/ iEYEARECAAYFAlEL7m8ACgkQ+gerLs4ltQ5uVgCfYRw7x3XAfwsdoFkJCNZm1U3H DKgAoLT358rI08s8GMwanffFV4jT4f8Y =StFb -END PGP SIGNATURE- ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] dtml-sendmail issue
Hi, I tried to send mail through SMTP localhost using dtml-sendmail. It was working fine for many days. Currently it is not sending mails. Could you please provide me pointers to debug this issue? Thanks, Lakshmi ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] dtml-sendmail issue
Break the problem up. First thing to do is to check if sendmail is working from the file system. on unix mail m...@mydomain.com If that breaks, you know what to fix. If that works, double check your configurations on your mailhost object. And finally try just a 3 line sendmail file. I have used dtml-sendmail a lot over the years. As far as I know it has always worked fine. Trust it, but not the code you have written, and you should be able to get it fixed quickly. -- Regards Christopher Lozinski Check out my iPhone apps TextFaster and EmailFaster http://textfaster.com Expect a paradigm shift. http://MyHDL.org ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] DTML is dead, long live DTML ;-)
Hi, For AGX3, we started to use Jinja for the template, for example for the generation of setup.py, we have: version = '{{version}}' setup(name='{{project}}', version=version, description={{description}}, ... The syntax is simpler than dtml we use in AGX2: dtml-var description Vincent On Sun, Sep 5, 2010 at 5:13 AM, Tim Hoffman zutes...@gmail.com wrote: Hi Florian I use a model based generation approach (from enterprise architect) however even archgenxml has templates for large amounts of boiler plate under the hood. Have you actually looked at the src of archgenxml, if you did you will notices it uses dtml for templating the code output ;-) ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] DTML is dead, long live DTML ;-)
HI Vincent. I haven't looked an jinja to date. Will definately have a look at it. I generate a lot of code (sql, gae models, storm schema, formish schema's) from Enterprise Architect, and currently using dtml for all non html/xml output. Cheers T On Sun, Sep 5, 2010 at 3:35 PM, Vincent Fretin vincent.fre...@gmail.comwrote: Hi, For AGX3, we started to use Jinja for the template, for example for the generation of setup.py, we have: version = '{{version}}' setup(name='{{project}}', version=version, description={{description}}, ... The syntax is simpler than dtml we use in AGX2: dtml-var description Vincent On Sun, Sep 5, 2010 at 5:13 AM, Tim Hoffman zutes...@gmail.com wrote: Hi Florian I use a model based generation approach (from enterprise architect) however even archgenxml has templates for large amounts of boiler plate under the hood. Have you actually looked at the src of archgenxml, if you did you will notices it uses dtml for templating the code output ;-) ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] DTML is dead, long live DTML ;-)
On 5 September 2010 02:49, Tim Hoffman zutes...@gmail.com wrote: Please note that DTML is a dead (and horrid) technology. Martin But zpt is horrible for doing non html/xml based things ;-), What do you think is good alternative in the zope eco system now for templating other types of things (sql, python ...) ? If you don't need conditions or looping, then string.Template from the standard library is a reasonable choice. For templating SQL I would use SQLAlchemy, as you want appropriate quoting applied to your input. (You don't have to use it's ORM). Laurence ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] DTML is dead, long live DTML ;-)
On Sun, Sep 05, 2010 at 11:13:05AM +0800, Tim Hoffman wrote: Hi Florian I use a model based generation approach (from enterprise architect) however even archgenxml has templates for large amounts of boiler plate under the hood. Have you actually looked at the src of archgenxml, if you did you will notices it uses dtml for templating the code output ;-) Once did, but wasn't aware of any dtml, come to think of it, there is some reason to it ;) -- Florian Friesdorf f...@chaoflow.net GPG FPR: EA5C F2B4 FBBB BA65 3DCD E8ED 82A1 6522 4A1F 4367 Jabber/XMPP: f...@chaoflow.net IRC: chaoflow on freenode,ircnet,blafasel,OFTC pgp9485K58h0p.pgp Description: PGP signature ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] DTML is dead, long live DTML ;-)
On Sun, Sep 5, 2010 at 1:28 PM, Tim Hoffman zutes...@gmail.com wrote: So I was looking for zope eco system based non html/xml based templating systems as a response to Martin saying DTML is dead, as I am currently using DTML for these sorts of tasks. The Zope eco system for such tasks is the same as the wider Python eco system these days. There's absolutely no need to stick with a Zope-only approach anymore. string.Template, Jinja2 and Mako all seem to be well maintained templating solutions you could use. DTML is definitely dead as far as open-source software can die. Hanno ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] DTML is dead, long live DTML ;-)
Please note that DTML is a dead (and horrid) technology. Martin But zpt is horrible for doing non html/xml based things ;-), What do you think is good alternative in the zope eco system now for templating other types of things (sql, python ...) ? T ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] DTML is dead, long live DTML ;-)
On Sun, Sep 05, 2010 at 08:49:39AM +0800, Tim Hoffman wrote: Please note that DTML is a dead (and horrid) technology. Martin But zpt is horrible for doing non html/xml based things ;-), What do you think is good alternative in the zope eco system now for templating other types of things (sql, python ...) ? I would use a templating system for things that are easy to template (html/xml) and where more complex logic can be offloaded to a real programming language like python (as zpt does). Using a templating system for a programming language is I think a different programming paradigm than zope's component architecture and contrary to code reusage. With code generators like ArchGenXML or agx you are able to create models for your software on a more abstract level than based on templating, so I would not use templating but model-based code generation instead. florian -- Florian Friesdorf f...@chaoflow.net GPG FPR: EA5C F2B4 FBBB BA65 3DCD E8ED 82A1 6522 4A1F 4367 Jabber/XMPP: f...@chaoflow.net IRC: chaoflow on freenode,ircnet,blafasel,OFTC pgpD9QHMx5IZs.pgp Description: PGP signature ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] DTML is dead, long live DTML ;-)
Hi Florian I use a model based generation approach (from enterprise architect) however even archgenxml has templates for large amounts of boiler plate under the hood. Have you actually looked at the src of archgenxml, if you did you will notices it uses dtml for templating the code output ;-) T On Sun, Sep 5, 2010 at 9:11 AM, Florian Friesdorf f...@chaoflow.net wrote: On Sun, Sep 05, 2010 at 08:49:39AM +0800, Tim Hoffman wrote: Please note that DTML is a dead (and horrid) technology. Martin But zpt is horrible for doing non html/xml based things ;-), What do you think is good alternative in the zope eco system now for templating other types of things (sql, python ...) ? I would use a templating system for things that are easy to template (html/xml) and where more complex logic can be offloaded to a real programming language like python (as zpt does). Using a templating system for a programming language is I think a different programming paradigm than zope's component architecture and contrary to code reusage. With code generators like ArchGenXML or agx you are able to create models for your software on a more abstract level than based on templating, so I would not use templating but model-based code generation instead. florian -- Florian Friesdorf f...@chaoflow.net GPG FPR: EA5C F2B4 FBBB BA65 3DCD E8ED 82A1 6522 4A1F 4367 Jabber/XMPP: f...@chaoflow.net IRC: chaoflow on freenode,ircnet,blafasel,OFTC ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] dtml-sqlgroup bounty
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hello, We are offering another modest bounty. 3. Add dtml-comma to dtml-sqlgroup dtml-sqlgroup allows groups of SQL terms to be applied to SELECT statements but unfortunately it cannot be used with UPDATE. A patch was written to add this support in August 2000. Given the age of the patch it may need to be updated and unit tests will also be required. Collector issue: http://www.zope.org/Collectors/Zope/1118 Developer list: http://mail.zope.org/mailman/listinfo/zope-dev Requirements: A bounty of $200 is offered for getting this patch checked into Zope. Status: Open See also: http://www.logicalware.org/bounties.html Peter - -- Logicalware Ltd, tel +44 (0)131 273 5130, http://www.logicalware.com/ Stuart House, Eskmills, Station Road, Musselburgh EH21 7PQ, UK -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.1 (Darwin) iD8DBQFDKpOPX+DsMm00fs0RAlwHAJ9Uv1b3k7sj5B/U3Xths7wa05lU1QCgpXaC 5OuGyZ90BssnJkEYsXtZ104= =mGiB -END PGP SIGNATURE- ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] DTML
On Tue, 2004-03-02 at 18:24, Fábio Bruno wrote: Dear Sir or Madamme We are working with zope at school, it was proppoused to us to do an imobiliary site and we like to know who we can do a for cicle or repeat to search in our document whow many houses where added. Your's faithfully, Fábio Bruno Hi, please notice that this list if for discussion of the development _of_ the zope application server. not for using it. First, consider using Zope Page Templates instead of DTML. There is a good tutorial in the Zope 2.7 release that you can leverage which tells you about tal:repeat. There is also a site from brasil that tells about zope: www.tchezope.org where you will get support from a community in your native language. Regards, Christian -- Christian Theune, gocept gmbh co. kg http://www.gocept.com - [EMAIL PROTECTED] fon: 03496 3099112 fax: 03496 3099118 mobile: 0179 7808366 signature.asc Description: This is a digitally signed message part ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] DTML
Dear Sir or Madamme We are working with zope at school, it was proppoused to us to do an imobiliary site and we like to know who we can do a for cicle or repeat to search in our document whow many houses where added. Your's faithfully, Fábio Bruno _ MSN Hotmail, o maior webmail do Brasil. http://www.hotmail.com ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] dtml to zpt conversion-please help
Hi, dtml-in "Catalog.searchResults({'meta_type':'Workitem', 'status':['active','inactive','fallout'], 'pull_roles':acl_users.getUser(REQUEST['worker']).getRoles()}) +Catalog.searchResults({'meta_type':'Workitem', 'status':['active','inactive','fallout'],'actor':worker})" sort=status,instance_id we are facing problem to convert the above dtml code to zpt code. How do we convert this to zpt? please help us, Thanks, Exteam SMS using the Yahoo! Messenger; Download latest version.
Re: [Zope-Coders] Re: [Zope-dev] DTML and REQUEST data changes about to be checked in
On Wed, Aug 14, 2002 at 04:25:09PM -0400, Brian Lloyd wrote: So here's what we'll do. Zope 2.6 will include the string tainting changes, enabled by default. The tainting can be turned off by providing an environment variable. The next Zope 2.5.x release will contain the tainting code, but it will be *disabled* by default. If you are worried about the issues it addresses, you will be able to enable it explicitly using an environment variable (without having to upgrade to 2.6). I checked in the changes for 2.5; auto quoating now has to be enabled with an environment variable. Higly recommended! -- Martijn Pieters | Software Engineer mailto:[EMAIL PROTECTED] | Zope Corporation http://www.zope.com/ | Creators of Zope http://www.zope.org/ - ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] DTML and REQUEST data changes about to be checked in
Like I said before, this is probably a good feature. If it was available as a patch then I would probably use it on a number of my sites, and would recommend it to others. I would be very happy see it (or something like it) in 2.7. But not 2.6. Then Jim wrote: WRT to this change, now that I'm back from vacation, I want to talk to Brian about it. ;) Hear ye, hear ye :^) Zope 2.6 is a second-dot release, meaning that it is expected that there will be new features and that it is possible (though we always try to avoid it) that some things can break in the name of progress. (See http://dev.zope.org/CVS/ZopeReleasePolicy for more details). Zope 2.5.x will be a third-dot release, intended to be bug-fix only (and thus not allowed to break things). So here's what we'll do. Zope 2.6 will include the string tainting changes, enabled by default. The tainting can be turned off by providing an environment variable. The next Zope 2.5.x release will contain the tainting code, but it will be *disabled* by default. If you are worried about the issues it addresses, you will be able to enable it explicitly using an environment variable (without having to upgrade to 2.6). 2.7 and later releases will behave as 2.6. Brian Lloyd[EMAIL PROTECTED] V.P. Engineering 540.361.1716 Zope Corporation http://www.zope.com ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] DTML and REQUEST data changes about to be checkedin
Jim Fulton wrote: The plan is to release 2.6 as soon as we can. We're really busy with a bunch of customer work and haven't had as much time to work on this as we'd like. Well actually this is more comforting than if you had a lot of time on your hands ;-) regards Max M -- Sorry I would Really Like To Help More On This Project, But Am To Busy Doing Paid Work On A Tight Deadline Max M ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-Coders] Re: [Zope-dev] DTML and REQUEST data changesaboutto be checked in
Dieter Maurer wrote: Adrian Hungate writes: We should avoid sending the wrong message by making a hotfix for every little thing. Shane I'd like to second this. It was one of the contibuting factors in the decision of my former employers to opt for spectra instead of a Zope solution (That already existed!!). I, in contrary, appreciate the openess and fast response with respect to security problems. I do not install most hotfixes because the vulnerabilities do not affect our sites but it is a good feeling that there are fast fixes when this would be once the case. In some way we need to make it clear that most hotfixes don't matter for most sites. A lot of hotfixes ensured that users who could write DTML couldn't get extra privileges. They really only mattered for sites like zope.org, where anyone with an email address is allowed to write code that will be executed directly on the server. But: 1) most Zope sites give a high level of trust to DTML authors anyway. There was no way to exploit most of the security holes without the ability to write DTML that runs on the server. 2) even a Zope administrator is still quite limited. In a standard setup, a Zope admin can't read/write arbitrary files or execute scripts. 3) Zope doesn't run as root. Even if someone found a way to get console access through a Zope admin account, they would have to exploit some other security hole to get root access. We need to make it clear that there are several layers of security, and only a single layer has ever had a problem AFAIK. Shane ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-Coders] Re: [Zope-dev] DTML and REQUEST data changes about to be checked in
On Friday 09 Aug 2002 4:33 pm, Tres Seaver wrote: Whithout the fix, virtually every Zope site in the world is vulnerable to URL-based cross-site scripting exploits. For instance, any URL which contains invalid form variable marshalling can generate an error page which includes the erroneous value, unquoted. E.g.: URL:http://somezopesite.com/looks/like/legitimate?foo:int=%3Cscript%3Ealer t('Owned')%3C/script%3E Do you plan to fix this bug? Or, with the autoquoting changes, is this to be reclassified as 'not a bug'? ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-Coders] Re: [Zope-dev] DTML and REQUEST data changesabout to be checked in
I'd like to second this. It was one of the contibuting factors in the decision of my former employers to opt for spectra instead of a Zope solution (That already existed!!). I, in contrary, appreciate the openess and fast response with respect to security problems. I do not install most hotfixes because the vulnerabilities do not affect our sites but it is a good feeling that there are fast fixes when this would be once the case. In some way we need to make it clear that most hotfixes don't matter for most sites. A lot of hotfixes ensured that users who could write DTML couldn't get extra privileges. They really only mattered for sites like zope.org, where anyone with an email address is allowed to write code that will be executed directly on the server. But: You are exactly right... but... The problem is not one of clarity of labling, it's one of targetting: The people that actually make this level of decision (i.e. board level execs) are not techies, and are just not interested in _why_ the fix is needed, or in _what_ technical problem it fixes, but that ZC (visibly) releases 'n' fixes per month for Zope, while M$ (visibly) releases less than that number per year for IIS/ASP - Therefore, Zope must be the less stable/reliable product etc? The logic is flawed, we all know that, but who is volunteering to visit every companies senior execs worldwide and spend the time to make them care enough? The hotfixes, and new releases need to be marketted (I use that word loosely) quite differently, new releases are A Good Thing(tm), while the fixes need to be under the hood where the execs won't be bothered by them, but the techies can find them when they need them. I appologise, in advance, for the sweeping generalization that all execs are like Dilbert's pointy-haired boss, but some really are! Adrian... -- Adrian Hungate EMail: [EMAIL PROTECTED] Web: http://www.haqa.co.uk ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-Coders] Re: [Zope-dev] DTML and REQUEST data changes about to be checked in
On Mon, Aug 12, 2002 at 03:51:24PM +0100, Toby Dickenson wrote: On Friday 09 Aug 2002 4:33 pm, Tres Seaver wrote: Whithout the fix, virtually every Zope site in the world is vulnerable to URL-based cross-site scripting exploits. For instance, any URL which contains invalid form variable marshalling can generate an error page which includes the erroneous value, unquoted. E.g.: URL:http://somezopesite.com/looks/like/legitimate?foo:int=%3Cscript%3Ealer t('Owned')%3C/script%3E Do you plan to fix this bug? Or, with the autoquoting changes, is this to be reclassified as 'not a bug'? Together with the autoquoting changes, I tightened Exception messages; data from REQUEST is quoted where I could reasonably suspect REQUEST data was used. -- Martijn Pieters | Software Engineer mailto:[EMAIL PROTECTED] | Zope Corporation http://www.zope.com/ | Creators of Zope http://www.zope.org/ - ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] DTML and REQUEST data changes about to be checked in
Jeffrey P Shell wrote: On 8/9/02 8:43 AM, Toby Dickenson [EMAIL PROTECTED] wrote: ... Like I said before, this is probably a good feature. If it was available as a patch then I would probably use it on a number of my sites, and would recommend it to others. I would be very happy see it (or something like it) in 2.7. But not 2.6. Oh, 2.6 will never happen anyways ;) (seriously folks - what's the plan?). The plan is to release 2.6 as soon as we can. We're really busy with a bunch of customer work and haven't had as much time to work on this as we'd like. It's likely that 2.7 will come out at around the same time as 2.6. See http://dev.zope.org/Wikis/DevSite/Projects/SupportPython22/VisionStatement. WRT to this change, now that I'm back from vacation, I want to talk to Brian about it. ;) Jim -- Jim Fulton mailto:[EMAIL PROTECTED] Python Powered! CTO (888) 344-4332http://www.python.org Zope Corporation http://www.zope.com http://www.zope.org ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] DTML and REQUEST data changes about to be checked in
On Thursday 08 Aug 2002 9:29 pm, Martijn Pieters wrote: On Thu, Aug 08, 2002 at 08:19:12PM +0100, Toby Dickenson wrote: I am about to land some big changes in the way DTML deals with data taken from the REQUEST object when accessed implicitly, in both the Zope Trunk and the Zope 2.5 branch. In my opinion this change is completely unacceptable at this late stage of the release cycle. As you said: These changes could potentially break existing Zope sites. The existing behavior might be flawed, but it is a flaw we have all lived with for a long time. In my opinion this needs: 1. To be deferred until the 2.7 cycle. 2. A detailed fishbowl proposal. Note that the problems fixed are potential security problems. Although we cannot fix every site out there for sure, the fixes certainly dramatically reduce the risks. Im not going to argue that this feature is bad - because I dont believe that to be true. I suspect the feature is not exactly quite right - but those issues can easily be resolved over a full release cycle. The risk for breakage is very small really Your choice of '' and html_quote suggests that my dtml code which generates javascript and vbscript carries a higher risk than dtml which generates html. , and breakage will generally only occur when someone is trying to exploit the weakness, not in normal operation of the site. The fact that your change uses html_quote to 'fix' the problem rather than sounding 'hacker alert' alarm bells suggests to me that you dont really believe that ;-) I'll leave any decisions on wether or not this stays in the current release cycles or moves to 2.7 to Jim Fulton. He is unfortunately on cvacation until next week. ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] DTML and REQUEST data changes about to be checked in
On Fri, Aug 09, 2002 at 09:56:45AM +0100, Toby Dickenson wrote: The risk for breakage is very small really Your choice of '' and html_quote suggests that my dtml code which generates javascript and vbscript carries a higher risk than dtml which generates html. Only if you generated that script using data from the REQUEST, implicitly. Which was bad in the first place. , and breakage will generally only occur when someone is trying to exploit the weakness, not in normal operation of the site. The fact that your change uses html_quote to 'fix' the problem rather than sounding 'hacker alert' alarm bells suggests to me that you dont really believe that ;-) Again, the wide scope of DTML use would make such bells warble prematurely all too often. The normal, recommended fix for the general weakness is to always use HTML quote. -- Martijn Pieters | Software Engineer mailto:[EMAIL PROTECTED] | Zope Corporation http://www.zope.com/ | Creators of Zope http://www.zope.org/ - ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] DTML and REQUEST data changes about to be checked in
On Friday 09 Aug 2002 3:12 pm, Martijn Pieters wrote: On Fri, Aug 09, 2002 at 09:56:45AM +0100, Toby Dickenson wrote: The risk for breakage is very small really Your choice of '' and html_quote suggests that my dtml code which generates javascript and vbscript carries a higher risk than dtml which generates html. Only if you generated that script using data from the REQUEST, implicitly. Yes Which was bad in the first place. I agree it is true in most cases, but not all. Have you analysed how many applications will be broken by this? how they can detect the breakage? I certainly will not have time to assess the implications on my applications before the scheduled release of 2.6. , and breakage will generally only occur when someone is trying to exploit the weakness, not in normal operation of the site. The fact that your change uses html_quote to 'fix' the problem rather than sounding 'hacker alert' alarm bells suggests to me that you dont really believe that ;-) Again, the wide scope of DTML use would make such bells warble prematurely all too often. 'all too often' also contradicts your statements that this will not happen in normal operation of the site, and that the risk of breakage is 'very small'. Like I said before, this is probably a good feature. If it was available as a patch then I would probably use it on a number of my sites, and would recommend it to others. I would be very happy see it (or something like it) in 2.7. But not 2.6. ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-Coders] Re: [Zope-dev] DTML and REQUEST data changesabout to be checked in
On Fri, 2002-08-09 at 10:43, Toby Dickenson wrote: On Friday 09 Aug 2002 3:12 pm, Martijn Pieters wrote: On Fri, Aug 09, 2002 at 09:56:45AM +0100, Toby Dickenson wrote: The risk for breakage is very small really Your choice of '' and html_quote suggests that my dtml code which generates javascript and vbscript carries a higher risk than dtml which generates html. Only if you generated that script using data from the REQUEST, implicitly. Yes Which was bad in the first place. I agree it is true in most cases, but not all. Have you analysed how many applications will be broken by this? how they can detect the breakage? I certainly will not have time to assess the implications on my applications before the scheduled release of 2.6. , and breakage will generally only occur when someone is trying to exploit the weakness, not in normal operation of the site. The fact that your change uses html_quote to 'fix' the problem rather than sounding 'hacker alert' alarm bells suggests to me that you dont really believe that ;-) Again, the wide scope of DTML use would make such bells warble prematurely all too often. 'all too often' also contradicts your statements that this will not happen in normal operation of the site, and that the risk of breakage is 'very small'. Like I said before, this is probably a good feature. If it was available as a patch then I would probably use it on a number of my sites, and would recommend it to others. I would be very happy see it (or something like it) in 2.7. But not 2.6. Martijn did add a knob to turn the feature off, via a new environment variable. With a security vulnerability, we have to come up with some kind of balance between the need to propagate the fix as quickly as possible and the need (as you point out) not to disrupt production sites unduly. I don't believe we can afford to wait a whole other release cycle for this fix; Brian, Jim, and Martijn deemed the fix too pervasive to be bundled as a hotfix, which offers us little choice except to included it in current releases. Whithout the fix, virtually every Zope site in the world is vulnerable to URL-based cross-site scripting exploits. For instance, any URL which contains invalid form variable marshalling can generate an error page which includes the erroneous value, unquoted. E.g.: URL:http://somezopesite.com/looks/like/legitimate?foo:int=%3Cscript%3Ealert('Owned')%3C/script%3E Tres. -- === Tres Seaver[EMAIL PROTECTED] Zope Corporation Zope Dealers http://www.zope.com ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-Coders] Re: [Zope-dev] DTML and REQUEST data changesaboutto be checked in
Tres Seaver wrote: Whithout the fix, virtually every Zope site in the world is vulnerable to URL-based cross-site scripting exploits. For instance, any URL which contains invalid form variable marshalling can generate an error page which includes the erroneous value, unquoted. E.g.: URL:http://somezopesite.com/looks/like/legitimate?foo:int=%3Cscript%3Ealert('Owned')%3C/script%3E I think an URL with an inconspicuous mispelling of the domain name is a far greater vulnerability than cross-site-scripting. Consider: http://barnesandnohle.com/freebooks.html An attacker could set up that misleading domain name then spam people to order free books, requiring credit card info for some book-of-the-month trick. Some simple scraping of the true site would keep most people from ever thinking there was a problem. In fact, you don't even have to misspell it: http://barnes-andnoble.com/freebooks.html This affects the entire web and every piece of software involved in it. I just want to keep the security worries in check. Let me ramble for a bit... We've released a lot of hotfixes, but *none* of the vulnerabilities could give an attacker root access, and none of them could give console access to anonymous users AFAIK. All of the vulnerabilities violated Zope's security policy, but Zope's security policy is constrained by system security and other safeguards. People outside the Zope community don't know that, so a lot have labeled Zope as too insecure to use. The reality is that we've never even had an exploitable buffer overrun. :-) We should avoid sending the wrong message by making a hotfix for every little thing. Shane ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] DTML and REQUEST data changes about to be checkedin
On 8/9/02 8:43 AM, Toby Dickenson [EMAIL PROTECTED] wrote: I agree it is true in most cases, but not all. Have you analysed how many applications will be broken by this? how they can detect the breakage? I certainly will not have time to assess the implications on my applications before the scheduled release of 2.6. This is why I raised the flag of can there be a way to disable it?, and Martijn put a fix in: - dtml-var name and dtml.-name; will now automatically HTML-quote unsafe data taken implictly from the REQUEST object. Data taken explicitly from the REQUEST object is not affected, as well as any other data not originating from REQUEST. This can be disabled (at your own risk!) by setting the environment variable ZOPE_DTML_REQUEST_AUTOQUOTE to one of 'no', '0', or 'disabled'. I have the same concerns you do, but I figure that if any problems are found during normal execution of any Zope release this is attached to that I don't have time to investigate a fix for myself, I can add this environment variable (which normally I am not fond of doing), restart, and make a note investigate fixing site blablabla. Is there any reason why this solution wouldn't work for you? Like I said before, this is probably a good feature. If it was available as a patch then I would probably use it on a number of my sites, and would recommend it to others. I would be very happy see it (or something like it) in 2.7. But not 2.6. Oh, 2.6 will never happen anyways ;) (seriously folks - what's the plan?). Since there's no current release plan for 2.6, it's hard to plan future deployments around it anyways. But if you have any sites you plan to move to 2.6, you should test this Autoquote change aggressively during the alpha/beta cycle. Since the ZOPE_DTML_REQUEST_AUTOQUOTE change has been put in, I've reserved future judgments until I get a chance to actually do some testing. I know that if I do run into any issues in the future that I don't have time to deal with, I can just flip that switch off. -- Jeffrey P Shell www.cuemedia.com ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] DTML and REQUEST data changes about to be checked in
On Thu, Aug 08, 2002 at 08:19:12PM +0100, Toby Dickenson wrote: I am about to land some big changes in the way DTML deals with data taken from the REQUEST object when accessed implicitly, in both the Zope Trunk and the Zope 2.5 branch. In my opinion this change is completely unacceptable at this late stage of the release cycle. As you said: These changes could potentially break existing Zope sites. The existing behavior might be flawed, but it is a flaw we have all lived with for a long time. In my opinion this needs: 1. To be deferred until the 2.7 cycle. 2. A detailed fishbowl proposal. Note that the problems fixed are potential security problems. Although we cannot fix every site out there for sure, the fixes certainly dramatically reduce the risks. The risk for breakage is very small really, and breakage will generally only occur when someone is trying to exploit the weakness, not in normal operation of the site. I'll leave any decisions on wether or not this stays in the current release cycles or moves to 2.7 to Jim Fulton. He is unfortunately on cvacation until next week. -- Martijn Pieters | Software Engineer mailto:[EMAIL PROTECTED] | Zope Corporation http://www.zope.com/ | Creators of Zope http://www.zope.org/ - ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] DTML and REQUEST data changes about to be checked in
The way I see it is this: ZPT has (amongst others) the very nice property that it's trivial to audit ZPT pages for non-quoted string output: just grep for 'structure'. OTOH in DTML there's no way to do that, the default is unquoted output. dtml-stuff; is a good step, but there's way too much code out there that doesn't take proper security precautions and is vulnerable to cross-site scripting attacks. The fact that namespaces are implicit and make it possible to get stuff from where we don't expect them doesn't help. We should always keep in mind the security debacle that PHP has become, because it didn't take proper precautions for quoting (reports on Bugtraq of XSS attacks in some PHP application practically every week). There's magic_quotes_gpc or magic_quotes_runtime that automatically quotes their equivalent of REQUEST or even any output from outside applications, but it's a PITA because it does too much and is often inconvenient, so a lot of users turn it off or forget to turn it on. And it's too much magic. The solution Martijn implemented has a number of nice properties, for instance protecting those that do dtml-var foo, and will only leave open the applications that really didn't take the most basic security precautions (unfortunately I'm sure there are some out there, doing stuff like a href=dtml-var REQUEST.foodtml-var REQUEST.footitle/a). So in a code audit all dtml-var [expr=]xxx should be suspect, and dtml-.xxx; too. Florent -- Florent Guillaume, Nuxeo (Paris, France) +33 1 40 33 79 87 http://nuxeo.com mailto:[EMAIL PROTECTED] ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] DTML and REQUEST data changes about to be checked in
Likewise Im trying to digest all that and Im a little suprised. More magic in DTML? Not something I'd vote for normally. Im a little confused why this is suddenly an issue, yeah so we pull a string out of the REQUEST and thanks to DTML stack we may not know where it came from. Well thats always been there. And yeah the string may contain nasty HTML. Again that's always been there. In the past (and I cant find posts to show it) the party line was Zope is an application server and its up to the person developing the application to worry about it. Thats why ChrisW wrote stripogram and I use it in quite a few apps. One other question? Why does it matter that the string is implicitly called, why dont you taint explicitly called to? It makes me think of Perl where taint mode taints anything coming from the user? This still doesnt solve the party line and means I would like to suggest again (and this time I have the time to work on it) that we add something like stripogram or similar to the core, so that is easy for an application developer to have access to strip html and other functions from products, DTML, Python Scripts etc to easily alter, manage and make HTML safer. -- Andy McKay @gmweb Consulting http://www.agmweb.ca ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] DTML and REQUEST data changes about to be checked in
On Fri, Aug 02, 2002 at 08:55:13AM -0700, Andy McKay wrote: Likewise Im trying to digest all that and Im a little suprised. More magic in DTML? Not something I'd vote for normally. Im a little confused why this is suddenly an issue, yeah so we pull a string out of the REQUEST and thanks to DTML stack we may not know where it came from. Well thats always been there. And yeah the string may contain nasty HTML. Again that's always been there. In the past (and I cant find posts to show it) the party line was Zope is an application server and its up to the person developing the application to worry about it. Thats why ChrisW wrote stripogram and I use it in quite a few apps. Yup. And that is still the case. However, the combination of implict REQUEST form interpolation and no HTML quoting turns out to especially dangerous, because of those situations where you *want* no HTML quoting for optional information that normally should *not* come from the REQUEST. An example is the Zope help system; there are API help pages that have optional information, which when present is already HTML. But when not present in the object hierarchy, but it *is* available in the REQUEST, the REQUEST data is used instead. The way standard_error_message deals with exceptions is another such a situation. The DTML author didn't expect the particular template slot to be filled with REQUEST data, the slot is optional, and the author has no way of preventing REQUEST data from being used. The solution we choose fixes that problem, for all existing DTML as well as future DTML. Note that ZPT does not have this problem, as it quotes by default and doesn't use implict namespaces. One other question? Why does it matter that the string is implicitly called, why dont you taint explicitly called to? It makes me think of Perl where taint mode taints anything coming from the user? Because, as explained above, its the implicit case that is dangerous. In the explicit case you are supposed to know you are working with unsafe data and thus the old rules apply. If we explicitly quoted, we hurt everyone that either did the right thing from the start and/or already knows they are playing with fire. This still doesnt solve the party line and means I would like to suggest again (and this time I have the time to work on it) that we add something like stripogram or similar to the core, so that is easy for an application developer to have access to strip html and other functions from products, DTML, Python Scripts etc to easily alter, manage and make HTML safer. The CMF now includes a basic HTML stripper. In future iterations, Tres Seaver expects this to evolve into a CMF Tool that is more generaly configurable and useable. -- Martijn Pieters | Software Engineer mailto:[EMAIL PROTECTED] | Zope Corporation http://www.zope.com/ | Creators of Zope http://www.zope.org/ - ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] DTML and REQUEST data changes about to be checked in
Hi folks, I am about to land some big changes in the way DTML deals with data taken from the REQUEST object when accessed implicitly, in both the Zope Trunk and the Zope 2.5 branch. These changes could potentially break existing Zope sites. Without these changes, Zope is somewhat vulnerable to cross-scripting attacks, where a well-crafted URL can cause a Zope server to serve out arbitrary HTML. Because DTML does not automatically html quote any data, and can implicitly get information out of the REQUEST even when it was not the intention of the template author, it is easy to cause REQUEST data to be rendered as HTML on a page. My changes cause the REQUEST to keep track of suspected strings, where suspect is defined as any string with a ''. These are marked as tainted. Any normal, explicit access to the REQUEST will still give you normal values. However, as soon as a DTML template requests a variable from the general namespace, and this variable is then satisfied from the REQUEST, the value of this variable could potentially be a TaintedString object instead of the original string. When rendering such a value, DTML will automatically HTML quote it if not already done so explicitly. All DTML string operations dealing with TaintedString objects are careful to retain the TaintedString status. I also fixed all exceptions raised in Zope that I could find, where untrusted REQUEST data was used in the exception message; these exceptions now html quote the data. I also made sure that the REQUEST calculated variables URLx and BASEx and such were not shadowed by untrusted form variables of the same name. These changes can break existing sites in the following ways: - If you relied on getting HTML-like data from the REQUEST in DTML and want to render this as HTML, and you got this data implicitly, this data will now be HTML quoted. Note that you were vulnerable to a cross-scripting attack here already. You can retrieve your information from the REQUEST directly (with dtml-with REQUEST for example), at your own risk. ;) - HTML quoting will also take place in templates that do not otherwise generate HTML to be sent back to the browser, such as email forms and Z SQL Methods. For Z SQL Methods, dtml-sqlvar does not quote TaintedStrings and is otherwise ignorant of them. For emails, use explicit access to REQUEST instead. - If you relied on being able to override URLx or BASEx variables through a form variable, this no longer works. Use explicit access to REQUEST.form instead. - Using the string method .join (''join(items)) cannot handle TaintedString objects. You can use _.string.join instead. - Passing a TaintedString value from a DTML template to other objects such as Python code, External Methods, Python Scripts, etc, may cause them to break because they did not anticipate a TaintedString object. What doesn't break (among others): - Accessing REQUEST data from Python code, Python scripts, or ZPT. Only DocumentTemplate.DT_String derivatives (DTML Document, DTML Method, etc) and DTMLFile objects are affected. - If you already HTML quoted, nothing gets double quoted. - Using the _.string module in DTML retains taints. - Zope 2.6 unicode marshalling (var:ustring:utf8) works with TaintedStrings as well. TaintedString objects try to mimic strings as best as they can, but until we move to python 2.2 definitely and we can inherit from str directly, certain python code will not accept TaintedString objects as substitutes. I found that the normal string module, and the string ''.join module don't accept TaintedString objects for example. Also, using the string interpolation operator % will cause TaintedString objects to be unwrapped. When TaintedString becomes a subclass of str, more operations will unwrap them, such as unicode() and ''.join; or just about any operation that manipulates strings through other ways than string methods. Because of size of the change and the impact on existing DTML code, well release betas of Zope 2.5 and 2.6 soon to facilitate wider testing. For those following CVS, please test the changes rigorously and let me know what you find. -- Martijn Pieters | Software Engineer mailto:[EMAIL PROTECTED] | Zope Corporation http://www.zope.com/ | Creators of Zope http://www.zope.org/ - ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] DTML Document textarea edit
Hi! I want to suggest a modification for the DTML Document/Method dtml-file documentEdit.dtml On default the textarea will be displayd with wrap=off . If I imported XML-Files without line breaks it is difficult to edit the files via DTML-Webfrontend. A property wrapmode could solve this: documentEdit.dtml: textarea name=data:text wrap=dtml-if wrapmodedtml-var wrapmodedtml-else off/dtml-if style=width: 100%;dtml-if dtpref_cols cols=dtml-var dtpref_colsdtml-else cols=50/dtml-ifdtml-if dtpref_rows rows=dtml-var dtpref_rowsdtml-else rows=20/dtml-ifdtml-var __str__/textarea Regards, Dirk ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] dtml-mime and MIME-Version
(I report this here because the bug collector is down) Having some problems sending attachements with dtml-sendmail, I have been reported that the bug is: dtml-mime doesn't generate MIME-Version: 1.0 header. Such a header is required by MIME in order to recognize the message as MIME message and not an old RFC822 message. Apparently, many mail readers are not as strict and recognize a MIME message even if the Mime-Version header is missing. pine seems to be strict dtml-mime should generate the MIME-Version header. -- __o _ \_ (_)/(_) Saludos de Julián EA4ACL -.- ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] DTML sqltest tag and python expr. Bug in Zope Book?
On Thu, 28 Jun 2001 22:42:13 +0200 (CEST) Dieter Maurer [EMAIL PROTECTED] wrote: I expect that dtml-sqltest does not support the expr attribute due to its optional. It is not easy to define the semantics of optional for arbitrary expressions. True, but you already found a possible answer: Your example seems to suggests, that you would like the tag to be omitted, when the expression raise a NameError. But, in fact, it is not clear whether this is anticipated by optional or a serious problem (maybe deep in the expression) that should be reported. To overcome that problem, I think it would make sense to treat the optional like this: when the expression raises a NameError, if the variable name that caused the error is an expected argument of the ZSQLMethod, then this argument was not provided, so do not render the sqltest tag. Otherwise, we have a real error. In a pythonish algorithm, that would look like this: try: renderedExpr = eval(expr) except NameError, varName: if varName in ZSQLMethodArguments: # optional behavior for missing variable pass else: # We have a real error raise NameError, varName else: # render sqltest tag ... Do you think that makes sense? -- Yves-Eric Martin [EMAIL PROTECTED] ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] DTML sqltest tag and python expr. Bug in Zope Book?
Yves-Eric Martin writes: I expect that dtml-sqltest does not support the expr attribute due to its optional. It is not easy to define the semantics of optional for arbitrary expressions. To overcome that problem, I think it would make sense to treat the optional like this: when the expression raises a NameError, if the variable name that caused the error is an expected argument of the ZSQLMethod, then this argument was not provided, so do not render the sqltest tag. Otherwise, we have a real error. In a pythonish algorithm, that would look like this: try: renderedExpr = eval(expr) except NameError, varName: if varName in ZSQLMethodArguments: # optional behavior for missing variable pass else: # We have a real error raise NameError, varName else: # render sqltest tag ... Do you think that makes sense? If I were a purist, I would answer: no. The name error could come from a nested call that incidentally uses the same name for a variable as a request argument. If I were a Zope maintainer, I would answer: no. The feature is rarely used and if it is, there is a way to do it with existing DTML means: As you demonstrated: dtml-if XXX dtml-sqltest ... /dtml-if does work, although it is not really nice -- but not too bad, either. If I would need this feature extensively, I would privately enhance Zope as necessary. I learned yesterday, how to use cvs import/checkout/update to keep such private enhancements across Zope upgrades. But your point was: The feature is used in the Zope book, thus, apparently, it was useful. The question: why not implement the feature rather than change the book. Maybe, DC says something about this Dieter ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] DTML sqltest tag and python expr. Bug in Zope Book?
Hello everyone, I was recently working on a quite big ZSQL method (around 100 lines). I was using only dtml-if and dtml-sqlvar tags and a lot of like '%...%', so thought I could make things look much nicer using dtml-sqlgroup and dtml-sqltest ... op=like optional. But I ran into a big hurdle: I quickly searched through the archive and found the thread [Zope-dev] ZSQL using LIKE operator, and in particular: http://lists.zope.org/pipermail/zope-dev/2001-February/009339.html which is exactly what I would like to do. But unfortunately, dtml-sqltest ... does not seem to work. We get the following error: The ... shorthand for expr was used in a tag that doesn't support expr attributes., for tag dtml-sqltest [...] I checked sqltest.py (Zope 2.3.2): no support for python expr in there. Interestingly, the Zope Book mentions the use of python expressions with sqltest in its DTML Reference: http://www.zope.org/Members/michel/ZB/AppendixA.dtml Is there a patched sqltest.py that I don't know about or is this a bug in the book? Anyway, does anyone know of a good reason why the sqlvar tag supports python expr while sqltest does not? Some obscure security hole? Or is the functionality just missing? And in that case, is anyone up for a patch? It's not critical, but the following kind of defeats the purpose of sqlgroup: dtml-sqlgroup where required dtml-if title title like dtml-sqlvar '%%%s%%' % title type=string /dtml-if dtml-and dtml-if author title like dtml-sqlvar '%%%s%%' % author type=string /dtml-if /dtml-sqlgroup The following would be much nicer: dtml-sqlgroup where required dtml-sqltest '%%%s%%' % title op=like type=string optional dtml-and dtml-sqltest '%%%s%%' % author op=like type=string optional /dtml-sqlgroup Note: in this particular case, I could preprocess the variables and add the surrounding wildcards in the call to the ZSQL method. But that would restrict the way this method can be called (URL traversal is definitively a cool feature to impress newbies ;) ), and that's not the point here anyway: we would just like python expressions in sqltest tags. Cheers, -- Yves-Eric MARTIN [EMAIL PROTECTED] ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] DTML sqltest tag and python expr. Bug in Zope Book?
Yves-Eric Martin writes: But unfortunately, dtml-sqltest ... does not seem to work. We get the following error: The ... shorthand for expr was used in a tag that doesn't support expr attributes., for tag dtml-sqltest [...] I expect that dtml-sqltest does not support the expr attribute due to its optional. It is not easy to define the semantics of optional for arbitrary expressions. Your example seems to suggests, that you would like the tag to be omitted, when the expression raise a NameError. But, in fact, it is not clear whether this is anticipated by optional or a serious problem (maybe deep in the expression) that should be reported. Dieter ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] dtml-in batching badly
seb bacon wrote: * Joachim Werner [EMAIL PROTECTED] [010618 20:28]: That's not the behaviour I'd expect. Can anyone confirm this is a bug? As LEE Kwan Soo has already said, it is not a bug, but a clever (too clever?) feature that should maybe not be enabled by default. Every second week or so somebody runs into this and thinks it is a bug. Thanks for the hint, folks. I'm not a zope newbie, and this still bit me. IMO there's something fairly wrong with the current setup. either the default behaviour should be changed to orphans=0, or the visibility of default values for tags should be improved (from the book: orphan=int The desired minimum batch size - no mention of defaults). Furthermore, the 'feature' doesn't work as I'd expect. In the example I posted, for the sequence (1,2,3,4), I got: batch 1: 1 batch 2: 2 3 4 batch 3: 3 4 batch 4: 4 This isn't in batches of at least 3... If it were iterating in minimum batches of 3, shouldn't that be: batch 1: 1 2 3 batch 2: 2 3 4 batch 3: 2 3 4 batch 4: 2 3 4 Orphan control shouldn't actually set the desired minimum batch size, it should set the size at or below which the last batch should be combined with the next to last batch. If my batch size is five, and orphan is set to three, and I have a set of eight records that I am iterating through, I will get a single eight record batch, because the orphan setting tries to prevent the last batch having three or less results by combining them with the previous five. Orphan settings typically do not override where the batch starts (that would be a 'widow' setting) only where it ends, which is why you are getting increasingly smaller batches. However, the fact that you are getting four batches (rather than just one) is arguably a bug. A batch size of one, combined with an orphan setting of three, should actually give the following result: batch 1: 1 2 3 4 But the algorithm doesn't seem 'smart' enough to roll-up the batches by recursing through them in reverse order. Arguably though, you should never set your batch size smaller than the orphan size, so this isn't really an issue. Michael Bernstein. ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] dtml-in batching badly
Michael Bernstein wrote: But the algorithm doesn't seem 'smart' enough to roll-up the batches by recursing through them in reverse order. Arguably though, you should never set your batch size smaller than the orphan size, so this isn't really an issue. so maybe the dtml batching code should just set the orphans to the batch size if it is greater than the batch size? that would at least eliminate some of the confusion with batching. -d -- | Dyon Balding . Software Engineer . HiringTools.Monster.com | [EMAIL PROTECTED] . +1 415 288 3375 ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] dtml-in batching badly
* Joachim Werner [EMAIL PROTECTED] [010618 20:28]: That's not the behaviour I'd expect. Can anyone confirm this is a bug? As LEE Kwan Soo has already said, it is not a bug, but a clever (too clever?) feature that should maybe not be enabled by default. Every second week or so somebody runs into this and thinks it is a bug. Thanks for the hint, folks. I'm not a zope newbie, and this still bit me. IMO there's something fairly wrong with the current setup. either the default behaviour should be changed to orphans=0, or the visibility of default values for tags should be improved (from the book: orphan=int The desired minimum batch size - no mention of defaults). Furthermore, the 'feature' doesn't work as I'd expect. In the example I posted, for the sequence (1,2,3,4), I got: batch 1: 1 batch 2: 2 3 4 batch 3: 3 4 batch 4: 4 This isn't in batches of at least 3... If it were iterating in minimum batches of 3, shouldn't that be: batch 1: 1 2 3 batch 2: 2 3 4 batch 3: 2 3 4 batch 4: 2 3 4 It's ugly! seb ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
RE: [Zope-dev] dtml-in batching improved
Ivo, somehow I had missed the very start of the thread. I think that my change pretty much implements the third alternative you describe in your post, but for which you provided no patch (the one which defines the variables at the top and bottom only, because I leave the if index==first or index==last test). You are right that my change could break existing code, but I think not as badly as defining the variables for every iteration. In any case, I will keep the change in my version until I notice a side effect that I don't like. Cheers, Jean -Original Message- From: Ivo van der Wijk Sent: Monday, June 18, 2001 7:31 AM This is basically my patch #1. It makes previous-sequence-* and next-sequence-* available throughout the entire dtml-in loop. This sounds like a good fix, but people may rely on these variables being only set at resp. the start and end of the iteration. So this patch may break existing dtml code. That's why I suggested patch #2, which introduces new variables. Old code will continue to work, but people who want the problem fixed can use the newly introduced variables, which are available throughout the iteration. Ivo ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] dtml-in batching improved
On Wed, Jun 13, 2001 at 04:28:12PM -0700, Jean Lagarde wrote: Good day all, Here is the original code, with my annotated change (I deleted an if test in two places): for index in range(first,end): # preset kw['previous-sequence']= 0 kw['next-sequence']= 0 # now more often defined then previously # if index==first or index==last: # provide batching information if first 0: pstart,pend,psize=opt(0,first+overlap, sz,orphan,sequence) deleted this test -- if index==first: kw['previous-sequence']=1 kw['previous-sequence-start-index']=pstart-1 kw['previous-sequence-end-index']=pend-1 kw['previous-sequence-size']=pend+1-pstart (more similar code removed) This is basically my patch #1. It makes previous-sequence-* and next-sequence-* available throughout the entire dtml-in loop. This sounds like a good fix, but people may rely on these variables being only set at resp. the start and end of the iteration. So this patch may break existing dtml code. That's why I suggested patch #2, which introduces new variables. Old code will continue to work, but people who want the problem fixed can use the newly introduced variables, which are available throughout the iteration. Ivo -- Drs. I.R. van der Wijk -=- Brouwersgracht 132 Amaze Internet Services V.O.F. 1013 HA Amsterdam -=- Tel: +31-20-4688336 Linux/Web/Zope/SQL Fax: +31-20-4688337 Network Solutions Web: http://www.amaze.nl/Consultancy Email: [EMAIL PROTECTED] -=- ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] dtml-in batching badly
Hi, First, I don't post to this list normally; is it the best place to discuss an apparent bug? Anyway, the lowdown: If you iterate over a list with a batch size of 1, it messes up towards the end of the sequence. For example, the following code: dtml-call REQUEST.set('hoo',(1,2,3,4)) dtml-in hoo calling lt;dtml-in hoo size=1 start=dtml-var sequence-itemgt;:br dtml-in hoo size=1 start=sequence-item dtml-var sequence-item /dtml-in hr /dtml-in produces the following output: calling dtml-in hoo size=1 start=1: 1 calling dtml-in hoo size=1 start=2: 2 3 4 calling dtml-in hoo size=1 start=3: 3 4 calling dtml-in hoo size=1 start=4: 4 That's not the behaviour I'd expect. Can anyone confirm this is a bug? Cheers, seb ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] dtml-in batching badly
No it's not a bug(in code) but a feature. May You call it a bug (in usability), though. What causes it is that the orphan value defaults to 3 when not explicitely set. See the online help for in tag. LEE Kwan Soo ¢zùYb²Öh¥àÞ¿:)zàÛiÿùb²Û3¢¨®æj)fjåËbú?Î^uëÍ¡Êè²Êh²Û(¬tÌ-éܡا¥j×+-²m§ÿåËlÎ^¢¸?¨¥©ÿ+-wèÿ:)y©ç¢éÜzm§ÿåËlÎ^¢¸?¨¥©ÿ+-wèÿ:)
Re: [Zope-dev] dtml-in batching badly
That's not the behaviour I'd expect. Can anyone confirm this is a bug? As LEE Kwan Soo has already said, it is not a bug, but a clever (too clever?) feature that should maybe not be enabled by default. Every second week or so somebody runs into this and thinks it is a bug. To the DC people: Do you think it would break any code badly if the default behaviour was orphans=0? ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] dtml-in batching badly
Joachim Werner wrote: That's not the behaviour I'd expect. Can anyone confirm this is a bug? As LEE Kwan Soo has already said, it is not a bug, but a clever (too clever?) feature that should maybe not be enabled by default. Every second week or so somebody runs into this and thinks it is a bug. To the DC people: Do you think it would break any code badly if the default behaviour was orphans=0? Here is a (again perhaps too clever?) suggestion. Make the orphan value equal zero by default if size = 3. Otherwise keep it at three. I'm not oppossed to making it zero all the time either. -- | Casey Duncan | Kaivo, Inc. | [EMAIL PROTECTED] `-- ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] DTML-Python confusion (RE: [Zope] How to make a script return rendered dtml)
I've spent hours, maybe days, being confused about this as well. According to the Zope API documentation and ZDP at http://zdp.zope.org/projects/zfaq/faq/DTML/959888072 http://zdp.zope.org/projects/zsnippet/snippets/DTMLTags/CallingDTMLMetho ds someDTMLMethod(_.None, _) should work. Because of the unclear/complex calling conventions and integration between DTML and Python I've had to keep some code in DTML. Other related questions are: How do you do dtml-with and dtml-let in a Python script? (I.e. put something on the namespace) How do you give positional (not keyword) arguments to a DTML method; is there any difference? When is __call__ called, when is __str__ called, and when is index_html called? Other basic functions worth knowing about for a class/object to be a good-behaving Zope object? When does RESPONSE need to be passed; it can always be gotten from the REQUEST, right? Calling a DTML method, when to use client and when to use REQUEST? Is calling with client and REQUEST the same as adding client to the namespace (REQUEST) and calling it with an client=None? Are namespace, _, REQUEST, and context just different names for the same thing? I've been dreaming about a FAQ answering all of this (and a bunch of ZClasses questions I have). Me thinks the ZDP should be integrated with Zope.org, and all Zope.org members given access to add FAQs (I am not allowed to add FAQs now). Ideally, somebody should be adding FAQs all the time, and the FAQ index should be posted regularly to zope-dev... Btw, I think http://zdp.zope.org/projects/zfaq/faq/DTML/959888072 gets the order of aMappingObject and aClient wrong in the first code line. Bye, -- Bjorn -Original Message- From: Tim Hicks [mailto:[EMAIL PROTECTED]] Posted At: Thursday, June 14, 2001 00:15 Posted To: Zope List Conversation: [Zope] How to make a script return rendered dtml Subject: Re: [Zope] How to make a script return rendered dtml - Original Message - From: Eric Balasbas [EMAIL PROTECTED] To: Tim Hicks [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Wednesday, June 13, 2001 4:33 PM Subject: Re: [Zope] How to make a script return rendered dtml I'm not sure if this is the best way to do it, but if you want to render a DTML method or DTML document inside a Python script, use the syntax: someDTMLMethod(_.None, _) I tried this: print context(_.None, _) and got this error: Error Type: NameError Error Value: _ So I tried context.id(_.None,_) and got the same. So I tried 'print context(None,_)', with the same error resulting. Finally, I have tried: print context(None,) and got Error Type: KeyError Error Value: standard_html_header This last error at least seems like it's on the right track as it is parsing through the text of the file. What's going wrong, any idea? thanks tim Eric Balasbas Senior Developer [EMAIL PROTECTED] http://www.virtosi.com/ Virtosi Ltd. Design -- Branding -- Zope On Wed, 13 Jun 2001, Tim Hicks wrote: I have a ZClass (testclass) which subclasses DTMLDocument, and within this zclass, I have a script (python) called index_html. Obviously, this script is called each time an instance of testclass is requested. Based on the presence of a query string, I want to either return the document_src (although with a few modifications), or simply return the rendered instance... by this, I mean have all the dtml tags that are in the instance evaluated. So, my question is, how do I make Zope evaluate the dtml tags? Here is what I have so far in my script: if context.REQUEST.QUERY_STRING == 'editor': print context.raw else: print context return printed The 'else' statement simply gives me things like, lt;dtml-var standard_html_headergt; I also tried 'else: render(context)', which was simply a guess on my part, but I get a Zope error as follows: Error Type: AttributeError Error Value: validate Can anyone enlighten me? Cheers tim ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
RE: [Zope-dev] dtml-in batching improved
Title: RE: [Zope-dev] dtml-in batching improved Back before the zope.org product directory became so easy to navigate I wrote an index that I used to use which has batch links top and bottom: http://www.zope.org/Members/haqa/productlist/view_source Dunno if this helps... Adrian... -Original Message- From: Chris Withers [mailto:[EMAIL PROTECTED]] Sent: Wednesday, 30 May 2001 22:03 To: Ivo van der Wijk; [EMAIL PROTECTED]; [EMAIL PROTECTED]; Simon Coles Subject: Re: [Zope-dev] dtml-in batching improved When using batching in dtml-in, why is 'previous-sequence' only defined at the first iteration of the current batch? And why is 'next-sequence' only defined at the last iteration of the current batch? I know this problem ;-) I had it too, and stuck something in the collector about it. I did manage to get the layout you're after without modifying Zope though (see the search page on www.nipltd.com) If you want the code, maybe someone at NIP could fish it out, if you can wait until next Thursday, I'll grab it myself :-) cheers, Chris ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] dtml-in batching improved
Nope, my solution used only one dtml-in and maybe a dtml-let, no REQUEST munging :-) Ok, show me :) Hurm... gimme a shout next Thursday when I have access to the code again ;-) Actually, scratch that, check out the folder_contents.dtml file in CMFDefault/skins of the CMF. It does some cunning REQUEST variable setting that eliminates the need for the fanciness I used... cheers, Chris ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] dtml-in batching improved
Nope, my solution used only one dtml-in and maybe a dtml-let, no REQUEST munging :-) Ok, show me :) Hurm... gimme a shout next Thursday when I have access to the code again ;-) cheers, Chris ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] dtml-in batching improved
On Thu, May 31, 2001 at 05:36:21PM +0100, Chris Withers wrote: I've done it myself as well using (as described in the posting) two dtml-in's (the second one purely for displaying the prev/next links). Is your solution any different? (The only one I can think of is storing the info in your REQUEST object and using it later, but that's really ugly.) Nope, my solution used only one dtml-in and maybe a dtml-let, no REQUEST munging :-) Ok, show me :) Ivo -- Drs. I.R. van der Wijk -=- Brouwersgracht 132 Amaze Internet Services V.O.F. 1013 HA Amsterdam -=- Tel: +31-20-4688336 Linux/Web/Zope/SQL Fax: +31-20-4688337 Network Solutions Web: http://www.amaze.nl/Consultancy Email: [EMAIL PROTECTED] -=- ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] dtml-in batching improved
When using batching in dtml-in, why is 'previous-sequence' only defined at the first iteration of the current batch? And why is 'next-sequence' only defined at the last iteration of the current batch? I know this problem ;-) I had it too, and stuck something in the collector about it. I did manage to get the layout you're after without modifying Zope though (see the search page on www.nipltd.com) If you want the code, maybe someone at NIP could fish it out, if you can wait until next Thursday, I'll grab it myself :-) cheers, Chris ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] dtml-in batching improved
On Wed, May 30, 2001 at 10:02:31PM +0100, Chris Withers wrote: When using batching in dtml-in, why is 'previous-sequence' only defined at the first iteration of the current batch? And why is 'next-sequence' only defined at the last iteration of the current batch? I know this problem ;-) I had it too, and stuck something in the collector about it. I did manage to get the layout you're after without modifying Zope though (see the search page on www.nipltd.com) I've done it myself as well using (as described in the posting) two dtml-in's (the second one purely for displaying the prev/next links). Is your solution any different? (The only one I can think of is storing the info in your REQUEST object and using it later, but that's really ugly.) Ivo -- Drs. I.R. van der Wijk -=- Brouwersgracht 132 Amaze Internet Services V.O.F. 1013 HA Amsterdam -=- Tel: +31-20-4688336 Linux/Web/Zope/SQL Fax: +31-20-4688337 Network Solutions Web: http://www.amaze.nl/Consultancy Email: [EMAIL PROTECTED] -=- ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] dtml-in batching improved
Ivo van der Wijk wrote: On Wed, May 30, 2001 at 10:02:31PM +0100, Chris Withers wrote: When using batching in dtml-in, why is 'previous-sequence' only defined at the first iteration of the current batch? And why is 'next-sequence' only defined at the last iteration of the current batch? I know this problem ;-) I had it too, and stuck something in the collector about it. I did manage to get the layout you're after without modifying Zope though (see the search page on www.nipltd.com) I've done it myself as well using (as described in the posting) two dtml-in's (the second one purely for displaying the prev/next links). Is your solution any different? (The only one I can think of is storing the info in your REQUEST object and using it later, but that's really ugly.) AFAIK that is what the next and previous options for dtml-in are for. Usually I just store the sequence (if it is a query) in a variable using a let around three (or more) dtml-ins. Two of which use the next or previous option to create the batching links. -- | Casey Duncan | Kaivo, Inc. | [EMAIL PROTECTED] `-- ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] dtml-in batching improved
I've done it myself as well using (as described in the posting) two dtml-in's (the second one purely for displaying the prev/next links). Is your solution any different? (The only one I can think of is storing the info in your REQUEST object and using it later, but that's really ugly.) Nope, my solution used only one dtml-in and maybe a dtml-let, no REQUEST munging :-) cheers, Chris ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] dtml-in batching improved
Hi all, When using batching in dtml-in, why is 'previous-sequence' only defined at the first iteration of the current batch? And why is 'next-sequence' only defined at the last iteration of the current batch? This behaviour makes it difficult to display a batch like this: -- begin sample -- Item N Item N+1 Item N+2 (link to previous items) (link to next items) -- end sample -- Because the code would be something like: -- begin sample -- dtml-in something start=query_start size=3 [do something with sequence-item] dtml-if sequence-end !-- check if last item of batch -- dtml-if previous-sequence (link to previous items) /dtml-if dtml-if next-sequence (link to next items) /dtml-if /dtml-if /dtml-in -- end sample -- However, if your batchsize is larger than 1, 'previous-sequence' will always be untrue at the last item (when sequence-item is true). The only solution would be implement a second dtml-in after the first one purely for displaying the previous link. Also, dtml-in would re-execute your expr (which it does not very efficiently), so if you want to avoid doing the expr twice, you'd have to store it temporarily using dtml-let (or my dtml-set tag ;). The end result would be: -- start sample -- dtml-let foo=expr dtml-in foo start=start_query size=3 [do something with sequence-item] /dtml-in dtml-in foo start=start_query size=3 !-- code below is safe, as the variables are only true at the resp. top and end, though the truly paranoid could check for sequence-start / -end patch #1 below would break such code! -- dtml-if sequence-end dtml-if previous-sequence (link to previous items) /dtml-if dtml-if next-sequence (link to next items) /dtml-if /dtml-if /dtml-in /dtml-let -- end sample -- And at this point I really would start to implement the batching myself in python :) Of course, basically the same applies if you want both the previous/next link at the top of the batch display. (Imagine you want both! :) Either I'm missing something really obvious here, or the patches below make sense. There are two versions: - patch #1: This version fixes the issue above by enabling the values of previous/next-sequence throughout the entire batch (and other related variables as well: X-sequence, X-sequence-start-index, X-sequence-end-index, X-sequence-size) (which may break existing sites), and - patch #2: This version introduces new variablenames, leaving the behaviour of previous/next-sequence. A third alternative would be to only define the variables at the top and bottom of the batch. Both versions fix (I think) a grammatical error. It's up to the DC guys if they feel like incorporating either of these patches in a next release :) patch #1: define variables everywhere in the batch This patch makes sure that the following variables are available through each iteration of dtml-in, for each item. ! This patch may break alot of dtml code !! next-sequence next-sequence-start-index next-sequence-end-index next-sequence-size previous-sequence previous-sequence-start-index previous-sequence-end-index previous-sequence-size -- patch begins here -- *** Zope-2.3.2-orig/lib/python/DocumentTemplate/DT_In.pyFri Apr 13 21:30:38 2001 --- Zope-2.3.2-src/lib/python/DocumentTemplate/DT_In.py Tue May 29 19:52:36 2001*** *** 583,611 for index in range(first,end): # preset kw['previous-sequence']= 0 ! kw['next-sequence']= 0 # now more often defined then previously # ! if index==first or index==last: ! # provide batching information ! if first 0: ! pstart,pend,psize=opt(0,first+overlap, ! sz,orphan,sequence) ! if index==first: kw['previous-sequence']=1 ! kw['previous-sequence-start-index']=pstart-1 ! kw['previous-sequence-end-index']=pend-1 ! kw['previous-sequence-size']=pend+1-pstart ! try: ! # The following line is a sneaky way to ! # test whether there are more items, ! # without actually computing a length: ! sequence[end] ! pstart,pend,psize=opt(end+1-overlap,0, ! sz,orphan,sequence) ! if index==last: kw['next-sequence']=1 ! kw['next-sequence-start-index']=pstart-1 ! kw['next-sequence-end-index']=pend-1 ! kw['next-sequence-size']=pend+1-pstart ! except: pass
[Zope-dev] dtml-in bug?
Hi! Dunno if it's again my strange setup, but I have some problem with dtml-in or maybe I simply didn't get something right.. Well, I used the following dtml code: html dtml-in expr=[1,2,3,4,5,6] size=4 abr /dtml-in /html and I thought I will get three a's as output.. instead I get 6.. If I do size=3 it's ok (3 output), if I do size=4 or 5 or 6 I get them all.. (actually it happened with some more complex list of Result objects but this seems to do the same here) Can someone explain that to me..? (it's Zope 2.3.2, Python 1.5.2, SuSE Linux 7.0) cheers, Christian -- COM.lounge http://comlounge.net/ communication design [EMAIL PROTECTED] ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] dtml-in bug?
Hi Christian, --On Montag, 28. Mai 2001 15:38 +0200 Christian Scholz [EMAIL PROTECTED] wrote: Hi! Dunno if it's again my strange setup, but I have some problem with dtml-in or maybe I simply didn't get something right.. Well, I used the following dtml code: html dtml-in expr=[1,2,3,4,5,6] size=4 abr /dtml-in /html *rustle* try orphan=0 :-) Greetings Tino and I thought I will get three a's as output.. instead I get 6.. If I do size=3 it's ok (3 output), if I do size=4 or 5 or 6 I get them all.. (actually it happened with some more complex list of Result objects but this seems to do the same here) Can someone explain that to me..? (it's Zope 2.3.2, Python 1.5.2, SuSE Linux 7.0) cheers, Christian -- COM.lounge http://comlounge.net/ communication design [EMAIL PROTECTED] ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope ) ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] dtml-in bug?
Hi! ok, some more people told me now about it.. ;-) It's not that intuitive nevertheless.. (IMHO) ;-) cheers and thx, Christian On Mon, May 28, 2001 at 05:20:39PM +0200, Tino Wildenhain wrote: Hi Christian, --On Montag, 28. Mai 2001 15:38 +0200 Christian Scholz [EMAIL PROTECTED] wrote: Hi! Dunno if it's again my strange setup, but I have some problem with dtml-in or maybe I simply didn't get something right.. Well, I used the following dtml code: html dtml-in expr=[1,2,3,4,5,6] size=4 abr /dtml-in /html *rustle* try orphan=0 :-) Greetings Tino and I thought I will get three a's as output.. instead I get 6.. If I do size=3 it's ok (3 output), if I do size=4 or 5 or 6 I get them all.. (actually it happened with some more complex list of Result objects but this seems to do the same here) Can someone explain that to me..? (it's Zope 2.3.2, Python 1.5.2, SuSE Linux 7.0) cheers, Christian -- COM.lounge http://comlounge.net/ communication design [EMAIL PROTECTED] ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope ) -- COM.lounge http://comlounge.net/ communication design [EMAIL PROTECTED] ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] dtml-in performance
Brett Carter wrote: What can I do to maximize the peformance of a dtml-in statement? When iterating over a 2000 row database query, it takes about 20 seconds - time mostly spent doing security checks, and calling __getitem__ in DT_InSV.py. Is the performance of dtml-in just slow? -Brett Another performance consideration with looping in DTML is that whatever is in your DTML block is reinterpreted each time through. Although it is parsed (hopefully) only the first time through, this overhead is still considerable when multiplied over 2000 rows. You are essentially using an interpreter (Python) as an interpreter for DTML. I would seriously consider moving this entire operation (query, iteration and html generation) to native Python if performance is a big consideration. -- | Casey Duncan | Kaivo, Inc. | [EMAIL PROTECTED] `-- ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] dtml-in performance
What can I do to maximize the peformance of a dtml-in statement? When iterating over a 2000 row database query, it takes about 20 seconds - time mostly spent doing security checks, and calling __getitem__ in DT_InSV.py. Is the performance of dtml-in just slow? -Brett Another performance consideration with looping in DTML is that whatever is in your DTML block is reinterpreted each time through. Although it is parsed (hopefully) only the first time through, this overhead is still considerable when multiplied over 2000 rows. You are essentially using an interpreter (Python) as an interpreter for DTML. I would seriously consider moving this entire operation (query, iteration and html generation) to native Python if performance is a big consideration. We have had similar performance problems with the first version of our Content Management demo. It used both dtml-in loops and ZClasses (with other ZCLasses as base classes) heavily. The combination of the both can be very efficient in slowing down Zope. I remember the first versions of Martijn Faassen's XML-Widgets that had a similar performance problem. The reason is that in addition to the dtml-in overhead ZClasses take a lot of time for acquiring from their containers and inheriting from their "base classes" as all the inheritance stuff is only simulated - in fact almost everything is just stored in property sheets and has to be processed by the security engine if I got it right. In Python these problems go away. Maybe it is time for a good reimplementation of ZClasses, inlcuding the creation of REAL Python classes in the filesystem on the fly. BTW: Does anybody know if the Zope Page Templates (ZPT) parser is faster with looping than the DTML one? Cheers, Joachim. ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] dtml-in performance
What can I do to maximize the peformance of a dtml-in statement? When iterating over a 2000 row database query, it takes about 20 seconds - time mostly spent doing security checks, and calling __getitem__ in DT_InSV.py. Is the performance of dtml-in just slow? -Brett ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] dtml-in: next-batches
Brett Carter writes: I tried accessing keys off the 'data' object, and I just get an 'unathorized' error. Dieter The attributes your are looking for are in fact keys Dieter of the mapping 'data'. Sorry for the misleading answer. "data" is not supposed to be used directly. "next-batches" returns a sequence of "DocumentTemplate.DT_In_SV.sequence_variables". Each "sequence_variables" object behaves like a mapping and exposes the items of its "data" member (and some more items derived from them), among them "batch-start-index", 'batch-end-index', and 'batch-size'. Dieter ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] dtml-in: next-batches
I tried accessing keys off the 'data' object, and I just get an 'unathorized' error. -Brett "Dieter" == Dieter Maurer [EMAIL PROTECTED] writes: Dieter Brett Carter writes: I'm running Zope 2.2.2, and I'm trying to use the batching stuff for the dtml-in tag, however, I can't seem to access any attributes off the 'next-batches' or 'previous-batches' mapping object that's supposed to be available, with the attributes 'batch-start-index', 'batch-end-index', and 'batch-size'. I wrote an external method to dir the 'next-batches' object, and it seems the only attributes available are: ['data', 'items', 'query_string', 'start_name_re'] Dieter The attributes your are looking for are in fact keys Dieter of the mapping 'data'. Dieter Dieter ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] dtml-in: next-batches
Does anybody have an example of how to use the supposed next-batches mapping returned by dtml-in? I'm trying to build a google-like pageing feature into my application, so we just show the first 5 results, then have a link to each next page, ie "1,2,3,4..." Thanks, -Brett ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
RE: [Zope-dev] dtml-in: next-batches
I found this in some Zope documentation. It wont give you "1,2,3,4,5...10" it gives "(1-10)(11-20)(21-30)...". Monkey with it a little and you'll get it. Beware it will call your External Method or ZSQL as many times/10. dtml-in expr="SOME_EXTERNAL_METHOD(REQUEST)" previous orphan=1 size=10 start=qs dtml-in previous-batches mapping dtml-unless sequence-start, /dtml-unless a href="dtml-var document_iddtml-var sequence-query qs=dtml-var batch-start-number" (dtml-var batch-start-number - dtml-var batch-end-number)/a /dtml-in /dtml-in dtml-in expr="SOME_EXTERNAL_METHOD(REQUEST)" next orphan=1 size=10 start=qs dtml-in next-batches mapping dtml-unless sequence-start, /dtml-unless a href="dtml-var document_iddtml-var sequence-query qs=dtml-var batch-start-number" (dtml-var batch-start-number - dtml-var batch-end-number)/a /dtml-in /dtml-in dtml-in expr="SOME_EXTERNAL_METHOD(REQUEST)" orphan=1 size=10 start=qs dtml-var sequence-index)" dtml-var expr="_.getitem('sequence-item')[1]" dtml-var expr="_.getitem('sequence-item')[2]" /dtml-in -Bryan -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Brett Carter Sent: Wednesday, March 07, 2001 6:34 PM To: [EMAIL PROTECTED] Subject: [Zope-dev] dtml-in: next-batches Does anybody have an example of how to use the supposed next-batches mapping returned by dtml-in? I'm trying to build a google-like pageing feature into my application, so we just show the first 5 results, then have a link to each next page, ie "1,2,3,4..." Thanks, -Brett ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope ) ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] dtml-in: next-batches
I've also discovered that setting overlap = 0 actually causes everything to overlap by 1. I didn't see anything in the collector about this either... -Brett "Brett" == Brett Carter [EMAIL PROTECTED] writes: Brett I'm running Zope 2.2.2, and I'm trying to use the batching stuff for Brett the dtml-in tag, however, I can't seem to access any attributes off Brett the 'next-batches' or 'previous-batches' mapping object that's Brett supposed to be available, with the attributes 'batch-start-index', Brett 'batch-end-index', and 'batch-size'. However, my example code (see Brett below) blows up with a key error when trying to access any of these. Brett Is this a bug, or am I just misunderstanding how to use this thing? Brett I wrote an external method to dir the 'next-batches' object, and it Brett seems the only attributes available are: Brett ['data', 'items', 'query_string', 'start_name_re'] Brett -Brett Brett p Brett dtml-in "mystuff.retseq()" size=5 start=start Brett dtml-var sequence-item Brett /dtml-in /p Brett p Brett dtml-in "mystuff.retseq()" size=5 start=start previous Brett a href="dtml-var absolute_url/batch_me?start=dtml-var previous-sequence-start-index"Previous/a Brett /dtml-in Brett dtml-in "mystuff.retseq()" size=5 start=start next overlap=-1 Brett dtml-try Brett dtml-in next-batches Brett dtml-var batch-start-indexbr Brett /dtml-in Brett dtml-except Brettpre Brettdtml-var error_typebr Brettdtml-var error_valuebr Brettdtml-var error_tbbr Brett/pre Brett /dtml-try Brett a href="dtml-var absolute_url/batch_me?start=dtml-var next-sequence-start-index"Next/a Brett /dtml-in Brett /p Brett ___ Brett Zope-Dev maillist - [EMAIL PROTECTED] Brett http://lists.zope.org/mailman/listinfo/zope-dev Brett ** No cross posts or HTML encoding! ** Brett (Related lists - Brett http://lists.zope.org/mailman/listinfo/zope-announce Brett http://lists.zope.org/mailman/listinfo/zope ) ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] dtml-in: next-batches
Brett Carter writes: I'm running Zope 2.2.2, and I'm trying to use the batching stuff for the dtml-in tag, however, I can't seem to access any attributes off the 'next-batches' or 'previous-batches' mapping object that's supposed to be available, with the attributes 'batch-start-index', 'batch-end-index', and 'batch-size'. I wrote an external method to dir the 'next-batches' object, and it seems the only attributes available are: ['data', 'items', 'query_string', 'start_name_re'] The attributes your are looking for are in fact keys of the mapping 'data'. Dieter ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] dtml-in: next-batches
I'm running Zope 2.2.2, and I'm trying to use the batching stuff for the dtml-in tag, however, I can't seem to access any attributes off the 'next-batches' or 'previous-batches' mapping object that's supposed to be available, with the attributes 'batch-start-index', 'batch-end-index', and 'batch-size'. However, my example code (see below) blows up with a key error when trying to access any of these. Is this a bug, or am I just misunderstanding how to use this thing? I wrote an external method to dir the 'next-batches' object, and it seems the only attributes available are: ['data', 'items', 'query_string', 'start_name_re'] -Brett p dtml-in "mystuff.retseq()" size=5 start=start dtml-var sequence-item /dtml-in /p p dtml-in "mystuff.retseq()" size=5 start=start previous a href="dtml-var absolute_url/batch_me?start=dtml-var previous-sequence-start-index"Previous/a /dtml-in dtml-in "mystuff.retseq()" size=5 start=start next overlap=-1 dtml-try dtml-in next-batches dtml-var batch-start-indexbr /dtml-in dtml-except pre dtml-var error_typebr dtml-var error_valuebr dtml-var error_tbbr /pre /dtml-try a href="dtml-var absolute_url/batch_me?start=dtml-var next-sequence-start-index"Next/a /dtml-in /p ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] DTML Documents/Folders in ZClasses fail to accessanything
Steve Alexander wrote: Itai Tavor wrote: Hi, I got a ZClass 'Test', with a DTML Method 'view' containing dtml-var id, and a DTML Document 'view2' with the same line. instance/view works. instance/view2 returns (ZDebug output): From SimpleItem.py: """Direct use of the 'id' attribute is deprecated - use getId()""" The difference you're seeing is because the DTML Method is acquiring the id attribute, whereas you're getting the DTML Document's own id attribute. Thanks, but it's got nothing to do with getId... I just used id because it's easy to write. I get the same behavior if I try to view meta_type, or a property that is defined on a propertysheet in the ZClass. And the fact that the DTML Document uses its own attributes shouldn't cause Unauthorized, should it? It should just show a different attribute, or acquire the attribute if it doesn't have it. I just tried it again with a clean install of Zope 2.3.0. In a DTML Document, this works (name is a property in the ZClass propertysheet): dtml-with "PARENTS[0]" dtml-var name dtml-var meta_type /dtml-with But these fail with Unauthorized: dtml-var name, dtml-var meta_type. The dtml-var title_or_id in standard_html_header fails as well. I also repeated the folder test: In a DTML Method stored inside a folder in the ZClass, dtml-var name works, but dtml-var title_or_id fails. So what do we have? I can't use title_or_id on DTML Documents, so it's useless for use in standard_html_header (and title_or_id uses getId, so it should work). I can't access ZClass properties from the DTML Document unless I use dtml-with - meaning no acquisition. And I can't access properties of the DTML Document (like meta_type) unless they are accessed using a method call (like getId()). This can't be right. I find it hard to believe that if this is really a bug, it didn't bother anybody else until now. On the other hand, these tests seem to show a problem with security checks on objects in ZClasses that create their own context. So what am I still missing here? Itai -- -- Itai Tavor -- "Je sautille, donc je suis."-- [EMAIL PROTECTED]-- - Kermit the Frog -- -- -- -- "If you haven't got your health, you haven't got anything" -- ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] DTML Documents/Folders in ZClasses fail to access anything
Itai Tavor wrote: Hi, I got a ZClass 'Test', with a DTML Method 'view' containing dtml-var id, and a DTML Document 'view2' with the same line. instance/view works. instance/view2 returns (ZDebug output): From SimpleItem.py: """Direct use of the 'id' attribute is deprecated - use getId()""" The difference you're seeing is because the DTML Method is acquiring the id attribute, whereas you're getting the DTML Document's own id attribute. -- Steve Akexander Software Engineer Cat-Box limited http://www.cat-box.net ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] DTML Documents/Folders in ZClasses fail to access anything
Hi, I got a ZClass 'Test', with a DTML Method 'view' containing dtml-var id, and a DTML Document 'view2' with the same line. instance/view works. instance/view2 returns (ZDebug output): Error type: Unauthorized Error value: The object /test/view2, which is contained in /test/view2, is marked as private. Traceback (innermost last): File /opt/Zope-2.3.0-linux2-x86/lib/python/ZPublisher/Publish.py, line 222, in publish_module File /opt/Zope-2.3.0-linux2-x86/lib/python/ZPublisher/Publish.py, line 187, in publish File /opt/Zope-2.3.0-linux2-x86/lib/python/ZPublisher/Publish.py, line 171, in publish File /opt/Zope-2.3.0-linux2-x86/lib/python/ZPublisher/mapply.py, line 160, in mapply (Object: view2) File /opt/Zope-2.3.0-linux2-x86/lib/python/ZPublisher/Publish.py, line 112, in call_object (Object: view2) File /opt/Zope-2.3.0-linux2-x86/lib/python/OFS/DTMLDocument.py, line 189, in __call__ (Object: view2) File /opt/Zope/lib/python/Products/ZDebug/DTMLLocator.py, line 103, in __call__ (Object: view2) File /opt/Zope-2.3.0-linux2-x86/lib/python/DocumentTemplate/DT_String.py, line 538, in __call__ (Object: view2) File /opt/Zope/lib/python/Products/ZDebug/DTMLDebug.py, line 259, in debug_render_blocks File /opt/Zope/lib/python/Products/ZDebug/DTMLDebug.py, line 239, in debugException File /opt/Zope/lib/python/Products/ZDebug/DTMLDebug.py, line 256, in debug_render_blocks File /opt/Zope-2.3.0-linux2-x86/lib/python/OFS/DTMLMethod.py, line 261, in validate (Object: view2) File /opt/Zope-2.3.0-linux2-x86/lib/python/AccessControl/SecurityManager.py, line 144, in validate File /opt/Zope/lib/python/Products/ZDebug/DebugSecurityPolicy.py, line 304, in validate Unauthorized: (see above) The same happens if I place a copy of 'view' inside a Folder in the ZClass and call instance/folder/view, except that this time the Folder is flagged as the 'private' object. Why? What? Is this a bug? Or is it supposed to work this way and I just don't get it? Did I fall behind on my sheep sacrifices? Or was it changed to goats and I missed the memo? Environment: Zope 2.3.0, ZClass subclassing only ZObject, using stock acl_users and storing the instance in a standard Folder. -- -- Itai Tavor -- "Je sautille, donc je suis."-- [EMAIL PROTECTED]-- - Kermit the Frog -- -- -- -- "If you haven't got your health, you haven't got anything" -- ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] dtml-in batching
[EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: The dtml-in batching mechanisms are quite difficult to debug - the DTML documentation I have has examples which break it and there's no indication of why. It turns out the DT_In renderwb() code gobbles all exceptions from the rendering of the previous and next blocks. I've hacked my code so that there's no try/except clause any more. I'm not sure what exception it's trying to catch, but could it perhaps be made a little more picky? And here's a diff - I'm pretty sure this was the intended behaviour... Please post this as a "Bug w/ patch" to the Collector: http://classic.zope.org:8080/Collector That way we don't lose your fix in the list traffic (losing it along with our marbles is another problem :) Tres. -- === Tres Seaver[EMAIL PROTECTED] Digital Creations "Zope Dealers" http://www.zope.org ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] DTML block parsing
Casey Duncan wrote: If not, I will make a patch for DT_String to support this. The beneficial side affect would be that dtml-comment could be "fixed" so that its contents need not be parsable anymore, just like every other language I know of. With your patch applied, will nested dtml-comment tags still work? dtml-comment Some code commented out dtml-comment Documentation in a comment /dtml-comment Rest of code commented out /dtml-comment -- Steve Alexander Software Engineer Cat-Box limited http://www.cat-box.net ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] DTML block parsing
Steve Alexander wrote: With your patch applied, will nested dtml-comment tags still work? dtml-comment Some code commented out dtml-comment Documentation in a comment /dtml-comment Rest of code commented out /dtml-comment -- Steve Alexander Software Engineer Cat-Box limited http://www.cat-box.net In present form no. It also does not support block continuation tags. I will see what I can do about this. -- | Casey Duncan | Kaivo, Inc. | [EMAIL PROTECTED] `-- ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] DTML block parsing
Casey Duncan wrote: Steve Alexander wrote: With your patch applied, will nested dtml-comment tags still work? dtml-comment Some code commented out dtml-comment Documentation in a comment /dtml-comment Rest of code commented out /dtml-comment -- Steve Alexander Software Engineer Cat-Box limited http://www.cat-box.net In present form no. It also does not support block continuation tags. I will see what I can do about this. OK, I have developed a new patch that almost completely fixes this issue. In fact I am happier with it in general than my first patch. There is only one flaw, although you can nest comments inside of one another, and you can have any manner of broken dtml inside, if you open another comment tag inside it, it must be properly balanced or you will get a parse error. Here are some examples: These do not generate errors with my new patch: dtml-comment dtml-if blah /dtml-comment dtml-comment /dtml-with /dtml-comment dtml-comment dtml-asdfsadf /dtml-comment dtml-comment dtml-comment Blah Blah /dtml-comment /dtml-comment These do: dtml-comment dtml-comment /dtml-comment dtml-comment dtml-if foo dtml-comment /dtml-if /dtml-comment /dtml-comment I am a bit concerned that dtml-comment should ever generate errors at all, but this is certainly an improvement. Anybody have any thoughts? -- | Casey Duncan | Kaivo, Inc. | [EMAIL PROTECTED] `-- ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] dtml-in batching
Tres Seaver wrote: [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: The dtml-in batching mechanisms are quite difficult to debug - the DTML documentation I have has examples which break it and there's no indication of why. It turns out the DT_In renderwb() code gobbles all exceptions from the rendering of the previous and next blocks. I've hacked my code so that there's no try/except clause any more. I'm not sure what exception it's trying to catch, but could it perhaps be made a little more picky? And here's a diff - I'm pretty sure this was the intended behaviour... Please post this as a "Bug w/ patch" to the Collector: http://classic.zope.org:8080/Collector That way we don't lose your fix in the list traffic (losing it along with our marbles is another problem :) Someone else responded to the list saying that he'd already done it. There was no match to my search of dtml-in though, so I've submitted a new bug report. Richard -- Richard Jones [EMAIL PROTECTED] Senior Software Developer, Bizar Software (www.bizarsoftware.com.au) ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] dtml-in batching
On Wed, 24 Jan 2001 [EMAIL PROTECTED] wrote: Tres Seaver wrote: Please post this as a "Bug w/ patch" to the Collector: http://classic.zope.org:8080/Collector That way we don't lose your fix in the list traffic (losing it along with our marbles is another problem :) Someone else responded to the list saying that he'd already done it. There was no match to my search of dtml-in though, so I've submitted a new bug report. Thanks very much! Tres. -- === Tres Seaver[EMAIL PROTECTED] Digital Creations "Zope Dealers" http://www.zope.org ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] dtml-in batching
On 24 Jan 2001, at 9:43, [EMAIL PROTECTED] wrote: Tres Seaver wrote: Please post this as a "Bug w/ patch" to the Collector: http://classic.zope.org:8080/Collector That way we don't lose your fix in the list traffic (losing it along with our marbles is another problem :) Someone else responded to the list saying that he'd already done it. There was no match to my search of dtml-in though, so I've submitted a new bug report. I posted this same bug AND a patch as bug # 1566 on Aug 28th, 2000. http://classic.zope.org:8080/Collector/1566/view Sad to see its *still* pending Brad Clements,[EMAIL PROTECTED] (315)268-1000 http://www.murkworks.com (315)268-9812 Fax netmeeting: ils://ils.murkworks.com AOL-IM: BKClements ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] dtml-in batching
Brad Clements wrote: On 24 Jan 2001, at 9:43, [EMAIL PROTECTED] wrote: Tres Seaver wrote: Please post this as a "Bug w/ patch" to the Collector: http://classic.zope.org:8080/Collector That way we don't lose your fix in the list traffic (losing it along with our marbles is another problem :) Someone else responded to the list saying that he'd already done it. There was no match to my search of dtml-in though, so I've submitted a new bug report. I posted this same bug AND a patch as bug # 1566 on Aug 28th, 2000. http://classic.zope.org:8080/Collector/1566/view Sad to see its *still* pending Well that's odd - I searched the collector for "dtml-in" and got no matches. A search for "renderwb" (which is in the title) works. Looks like it doesn't search the description after all. Boo to the search engine. Just curious: why specify the browser/platform/python version stuff when the problem is independant of those things? Richard ps. Brad, sorry I referred to you as "someone else" - I lost the email with your name in it ;) -- Richard Jones [EMAIL PROTECTED] Senior Software Developer, Bizar Software (www.bizarsoftware.com.au) ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] dtml-in batching
On 24 Jan 2001, at 11:15, [EMAIL PROTECTED] wrote: Brad Clements wrote: I posted this same bug AND a patch as bug # 1566 on Aug 28th, 2000. http://classic.zope.org:8080/Collector/1566/view Sad to see its *still* pending Well that's odd - I searched the collector for "dtml-in" and got no matches. A search for "renderwb" (which is in the title) works. Looks like it doesn't search the description after all. Boo to the search engine. Just curious: why specify the browser/platform/python version stuff when the problem is independant of those things? Because I'm Anal Retentive. Also figured perhaps my entry would be ignored without that information. Or worse the form would be rejected on submit because those fields where blank AND it wouldn't remember what I'd put in AND back would fail. So, I filled out the form entirely. Brad Clements,[EMAIL PROTECTED] (315)268-1000 http://www.murkworks.com (315)268-9812 Fax netmeeting: ils://ils.murkworks.com AOL-IM: BKClements ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] DTML block parsing
Casey Duncan wrote: OK, I have developed a new patch that almost completely fixes this issue. In fact I am happier with it in general than my first patch. There is only one flaw, although you can nest comments inside of one another, and you can have any manner of broken dtml inside, if you open another comment tag inside it, it must be properly balanced or you will get a parse error. Here are some examples: examples removed I am a bit concerned that dtml-comment should ever generate errors at all, but this is certainly an improvement. Anybody have any thoughts? I'm very happy with the way you describe the patched tag works. I'll try it out when I return from the EuroZope meeting in Amsterdam. I don't think it is reasonable to try to catch unbalanced dtml-comment tags. In fact, I like the fact that it will raise an error if I leave them unbalanced. Thanks. -- Steve Alexander Software Engineer Cat-Box limited http://www.cat-box.net ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] dtml-in batching
The dtml-in batching mechanisms are quite difficult to debug - the DTML documentation I have has examples which break it and there's no indication of why. It turns out the DT_In renderwb() code gobbles all exceptions from the rendering of the previous and next blocks. I've hacked my code so that there's no try/except clause any more. I'm not sure what exception it's trying to catch, but could it perhaps be made a little more picky? Richard -- Richard Jones [EMAIL PROTECTED] Senior Software Developer, Bizar Software (www.bizarsoftware.com.au) ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] dtml-in batching
[EMAIL PROTECTED] wrote: The dtml-in batching mechanisms are quite difficult to debug - the DTML documentation I have has examples which break it and there's no indication of why. It turns out the DT_In renderwb() code gobbles all exceptions from the rendering of the previous and next blocks. I've hacked my code so that there's no try/except clause any more. I'm not sure what exception it's trying to catch, but could it perhaps be made a little more picky? Re-glancing at the code shows me that this is only the case for the next block. Sorry about that. -- Richard Jones [EMAIL PROTECTED] Senior Software Developer, Bizar Software (www.bizarsoftware.com.au) ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] dtml-in batching
[EMAIL PROTECTED] wrote: The dtml-in batching mechanisms are quite difficult to debug - the DTML documentation I have has examples which break it and there's no indication of why. It turns out the DT_In renderwb() code gobbles all exceptions from the rendering of the previous and next blocks. I've hacked my code so that there's no try/except clause any more. I'm not sure what exception it's trying to catch, but could it perhaps be made a little more picky? And here's a diff - I'm pretty sure this was the intended behaviour... *** /tmp/DT_In.py.orig Mon Jan 22 12:00:53 2001 --- DT_In.pyMon Jan 22 12:00:58 2001 *** *** 561,566 --- 561,570 # there are more items, without actually # computing a length: sequence[end] + except IndexError: + if self.elses: result=render(self.elses, md) + else: result='' + else: pstart,pend,psize=opt(end+1-overlap,0, sz,orphan,sequence) kw['next-sequence']=1 *** *** 568,576 kw['next-sequence-end-index']=pend-1 kw['next-sequence-size']=pend+1-pstart result=render(section,md) - except: - if self.elses: result=render(self.elses, md) - else: result='' else: result = [] append=result.append --- 572,577 -- Richard Jones [EMAIL PROTECTED] Senior Software Developer, Bizar Software (www.bizarsoftware.com.au) ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] DTML Documents == DTML Methods that are anchored?
The Doctor What writes: What are the differences between DTML Documents and Methods internally? There are too small differences: 1. DTML documents implement the "PropertyManager" interface, i.e. they can have properties other than "id" and "title". 2. DTML documents place themselves on top of the DTML namespace when they are rendered (called), DTML methods do not place themselves on the namespace at all for rendering. The effect is that during name lookup a DTML Document is asked early whether it (or its acquisition ancestors) can satisfy the name request. If it can, you get this object. A DTML Method, on the other hand, would not be asked in a similar situation, as it is not on the namespace stack. This means, name lookup looks through the DTML Method directly onto the method's client, the Method is completely transparent. A DTML Document is only partially transparent, it hides all names that it or its acquisition ancestors define. Only the other names are handled in the same way as would be the case for a DTML method. Dieter ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] DTML Documents == DTML Methods that are anchored?
What are the differences between DTML Documents and Methods internally? I was just thinking about the problems every new user (and experienced users, every so often) have regarding DTML Documents vs DTML Methods. Aren't they really the same except that Documents are anchored (ie, don't allow aquisition from the caller, but only from the location of the Document)? If that is true, couldn't they be simplified as a (example name) DTML Object that had an "anchor" flag? Just a thought. Ciao! -- So Buddha walks into a pizza parlor and says: "Hey, make me one with everything." The Doctor What: Need I say more?http://docwhat.gerf.org/ [EMAIL PROTECTED] KF6VNC ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] DTML Documents == DTML Methods that are anchored?
You should look through the mailing lists there is generous amounts of answers to this. For me the two sit philosophically linked in the acquisition model. Acquisition is partially about actions working in environments, with the environment decribing the quality of the result. You can think of a DTMLMethod as an action, who itself has no substrate, i.e. properties, and DTMLDocuments as substrate, i.e. it contains properties etc, for example background colour, types of animals, whatever. One can then throw a method around into different environments, i.e. call it on documents, and one will get a result that is dependent on that environment(document). It is also nice that environments can acquire from their surrounding too, so you should think of acquisition in DTMLDocuments as been for more and more global properties as one moves out, eg: a company logo. Whereas acquisition for a method is to actually acquire an environment to work in. Well that's the way I view it, and it helps. Matt On Sat, 30 Dec 2000, The Doctor What wrote: What are the differences between DTML Documents and Methods internally? I was just thinking about the problems every new user (and experienced users, every so often) have regarding DTML Documents vs DTML Methods. Aren't they really the same except that Documents are anchored (ie, don't allow aquisition from the caller, but only from the location of the Document)? If that is true, couldn't they be simplified as a (example name) DTML Object that had an "anchor" flag? Just a thought. Ciao! -- So Buddha walks into a pizza parlor and says: "Hey, make me one with everything." The Doctor What: Need I say more?http://docwhat.gerf.org/ [EMAIL PROTECTED] KF6VNC ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope ) -- ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] DTML processing variable
If this is your exact code, it looks like you should be using "sequence-item", instead of "sequence_item". You should also be able to do it without the external method like this: (100% untested) dtml-in expr="_.string.split(acctUsersEmail)" dtml-var name="sequence-item" /dtml-in "David W. Damon" wrote: Hey all, I'm having difficulty getting dtml-in to iterate over a list of strings returned from an external python method. Essentially, I have a string that is comprised of the contents of an HTML text area. I need to split the string into a list of words and iterate over this list. My external python method is this: def stringSplit( self, theString ): return string.split( theString ) Heres the pertinent DTML. --- dtml-call expr="REQUEST.set( 'userList', stringSplit(acctUsersEmail))" dtml-in userList dtml-var sequence_item /dtml-in dtml-var REQUEST --- If I comment out the dtml-in block, i have a userList variable in the REQUEST object that is something like: ['name1', 'name2', 'name3'] Any ideas? -- dave ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope ) -- Paul Erickson | [EMAIL PROTECTED] Kaivo, Inc. | www.kaivo.com ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] DTML Entity Syntax, was (no subject)
Johann Loibl wonders: What does the following line means? href="dtml.url-mail_password_form; how to work with '' ? This means to substitue the value stored in the variable "mail_password_form" as an "absolute URL". It's known as "DTML Entity Syntax". Check out: http://www.zope.org/Members/AlexR/EntitySyntax BTW, this is a pretty basic question, and is best addressed to the generic Zope List: [EMAIL PROTECTED] Later, Jerry S. ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] dtml-try/except triggers namespace bug
Hi, I've run into a bug with dtml-try/except with Zope 2.2.0b3. I have a folder called 'root' that looks like this: one (folder) two (folder) three (folder) a_one (dtml method) a_two (dtml method) index_html (dtml method) index_html looks like this: dtml-try dtml-var "_.getitem('a_%s' % id, 1)" dtml-except KeyError Here goes default information. /dtml-try The idea is to do the following: http://.../root/one -- invoke root/a_one http://.../root/two -- invoke root/a_two http://.../root/one/two -- invoke root/a_two http://.../root/two/one -- invoke root/a_one http://.../root/three-- "Here goes default information." http://.../root -- "Here goes default information." I'm rendering the folders under root (one, two, three, ...) with dtml-tree; I want to reconfigure my tree easily while keeping the leaves' content in one place, i.e., in a_one, a_two, etc. in root. The above works with Zope-2.1.6 but not with Zope-2.2.0b3. Here's the traceback: Zope has encountered an error while publishing this resource. Error Type: TypeError Error Value: unexpected keyword argument: error_type Traceback (innermost last): File C:\pkg\Zope220b3\lib\python\ZPublisher\Publish.py, line 222, in publish_module File C:\pkg\Zope220b3\lib\python\ZPublisher\Publish.py, line 187, in publish File C:\pkg\Zope220b3\lib\python\Zope\__init__.py, line 221, in zpublisher_exception_hook (Object: ElementWithAttributes) File C:\pkg\Zope220b3\lib\python\ZPublisher\Publish.py, line 171, in publish File C:\pkg\Zope220b3\lib\python\ZPublisher\mapply.py, line 160, in mapply (Object: index_html) File C:\pkg\Zope220b3\lib\python\ZPublisher\Publish.py, line 112, in call_object (Object: index_html) File C:\pkg\Zope220b3\lib\python\OFS\DTMLMethod.py, line 167, in __call__ (Object: index_html) File C:\pkg\Zope220b3\lib\python\DocumentTemplate\DT_String.py, line 502, in __call__ (Object: index_html) File C:\pkg\Zope220b3\lib\python\DocumentTemplate\DT_Try.py, line 212, in render File C:\pkg\Zope220b3\lib\python\DocumentTemplate\DT_Try.py, line 244, in render_try_except File C:\pkg\Zope220b3\lib\python\DocumentTemplate\DT_Util.py, line 262, in namespace TypeError: (see above) Traceback says the problem is at DocumentTemplate.DT_Util.namespace(). The 2.1.6 and 2.2.0b3 implementations are different. Plugging in 2.1.6's code fixes _this_ problem: def namespace(self, **kw): """Create a tuple consisting of a single instance whos attributes are provided as keyword arguments.""" #return apply(self, (), kw) # XXX ngps - following is the 2.1.6 implementation r=namespace_() d=r.__dict__ for k, v in kw.items(): d[k]=v return r, Cheers. -- Ng Pheng Siong [EMAIL PROTECTED] * http://www.post1.com/home/ngps ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] dtml-in: sort is not locale-aware
Hello! Currently dtml-in does not use locale when sorting the sequence. Before creating a patch I want to discuss a way dtml-in should handle this. The problem is that list.sort() does not sort according to koi8-r cyrillic locale; to make sort locale-aware I need to list.sort(locale.strcoll). But how I could ask dtml-in to use locale.strcoll? Should I add another option to dtml-in? Something like dtml-in somesequence sort=name use_locale ? Oleg.(All opinions are mine and not of my employer) Oleg Broytmann Foundation for Effective Policies [EMAIL PROTECTED] Programmers don't die, they just GOSUB without RETURN. ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] dtml-in: sort is not locale-aware
On Tue, 20 Jun 2000, mike wrote: But how I could ask dtml-in to use locale.strcoll? Should I add another option to dtml-in? Something like dtml-in somesequence sort=name use_locale ? I use dtml-in "ru_sort( somesequence)" A bit slower but works like hammer. I want to use all power of dtml-in and other zope tools. There are things where I can just write my functions and methods; and there are cases so general that it's more correct to extend zope functionality. Do you know that latest version of Zope can sort by multiple keys? How do you extend your ru_sort() to reflect the change? Oleg.(All opinions are mine and not of my employer) Oleg Broytmann Foundation for Effective Policies [EMAIL PROTECTED] Programmers don't die, they just GOSUB without RETURN. ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] DTML DTD (or DTML mode for EMACS)?
Does anybody have subject? Thanks, Mike ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )