Re: [Zope-dev] TALES idea: tuple unpacking

2003-07-23 Thread Paul Winkler
On Wed, Jul 23, 2003 at 03:59:58PM +1000, Richard Jones wrote: Say a method listFilesByUser returns a list of (user, [files]) it'd be nice to be able to:: tal:repeat=user,files here/listFilesByUser or similar. Currently we would have to use a python: expression to manually unpack

[Zope-dev] How to use dtml-sqltest tag in zsql method?

2003-07-23 Thread Anitha George
Hi Someone please help me out with this: I am passing a string in this format (215,216) from the python script to the Zsql method. The SQl query should have the following form: select * from employees where id in (215,216) but is as follows: select * from employees where id in '(215,216)'

[Zope-dev] Re: TALES idea: tuple unpacking

2003-07-23 Thread Philipp von Weitershausen
Richard Jones wrote: During the Melbourne Zope3 Sprint, someone ran up against a situation where they'd have liked to have TALES perform a tuple unpacking like Python can. I've just run into a similar situation :) Say a method listFilesByUser returns a list of (user, [files]) it'd be nice to

Re: [Zope-dev] Re: TALES idea: tuple unpacking

2003-07-23 Thread Shane Hathaway
Philipp von Weitershausen wrote: I agree that it is 'yucky', but I have to disagree with your proposed solution. I would rather suggest making TALES aware of integer indexes for sequences. Example:: tal:block repeat=user_files here/listFilesByUser User: tal:dummy replace=user_files/0 /

Re: [Zope-dev] Re: TALES idea: tuple unpacking

2003-07-23 Thread Tino Wildenhain
Shane Hathaway wrote: Philipp von Weitershausen wrote: I agree that it is 'yucky', but I have to disagree with your proposed solution. I would rather suggest making TALES aware of integer indexes for sequences. Example:: tal:block repeat=user_files here/listFilesByUser User: tal:dummy

[Zope-dev] Zope 2.7 from cvs and internationalization issues

2003-07-23 Thread Eugene Morozov
Hello! I've found today that it is simply impossible to use cyrillic characters in ZMI in the latest zope from cvs. If I don't have management_page_charset set on root folder and try to enter cyrillic title for some folder, I get following error: Error Type: UnicodeError Error Value: Latin-1

Re: [Zope-dev] Re: TALES idea: tuple unpacking

2003-07-23 Thread Philipp von Weitershausen
Shane Hathaway wrote: Here's the way I'd like to spell it: div tal:repeat=user_files here/listFilesByUser User: span tal:replace=user_files/int:0 / File: span tal:replace=user_files/int:1 / /div +1 We've come up with a number of generally useful prefixes, BTW. Off the top of my

Re: [Zope-dev] Re: TALES idea: tuple unpacking

2003-07-23 Thread Jean Jordaan
It is absolutely amazing how slippery this stuff is to pin down. The same ideas keep popping up and then slowly subsiding under the weight of exceptions, prefixes and caveats. I kinda suspect the only way is to deliver a specific take on the whole thing, like Evan did with the current ZPT, and

Re: [Zope-dev] Re: TALES idea: tuple unpacking

2003-07-23 Thread Shane Hathaway
Tino Wildenhain wrote: Shane Hathaway wrote: We've come up with a number of generally useful prefixes, BTW. Off the top of my head: call: -- Call a named method int:-- Look up an item by index format: -- Perform simple formatting operations like format:money zope: -- Access a big Zope

Re: [Zope-dev] Re: TALES idea: tuple unpacking

2003-07-23 Thread Jim Penny
On Wed, 23 Jul 2003 10:00:37 -0400 Shane Hathaway [EMAIL PROTECTED] wrote: We've come up with a number of generally useful prefixes, BTW. Off the top of my head: call: -- Call a named method int:-- Look up an item by index Hate this. Looks like a typecast of some kind, int is way

Re: [Zope-dev] Re: TALES idea: tuple unpacking

2003-07-23 Thread Jean Jordaan
int:-- Look up an item by index Hate this. Looks like a typecast of some kind, int is way to overused Aesthetically, I also find it ugly. The attractiveness of a *path* expression lies in its resemblance to a *path*. But I realise it's like the weird ++elements in Zope3 paths that I hope

Re: [Zope-dev] TALES idea: tuple unpacking

2003-07-23 Thread Gilles Lenfant
Yes, this would be more comfortable, some of my templates would be cleaner with this feature. You may work this around like this... stuff tal:define=packed python: someScript(stuff, foo, bar); item1 python: packed[0]; item2 python: packed[1] with someScript ending with... return foo, bar I'm

Re: [Zope-dev] TALES idea: tuple unpacking

2003-07-23 Thread Fred L. Drake, Jr.
Paul Winkler writes: In this case, consider a trivial change to (or wrapper around) listFilesByUser to make it return a sequence of dictionaries like {'user': some_user, 'files': (file1, file2...)} This is exactly what the proposal I posted a couple of weeks ago was trying to avoid.

Re: [Zope-dev] TALES idea: tuple unpacking

2003-07-23 Thread Fred L. Drake, Jr.
Gilles Lenfant writes: I'm interrested into adding some other wishes for the next ZPT versions. Where could those wishes be posted ? This is the place. There's only very limited resources available at Zope Corp to make changes happen right now, so be prepared to help make changes if

[Zope-dev] usage of dtml-sqltest tag in Zsql method

2003-07-23 Thread Anitha George
Hi Someone please help me out with this: I am passing a string in this format (215,216) from the python script to the Zsql method. The SQl query should have the following form: select * from employees where id in (215,216) but is as follows: select * from employees where id in

[Zope-dev] Re: TALES idea: tuple unpacking

