Re: Web development with Python 3.1

2009-11-03 Thread mario ruggier
With respect to to original question regarding web frameworks + database and Python 3, all the following have been available for Python 3 since the day Python 3.0 was released: QP, a Web Framework http://pypi.python.org/pypi/qp/ Durus, a Python Object Database (the "default" in qp, for user sessi

Re: Object Relational Mappers are evil (a meditation)

2009-10-16 Thread mario ruggier
On Oct 5, 4:25 pm, Aaron Watters wrote: > Occasionally I fantasize about making a non-trivial change > to one of these programs, but I strongly resist going further > than that because the ORM meatgrinder makes it somewhere > between extremely unpleasant and impossible to make any > non-trivial c

Re: List comprehension - NameError: name '_[1]' is not defined ?

2009-01-22 Thread mario ruggier
On Jan 16, 7:17 pm, Paul Rubin <http://phr...@nospam.invalid> wrote: > mario ruggier writes: > > All the above attempts will be blocked this way. Any other disallow- > > sub-strings to add to the list above? > > I think what you are trying to do is fundamentally hop

Re: List comprehension - NameError: name '_[1]' is not defined ?

2009-01-17 Thread mario ruggier
Just to add that a further potential subversion possibility could have been to build the expr in some way from within a template, and then dynamically setting that string as the source of a new template with from_string=True. This is precisely the reason why **from within a template** evoque has ne

Re: List comprehension - NameError: name '_[1]' is not defined ?

2009-01-17 Thread mario ruggier
On Jan 17, 12:04 am, ajaksu wrote: > On Jan 16, 3:45 pm, mario ruggier wrote: > > > > '(x for x in ()).throw("bork")' > > > What is the potential security risk with this one? > > I don't see a concrete issue, just found it tempting... ra

Re: List comprehension - NameError: name '_[1]' is not defined ?

2009-01-16 Thread mario ruggier
On Jan 16, 1:35 pm, ajaksu wrote: > On Jan 16, 5:09 am, mario ruggier wrote: > > > Laboriously doing all these > > checks on each expr eval will be very performance heavy, so I hope to > > be able to limit access to all these more efficiently. Suggestions? > > None

Re: List comprehension - NameError: name '_[1]' is not defined ?

2009-01-15 Thread mario ruggier
On Jan 16, 2:30 am, ajaksu wrote: > On Jan 15, 8:21 pm, mario ruggier wrote: > > > OK! Here's a small script to make it easier... > > Thanks! I think I found a quick way around the restrictions (correct > me if I borked it), but I think you can block this example b

Re: List comprehension - NameError: name '_[1]' is not defined ?

2009-01-15 Thread mario ruggier
On Jan 15, 11:35 pm, Terry Reedy wrote: > Peter Otten wrote: > > List comprehensions delete the helper variable after completion: > > I do not believe they did in 2.4.  Not sure of 2.5.  There is certainly >   a very different implementation in 3.0 and, I think, 2.6.  OP > neglected to mention Pyt

Re: List comprehension - NameError: name '_[1]' is not defined ?

2009-01-15 Thread mario ruggier
On Jan 15, 10:35 pm, ajaksu wrote: > On Jan 15, 1:56 pm, mario ruggier wrote: > > > As > > I mentioned in another thread, the real application behind all this is > > one of the *few* secure templating systems around. Some info on its > > security is at:http://evoqu

Re: List comprehension - NameError: name '_[1]' is not defined ?

2009-01-15 Thread mario ruggier
On Jan 15, 9:36 pm, Mark Wooding wrote: > mario ruggier writes: > > Some info on its security is at: > >http://evoque.gizmojo.org/usage/restricted/ > > Tell you what, if you find a security hole there (via exposed template > > source on a Domain(restricted=True) s

Re: List comprehension - NameError: name '_[1]' is not defined ?

2009-01-15 Thread mario ruggier
The listcomps exploration above was primarily an attempt (unsuccessful) to make this piece of code go a little faster: s = " text %(item)s text " acc = [] for value in iterator: some_dict["item"] = value acc.append(s % evaluator) "".join(acc) The item=value pair is essentially a loop vari

Re: List comprehension - NameError: name '_[1]' is not defined ?

2009-01-15 Thread mario ruggier
On Jan 15, 4:06 pm, Steven D'Aprano wrote: Hi Steve! > > class GetItemEvaluator(object): > >     def __init__(self): > >         self.globals = globals() # some dict (never changes) Ya, this is just a boiled down sample, and for simplicity I set to to the real globals(), so of course it will ch

Re: List comprehension - NameError: name '_[1]' is not defined ?

2009-01-15 Thread mario ruggier
On Jan 15, 2:02 pm, Peter Otten <__pete...@web.de> wrote: > mario ruggier wrote: > > Hello, > > > I would like to evaluate list comprehension expressions, from within > > which I'd like to call a function. For a first level it works fine but > > f

Re: List comprehension - NameError: name '_[1]' is not defined ?

2009-01-15 Thread mario ruggier
On Jan 15, 1:48 pm, bearophileh...@lycos.com wrote: > mario ruggier, that's a hack that you can forget. Your code can't be > read. Don't use list comps for that purpose. Write code that can be > read. Ya, agree with you whole-heartily, but then so are most optimizations

Re: List comprehension - NameError: name '_[1]' is not defined ?

2009-01-15 Thread mario ruggier
On Jan 15, 12:29 pm, mario ruggier wrote: > Any ideas why? > > Note, i'd like that the first parameter to ts() is as independent as > possible from the context in expression context, a sort of independent > mini-template. Thus, the i,j enumerate counters would normally not

List comprehension - NameError: name '_[1]' is not defined ?

2009-01-15 Thread mario ruggier
Hello, I would like to evaluate list comprehension expressions, from within which I'd like to call a function. For a first level it works fine but for second level it seems to lose the "_[1]" variable it uses internally to accumulate the results. Some sample code is: class GetItemEvaluator(object

Installation of Py3.0rc1 fails on Mac OS X with bad locale

2008-11-01 Thread Mario Ruggier
Hi, i had the following problem when installing py3.0rc1 on a Mac OS X 10.5.5. On this system, the default locale values are: $ locale LANG= LC_COLLATE="C" LC_CTYPE="UTF-8" LC_MESSAGES="C" LC_MONETARY="C" LC_NUMERIC="C" LC_TIME="C" LC_ALL= but "UTF-8" is is not a value for LC_CTYPE that is

ValueError: unknown locale: UTF-8

2008-05-31 Thread Mario Ruggier
On OS X 10.5.2 : $ python Python 2.5.1 (r251:54863, Feb 4 2008, 21:48:13) [GCC 4.0.1 (Apple Inc. build 5465)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import locale >>> locale.getdefaultlocale() Traceback (most recent call last): File "", line 1, in

Is it explicitly specified?

2008-02-03 Thread mario ruggier
Is there any way to tell between whether a keyword arg has been explicitly specified (to the same value as the default for it) or not... For example: def func(key=None): do something with key But the following two usages give same results: func() func(key=None) It may sometimes be useful t