2003-07-23 Thread Evan Simpson
Jim Penny wrote: Hate this. Looks like a typecast of some kind, int is way to overused for this. If you must, why not index: ? Hmmm. I hadn't thought of that before, but I've certainly wanted to tell the path traverser whether to use attribute, index, or key access on several occasions

Re: [Zope-dev] Re: TALES idea: tuple unpacking

2003-07-23 Thread Paul Winkler
On Wed, Jul 23, 2003 at 10:48:10AM -0400, Shane Hathaway wrote: Think of prefixes as site-wide, generally useful Python scripts. That's fine and dandy... but please please PLEASE don't let that be the only way to call them. Put them in ZTUtils, or Products.PythonScripts.standard, or someplace

[Zope-dev] Re: TALES idea: tuple unpacking

2003-07-23 Thread Philipp von Weitershausen
Evan Simpson wrote: Hmmm. I hadn't thought of that before, but I've certainly wanted to tell the path traverser whether to use attribute, index, or key access on several occasions (using 'items' as a dictionary key bites me regularly). I can imagine the pain. Explicit is better than implicit.

[Zope-dev] TALES wish : the thistemplate variable

2003-07-23 Thread Gilles Lenfant
What's behind this ? Actually, we get the template variable available in the TALES namespace. template, when used in a macro, refers to the template that uses the macro, and not to the template that contains the macro. The future (if you wish it with me) thistemplate variable will refer to the

Re: [Zope-dev] Re: TALES idea: tuple unpacking

2003-07-23 Thread Fred L. Drake, Jr.
Philipp von Weitershausen writes: Why wouldn't that be possible with a_list/index:?i? I think making it a_list/index:i is fine. The adapter for index: will get the index as a string and convert that to an integer and return a_list[i]. The index: adapter simply represents a namespace in which

Re: [Zope-dev] TALES wish : the thistemplate variable

2003-07-23 Thread Shane Hathaway
Gilles Lenfant wrote: What's behind this ? Actually, we get the template variable available in the TALES namespace. template, when used in a macro, refers to the template that uses the macro, and not to the template that contains the macro. IMHO the underlying problem is that there's no clean way

Re: [Zope-dev] Re: TALES idea: tuple unpacking

2003-07-23 Thread Shane Hathaway
(I'm cc'ing zope-dev this time) Evan Simpson wrote: Jim Penny wrote: Hate this. Looks like a typecast of some kind, int is way to overused for this. If you must, why not index: ? Hmmm. I hadn't thought of that before, but I've certainly wanted to tell the path traverser whether to use

Re: [Zope-dev] Re: TALES idea: tuple unpacking

2003-07-23 Thread Paul Winkler
On Wed, Jul 23, 2003 at 11:07:20AM -0500, Evan Simpson wrote: ... This would allow options/a_mapping/key:items/index:0 rather than python:options['a_mapping']['items'][0]. Why is that an improvement? surely it's not saving 3 characters that makes the new syntax worthwhile...

Re: [Zope-dev] Re: TALES idea: tuple unpacking

2003-07-23 Thread Fred L. Drake, Jr.
Paul Winkler writes: I guess I don't understand the goal. Are we trying to make it so that zpt authors don't have to know any python? I really think that's a mistake. There are those that consider using python: expressions in ZPT should be discouraged, primarily because it's yet another

Re: [Zope-dev] Re: TALES idea: tuple unpacking

2003-07-23 Thread Paul Winkler
On Wed, Jul 23, 2003 at 02:04:51PM -0400, Fred L. Drake, Jr. wrote: There are those that consider using python: expressions in ZPT should be discouraged, primarily because it's yet another syntax for a web developer to learn. I'm not necessarily one of them, but I am sympathetic with that

Re: [Zope-dev] Re: TALES idea: tuple unpacking

2003-07-23 Thread Dieter Maurer
Shane Hathaway wrote at 2003-7-23 10:48 -0400: ... Think of prefixes as site-wide, generally useful Python scripts. Quite often some API returns something that's intuitively easy to present, but ZPT's syntax makes it somewhat difficult to present. For example, it should not be

Re: [Zope-dev] Re: TALES idea: tuple unpacking

2003-07-23 Thread Shane Hathaway
Paul Winkler wrote: On Wed, Jul 23, 2003 at 02:04:51PM -0400, Fred L. Drake, Jr. wrote: There are those that consider using python: expressions in ZPT should be discouraged, primarily because it's yet another syntax for a web developer to learn. I'm not necessarily one of them, but I am

Re: [Zope-dev] Re: TALES idea: tuple unpacking

2003-07-23 Thread Paul Winkler
On Wed, Jul 23, 2003 at 05:15:48PM -0400, Shane Hathaway wrote: Paul Winkler wrote: On Wed, Jul 23, 2003 at 02:04:51PM -0400, Fred L. Drake, Jr. wrote: There are those that consider using python: expressions in ZPT should be discouraged, primarily because it's yet another syntax for a web

Re: [Zope-dev] Re: TALES idea: tuple unpacking

2003-07-23 Thread Paul Winkler
On Wed, Jul 23, 2003 at 06:15:46PM -0400, Paul Winkler wrote: (snip) I think I'd have to try rewriting some of my complex templates with no python expressions whatsoever before I'd know if I agree with you. (snip) I only use 2 because it's there :-) Thinking more about it, it occurs to me

Re: [Zope-dev] Re: TALES idea: tuple unpacking

2003-07-23 Thread Shane Hathaway
Dieter Maurer wrote: Be very reluctant to extend TALES. Do not do it do get just syntactic sugar in order to save a few lines of code. I agree that we should be wary. Adding a feature to make something simpler simultaneously complicates the whole picture. To offset that negative, the new