Re: Chameleon macro examples

2013-05-10 Thread Malthe Borch
On 8 May 2013 23:12, Mike Orr wrote: > 'self' maps straightforwardly to Chameleon's slots, but how do you do the > equivalent of 'next' and 'parent'? For instance, if some page templates want > to put the base content in an unusual order, and others want to overrride it > completely, but you don't

Re: Chameleon macro examples

2013-05-04 Thread Malthe Borch
On 4 May 2013 00:48, Mike Orr wrote: > Are there any good examples around of using Chameleon with a site template > macro? I normally make my sites by inheriting from a Mako template that > provides a standard and header/footer, with the page template > overriding the title, possibly adding style

Re: Chameleon macro examples

2013-05-04 Thread Malthe Borch
On 4 May 2013 00:50, Mike Orr wrote: > Also, is there a way to make Chameleon put its compiled templates in a > different directory from the source? On my server the source directory will > be read-only at runtime. Or is there a command to precompile all templates > in one step? The CHAMELEON_CAC

Re: Pyramid Books Published by O'Reilly

2013-04-04 Thread Malthe Borch
On 4 April 2013 23:54, Whit Morriss wrote: > I'd love a cookbook along the lines of "Solving Web Development Problems with > Pyramid and friends". Something that would cover all the basic and not so > basic things one encounters when building HTTP focussed applications without > annoying pedan

Re: get data from tabel and send to view

2013-03-16 Thread Malthe Borch
oups > "pylons-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to pylons-discuss+unsubscr...@googlegroups.com. > To post to this group, send email to pylons-discuss@googlegroups.com. > Visit this group at http://groups.g

Re: The problem with using KeyError for non-existing resources and traversal

2013-03-06 Thread Malthe Borch
On 6 March 2013 12:01, Peter Waller wrote: > The problem is that I want my users *to use pyramid*, i.e, I want to take > advantage of the wonderful documentation and framework of Pyramid. That > means that I want to build my application on top of it. The way I see it, > there is a fundamental conf

Re: Handling Current Page in Navigation Bar in Chameleon Templates

2013-02-27 Thread Malthe Borch
On 27 February 2013 17:16, Jonathan Vanasco wrote: > In mako templates, then it's just... > > Home > About > > IIRC, tal allows for conditional attributes In Chameleon, which implements its own dialect of TAL, we have the pipe operator ("|"): ${request.NavTabs.home|nothing} Meaning th

Re: Handling Current Page in Navigation Bar in Chameleon Templates

2013-02-27 Thread Malthe Borch
On 27 February 2013 05:35, Derek Hildreth wrote: > It was simple and kept the feeling of keeping the view with template and > code with the controller. Thanks again. I turned your example into a test-case, showing a way that you can use `tal:repeat` to avoid repeating yourself: https://gith

Re: Handling Current Page in Navigation Bar in Chameleon Templates

2013-02-26 Thread Malthe Borch
On 26 February 2013 00:04, Derek Hildreth wrote: > How might I apply this concept to a chameleon template? Is there a better, > or more pythonic/pyramidic/chameleonic way of doing this other than > 'if/then' statements within the template? I'm thinking it would be best to > keep the view logic a

Chameleon documentation

2013-02-08 Thread Malthe Borch
As per Chris Rossi's suggestion: https://chameleon.readthedocs.org/en/latest/ Thanks, \malthe -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to pylons-dis

Re: wake of the RoR sql injection vulnerability

2013-01-10 Thread Malthe Borch
On 10 January 2013 05:31, Wyatt Baldwin wrote: > What does this have to do with interpreted languages? Can't this type of > thing happen with any language? Seems like it has more to do with the > framework rather than compiled vs interpreted or static vs dynamic. It can happen with any language,

Re: wake of the RoR sql injection vulnerability

2013-01-09 Thread Malthe Borch
On 9 January 2013 18:14, Chris McDonough wrote: > The most recent vulnerability > ( https://groups.google.com/forum/?fromgroups=#! > topic/rubyonrails-security/61bkgvnSGTQ ) might allow for SQL injection > as a side effect, but it's actually much worse than just that. It > allows for arbitrary Ru

Re: Why is Chameleon's MemoryLoader used in non-debug mode

2012-12-14 Thread Malthe Borch
On 14 December 2012 11:55, Huub Bouma wrote: > However, the class is still instantiated on each request, and so the > template is still compiled once for each request. If you're using the same loader object, then it shouldn't instantiate a template more than once. That's because the `load` metho

Re: Why is Chameleon's MemoryLoader used in non-debug mode

2012-12-13 Thread Malthe Borch
On 13 December 2012 13:20, Huub Bouma wrote: > I noticed a poor performance when rendering lot's of chameleon templates. I > found the problem to be that the MemoryLoader was used. Once I switched to > the ModuleLoader the performance was good. What you should do is probably use the template load

Re: why use chameleon's MemoryLoader in production mode

2012-12-13 Thread Malthe Borch
ylons-discuss/-/vBdD1VXceSYJ. > To post to this group, send email to pylons-discuss@googlegroups.com. > To unsubscribe from this group, send email to > pylons-discuss+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/pylons-discuss?hl=en.

Re: Chameleon on Google App Engine

2012-12-11 Thread Malthe Borch
http://groups.google.com/group/pylons-discuss?hl=en. -- Au revoir, et tous mes voeux pour un avenir plein de succès et de bonheur –– Malthe Borch mbo...@gmail.com -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To p

Re: Good form library for pyramid ? Better doing it by hand ?

2012-12-06 Thread Malthe Borch
group, send email to pylons-discuss@googlegroups.com. > To unsubscribe from this group, send email to > pylons-discuss+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/pylons-discuss?hl=en. -- Au revoir, et tous mes voeux pour u

Re: getting old style path expression with chameleon

2012-11-27 Thread Malthe Borch
On 27 November 2012 10:59, Chris Withers wrote: > I would be nice to have path expressions in the core package, and with an > easy switch for the default expression type to use... What I'd personally like is "auto-detect", except it can't work because of the "call" feature: in Zope's path express

Re: getting old style path expression with chameleon

2012-11-27 Thread Malthe Borch
On 27 November 2012 10:47, Chris Withers wrote: > What are template("target = value", target=target, value=call) objects? That's just a way to avoid creating ``ast`` syntax trees manually (which is arguably better and faster, but tedious). I'm not particularly happy with the code generation faci

Re: getting old style path expression with chameleon

2012-11-27 Thread Malthe Borch
On 27 November 2012 07:58, Chris Withers wrote: > How can I get back the old ZPT style of path expression? > > eg: > > > > ...would unpack and do the view.macros['page'] for me? I have adapted this code from the path implementation in `z3c.pt`: https://gist.github.com/4153332 You would hav

Re: Proper pattern for Pyramid, MongoDB and models.py

2012-11-23 Thread Malthe Borch
On 23 November 2012 11:27, Christoph Haas wrote: > Not exactly. I want to store non-relational data (nested "rich" data > objects) without joining tables together. The application I'm working on > is rather simple and the data can all be put into one (JSON) structure. > So it seemed a good fit for

Re: Proper pattern for Pyramid, MongoDB and models.py

2012-11-22 Thread Malthe Borch
On 23 November 2012 01:10, Christoph Haas wrote: > ... [snip] so later I could perhaps replace MongoDB by something else > but have all the abstraction in the models.py. I think this is missing the point: you're using MongoDB because you need or want some subset of features. You can't draw a par

Re: Recommendations for having a static index page

2012-11-14 Thread Malthe Borch
On 14 November 2012 22:28, Ellison Marks wrote: > Use a template. This strikes me as a pretty bad idea right off. The `pyramid_skins` package provides a small "framework" that addresses this (and other) need: http://packages.python.org/pyramid_skins/ \malthe -- You received this message b

Re: recommend a wysiwyg editor for a pyramid project?

2012-11-08 Thread Malthe Borch
On 7 November 2012 22:18, Chris Withers wrote: > What's the editor choice to go for nowadays? http://aloha-editor.org/ If you're interested in inline-editing, http://createjs.org/ is a good pick. \malthe -- You received this message because you are subscribed to the Google Groups "pylons-dis

Re: Scaling resques/second processed by using multiple process?

2012-11-06 Thread Malthe Borch
On 5 November 2012 22:13, Frédéric Bastien wrote: > As we have multi-cores CPU, is there a way to make use of them to get faster > results? Each view have been done to scale between server. So there is no > concurency problem. Each CPython-process will use only one core; you will just have to run

Re: Instaneous compilation of less, coffee, running tests

2012-11-04 Thread Malthe Borch
On 4 November 2012 20:29, Petr Blahos wrote: > What he does there, he basically has a file watcher and whenever his style > changes, > it is compiled with stylus, whenever his coffee script changes, it gets > translated to > js, whenever his js changes, tests are run. You can do this sort of thin

Re: [Pyramid/Chameleon] slots mechanism not working

2012-11-01 Thread Malthe Borch
d email to pylons-discuss@googlegroups.com. > To unsubscribe from this group, send email to > pylons-discuss+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/pylons-discuss?hl=en. > > -- Au revoir, et tous mes voeux pour un

Re: using zodb with pyramid for simulations/lots of writing

2012-08-28 Thread Malthe Borch
On 28 August 2012 21:20, Iain Duncan wrote: > Thanks Malthe. I had been hoping that a pure object database would make the > data modelling a lot simpler. Can you weigh in on how much the above issues > would be a problem? Like is it so bad that I just abandon the idea and > figure it out in SQLAlc

Re: using zodb with pyramid for simulations/lots of writing

2012-08-27 Thread Malthe Borch
On 28 August 2012 06:34, Iain Duncan wrote: > I expect this project will be doing a *lot* of writes. IE, maybe even all > hits do some minor mutation. On the other hand, I have a hunch that the > architecture could wind up being really clean in zodb as it's going to be a > lot of object modelling

Re: Is there a terser way to get a reference to my DB than self.request.root.db?

2012-08-11 Thread Malthe Borch
You could write a base class that defined it as a `property`. On 11 August 2012 08:03, Zak wrote: > self.request.root.db is quite a bit of dot notation and I'm wondering if > there is a shortcut or better way to get db. > > -- > You received this message because you are subscribed to the Google G

Re: Is this correct?

2012-08-06 Thread Malthe Borch
On 6 August 2012 05:24, Sayth Renshaw wrote: > What would the disadvantage be of using Pyramid over a PHP framework ? PHP was created specifically to create simple, dynamic web sites. Python is a general-purpose language and much more capable. If you have simple needs and little programming expe

Re: Is this correct?

2012-08-06 Thread Malthe Borch
On 6 August 2012 15:03, Chris Rossi wrote: > On Sun, Aug 5, 2012 at 11:24 PM, Sayth Renshaw wrote: >> Hi >> >> I am new to web development and have been using asp and visual studio at >> college. Wanting to swap over to an open source format. >> >> Want to clarify a perception/s would an advantag

Re: Pylons/Pyramid Performance

2012-06-06 Thread Malthe Borch
On 6 June 2012 06:10, Biswas, Pinakee wrote: > Could you please let me know if there is any performance statistics > available for Pylons/Pyramid? If you need to provide > 100 views per sec on a single core, for a non-trivial application, then Python probably isn't fast enough. Otherwise, Pyrami

Re: Database access pattern

2012-06-06 Thread Malthe Borch
On 6 June 2012 11:59, tanshu wrote: > I read that documentation and am using the same, but my question was about > where these statements should be put?  In the view, a separate class (eg. > DAL pattern), or in the Model? I think you'll want to everything in your view code, unless it's very gener

Re: Database access pattern

2012-06-06 Thread Malthe Borch
http://docs.sqlalchemy.org/en/latest/orm/tutorial.html That's assuming you're using SQL. \malthe On 6 June 2012 09:50, tanshu wrote: > Hi, > I am sorry if this has been asked before, but I couldn't find the answer > anywhere.  I am relatively new to python / pyramid and have developed a few > t

Re: Default template variables

2012-05-14 Thread Malthe Borch
On 14 May 2012 07:30, Максим Коринец wrote: > To add to other answers - while using Mako I sometimes implement default > rendering like this: > > ${variable or 'some default value'} > > So, if variable is None, some default value is rendered. Don't know if this > will work with Chameleon though.

Re: Pyramid + Dojo

2012-05-10 Thread Malthe Borch
It seems like the Dojo-library didn't load correctly, because `dom` isn't defined. This is a Javascript-issue though. \malthe On 10 May 2012 04:19, Fabian Jiménez wrote: > Hello to all, I'm novice in pyramid and chameleon. I need to integrate > zpt templates with Dojo. Next a test code, Javacrip

Re: Default template variables

2012-05-10 Thread Malthe Borch
On 9 May 2012 06:27, Theron Luhn wrote: > I can pass variables into my template by returning them in a dictionary from > the view controller. However, if I try to access a variable from the > template that I didn't pass, I'll get an error.  Is it possible to have a > default value so I don't get a

Re: Python's memory hogging

2012-05-05 Thread Malthe Borch
On 6 May 2012 04:27, Vlad K. wrote: > I've got about 20 XML file formats to construct, each produced by its own > (pluggable) module because each defines its own format etc... Switching to a > file-based partial generation would mean a massive rewrite. I guess this is > one of the situations where

Re: UnicodeDecodeError when chameleon.zpt contains Chinese character

2012-05-04 Thread Malthe Borch
On 4 May 2012 06:33, Geo wrote: > I'm getting "UnicodeDecodeError: 'ascii' codec can't decode byte 0xe4 in > position 0: ordinal not in range(128)" when I include Chinese character in > the chameleon template. I'm using the newest pyramid 1.3 with python2.7. Any > help? You need to specify an enc

Re: Default doctype in Chameleon

2012-04-30 Thread Malthe Borch
On 30 April 2012 23:44, Theron Luhn wrote: > I want to specify a default doctype in Chameleon. > > How do I do that in Pyramid? You can use a "master" template and put the doctype in there, as XML. \malthe -- You received this message because you are subscribed to the Google Groups "pylons-di

Re: Is there a templating system for generating PDFs?

2012-04-05 Thread Malthe Borch
On 6 April 2012 08:43, Ottavio wrote: > I'm looking for a templating system for generating pdf files from pyramid. You can use Chameleon to generate HTML which you'll then give to a PDF formatter such as the CSS3-capable PrinceXML – that's a commercial offering though. An alternative is Apache F

Using pdb.set_trace() in Chameleon

2012-02-29 Thread Malthe Borch
Just wanted to note that as of 2.8.0 (just released), you can now embed Python code blocks in templates. This makes it easy to enter the debugger from inside a template: ... It works best if you're running in debug-mode since then the generated source code is written out to disk, l

Re: Storing settings on module level -- bad idea?

2012-01-31 Thread Malthe Borch
On 31 January 2012 13:43, Robert Forkel wrote: > fwiw: when I started using pyramid I was also reluctant to pass around > the request all the time. But it turned out to be the right (and > transparent) thing to do. In my case this is because I often need > request-specific information like the loc

Re: Using Chameleon Templat

2012-01-29 Thread Malthe Borch
On 15 January 2012 16:22, Dennis Wanyoike wrote: > My problem is that the variable prev_username is not always present in > the view code when i use tal:on-error="donothing" the input textbox > will not be displayed is there another way i can make the > prev_username variable be ignored? tal:attr

Re: Chameleon

2011-12-28 Thread Malthe Borch
On 28 December 2011 23:25, Julien Cigar wrote: >      tal:define="tinymce False"> This ^^^ was in your template that defines the macro. It should have read: tal:define="tinymce tinymce | False" That's because the "|" pipe operator will catch NameError, and proceed to the next value, False in

Re: Is there any case where chameleon is more preferred?

2011-12-18 Thread Malthe Borch
On 18 December 2011 13:26, Chris Withers wrote: > But, as mcdonc said, it's marginal, they all suck in different and special > ways. My gripe with Mako is that it's too easy to generate invalid html, my > gripe with ZPT is that it's *hard* to generate valid CSS/JS. Bit of a cheap gripe I feel, se

Re: Is there any case where chameleon is more preferred?

2011-12-18 Thread Malthe Borch
On 18 December 2011 12:42, Christoph Zwerschke wrote: > [snip] I see many people using ${...} substion in Genshi > everywhere. If you do this, you loose the benefits of an attribute language > and can just as well use Mako. That's not entirely true. Chameleon knows if its "inside" an attribute or

Re: Is there any case where chameleon is more preferred?

2011-12-18 Thread Malthe Borch
On 17 December 2011 14:28, Joshua Partogi wrote: > I am left undecided whether to use mako or chameleon. From what I have > observed, it seems that chameleon is the default template language in > pyramid (CMIIW). Is there any case where chameleon is more preferred > when using pyramid? I actually

Re: memory leak debugging

2011-12-12 Thread Malthe Borch
On 12 December 2011 17:25, writeson wrote: > I've got a pylons application that's got a memory leak, I think from > Ajax/JSON calls coming from the application JavaScript. How do I go > about debugging/finding this problem? I've read some stuff online > about using Dozer, but have not had any luck

Re: Zope 2 on a Pyramid

2011-12-01 Thread Malthe Borch
On 2 December 2011 00:22, Daniel Nouri wrote: > Kotti likes to sit as closely as possibly on top of Pyramid, thus > Pyramid itself is its 'environment'. I have recently had the chance to work on a CMS-like system which was also just built straight on top of Pyramid (although it ran against MongoD

Zope 2 on a Pyramid

2011-12-01 Thread Malthe Borch
I use Zope 2 every day. It feels like a confession, but it's also a symptom: there's nothing quite like it for Python (and there's still something to it). What's Zope 2 got to do with Pyramid? Nothing much, but this morning I had the idea that Zope 2 is exactly what's missing from Pyramid. And per

Re: deform renderer

2011-11-28 Thread Malthe Borch
On 28 November 2011 12:11, Arndt Droullier wrote: > Anyway, in my case there seems to be a problem with Ubuntu and the > filesystem. Old "ext 3" formatted drives don't work very well with new > Ubuntu versions. And since Chameleon templates are stored in the temp > directory this slows down everyt

Re: deform renderer

2011-11-27 Thread Malthe Borch
On 28 November 2011 08:05, Robert Forkel wrote: > Ah, right, I remember, couldn't get it to work for me, though; and i > guess i stopped researching after having found a workaround. But you > do say that also with a custom deform renderer both caching and > internationalization will work without k

Re: deform renderer

2011-11-27 Thread Malthe Borch
On 27 November 2011 09:58, Robert Forkel wrote: > This is consistent with what i experienced without caching the templates. So > i ended up creating the factories at app start and register these as > utilities, named with the locale (you will need One per locale you want to > support). Just use t

Re: deform renderer

2011-11-26 Thread Malthe Borch
Do you have a good reason not to create the renderer factory in advance? You're probably right that it means the template will be compiled for every rendering, judging from the experience you state. \malthe On 26 November 2011 14:57, Arndt wrote: > Hi all, > I'm using the 'renderer' option (ZPT

Re: Looping throug lists in a template using a for loop produces a NameError

2011-11-17 Thread Malthe Borch
On 16 November 2011 17:43, David Eagle wrote: > > % if cisList: >    % for item in cisList: >     >        ${item['name']} >     >    %endfor > % endif > Note that Chameleon understands the ${...} syntax, but not Mako's % character – so you end up with an error because `item` is not defined (i.

Re: Multiple transactions within request

2011-11-13 Thread Malthe Borch
On 13 November 2011 16:02, Vlad K. wrote: > TransactionFailedError: An operation previously failed, with traceback I think you have to issue a manual rollback in case of a transaction abort. \malthe -- You received this message because you are subscribed to the Google Groups "pylons-discuss"

Re: Multiple transactions within request

2011-11-12 Thread Malthe Borch
On 12 November 2011 01:07, Vlad K. wrote: > Is it possible to have multiple transactions within a request, and how to > start new one after transaction.commit() is manually invoked? A new one is always started after a call to commit(). In other words: it just works. \malthe -- You received thi

Re: Chameleon: tal:condition test variable existence

2011-10-30 Thread Malthe Borch
Try using "exists:". http://pagetemplates.org/docs/latest/reference.html#types E.g. ... \malthe On 29 October 2011 15:34, Mark Erbaugh wrote: > Is there a way in a tal:condition test to test if a given variable has been > defined?  For example, if my view callable has not define

Re: Pyramid Chameleon

2011-10-27 Thread Malthe Borch
On 27 October 2011 23:02, Mark Erbaugh wrote: > In the Zope2 Book (documentation), section 27.22.1 mentions special handling > of the tal:condition operation when ued with the checked or selected > attributes which makes it easier to pass an initial value to a checkbox, > radio or select contro

Re: Recommended way to do background processing once the response is sent

2011-10-17 Thread Malthe Borch
On 16 October 2011 21:14, ravi teja wrote: > Does response callback work for this? Should I use a messaging queue to > provide the handling to another service? You *can* use the transaction manager for this – it's possible to attach a handler that's called after the response has been sent back.

Re: in defense of traversal

2011-10-12 Thread Malthe Borch
On 12 October 2011 21:33, Michael Merickel wrote: > It's harder than it sounds to actually utilize that. Each step of traversal > expects a new context object, and there isn't an obvious spot in the > traversal process to say "ok we're done, now perform the query". Also AFAIK > SQLAlchemy doesn't

Re: Is there a best practice way to do csrf checking with deform

2011-10-05 Thread Malthe Borch
On 3 October 2011 20:15, Bobby wrote: > I was thinking of editing the deform.form class and adding the request > as a keyword param. The request would then be used to create a token > attribute in the __init__ method with the rest of the attributes. Then > I would create a custom form template and

Re: deform and chameleon >= 2.x

2011-09-30 Thread Malthe Borch
On 30 September 2011 13:42, Robert Forkel wrote: > hi all, > just ran into an issue which may be of interest for others too. While > using deform with chameleon 2.x does work for me, i18n message > extraction with lingua for templates does generally not. This is > because the lingua_xml extractor

Syntax for non-escaped insertion via ${...} in Chameleon

2011-09-24 Thread Malthe Borch
Recently, I fixed an issue in Chameleon such that inline expressions – ${...} – are now correctly escaped before insertion into the document. That was surprising to some users, who'd become accustomed to the buggy behavior. Note that the syntax is from Genshi which has more or less defined its beh

Re: Is there any way to do read-only form fields in deform

2011-09-24 Thread Malthe Borch
On 23 September 2011 23:13, Chris Rossi wrote: > There is no way baked into deform. And actually, often you'll want to display your data in some sort of custom way. On our current project for instance, we have a "username" column. I like it to be shown as "${username}". So I simply use: field

Re: chameleon: getting started

2011-09-14 Thread Malthe Borch
On 14 September 2011 00:08, ru...@yahoo.com wrote: > u'Hello, $name.' > > why does not the template variable get substituted? Sorry about that. It was changed in 2.1. After this release, you must use brackets. I'll update the documentation right away. Thanks, \malthe -- You received this me

Re: Extracting translation strings for templates using include macros

2011-08-30 Thread Malthe Borch
On 30 August 2011 01:54, Benjamin Sims wrote: > In case this helps any future seeker, the problem here was that I had > omitted one of the required namespace definitions. The HTML header must > include: > >       xmlns:metal="http://xml.zope.org/namespaces/metal"; > > > otherwise any tags containi

Re: Conditional attributes using Chameleon

2011-08-21 Thread Malthe Borch
On 21 August 2011 21:01, Gustavo Fonseca wrote: > I think it would be something like: > Except there should be no quotes around ``default`` (it's a special variable name, not a string). \malthe -- You received this message because you are subscribed to the Google Groups "pylons-discuss" grou

Re: Chameleon's behavior on attribute insert with boolean values

2011-08-19 Thread Malthe Borch
On 19 August 2011 13:58, Chris McDonough wrote: > I think probably that the Zopelike behavior should be limited to > integration with Zope. I think you're right. There's now an option ``literal_false`` which does this. As a detail which I don't think will affect the vast majority of users, a va

Chameleon's behavior on attribute insert with boolean values

2011-08-19 Thread Malthe Borch
I had a chat with Danny Bloemendaal about some differences in how Zope and Chameleon understands attribute result values (in the ``tal:attributes`` statement), specifically boolean values. In a recent change, Chameleon now does support Zope's behavior on a set of special case attributes: BOOLEA

Re: is it possible to use virtual environment with pylons without activation?

2011-08-14 Thread Malthe Borch
On 14 August 2011 21:22, Krishnakant Mane wrote: > Thanks a lot for this pointer. > However there is a small problem in this case. > before I initiate the serving of my pylons app from the vertual environment, > I have to start another service, this one being a twisted server for xmlrpc. > The cor

Re: deform: template cache and i18n

2011-08-12 Thread Malthe Borch
slate = t >                renderer.loader.kwargs['translate'] = ChameleonTranslate(t) > > This works well enough to not feel like a problem anymore; it just > looks hacky. So for my use case, a TemplateLoader which accepts a > translator as parameter to the load method would

Re: deform: template cache and i18n

2011-08-12 Thread Malthe Borch
On 12 August 2011 10:05, Robert Forkel wrote: > hm. I do not really follow. I'll try to explain my problem in more > detail. First, I only use Chameleon from within deform, the rest of my > app uses mako. Now I noticed that form rendering was slow and that was > because of the template loader pars

Re: deform: template cache and i18n

2011-08-12 Thread Malthe Borch
On 11 August 2011 19:33, Robert Forkel wrote: > Yes, that's what I'm doing now. Right now it's sort of tied to the > TemplateLoader, though - at least the way deform uses Chameleon. So > what I do is keep the zpt renderers around and assign to > renderer.loader.kwargs['translate'] per request - no

Re: deform: template cache and i18n

2011-08-11 Thread Malthe Borch
On 11 August 2011 14:43, Robert Forkel wrote: > ok. i got chameleon 2.3 to work. but I still think I have to keep > locale specific TeplateLoaders around to make caching work, because > the registry key for a template does still not take locale into > account, thus may retrieve a template with the

Re: deform: template cache and i18n

2011-08-11 Thread Malthe Borch
On 11 August 2011 13:42, Robert Forkel wrote: > Upgrading does not work. Deform complains: > >  File ".../lib/python2.6/site-packages/deform/template.py", line 4, in > >    from chameleon.zpt import language > ImportError: cannot import name language You need deform>=0.9.2. \malthe -- You re

Re: deform: template cache and i18n

2011-08-11 Thread Malthe Borch
On 11 August 2011 10:19, Robert Forkel wrote: > I noticed that deform form rendering is somewhat slow in my > application and found the @cache decorator in deform.template. I'd > like my templates to be cached, but since I use i18n, thus passing > translators to initialize a template loader on a p

Re: Does Chameleon have a comment syntax?

2011-08-10 Thread Malthe Borch
On 10 August 2011 13:24, Christoph Zwerschke wrote: > Why don't you do it the same way as in Kid and Genshi? Just looked it up > again, and as I already said, Kid and Genshi pass normal XML comments > except when they start with a "!" [... snip] But this is exactly what's in Chameleon already. I

Re: Does Chameleon have a comment syntax?

2011-08-10 Thread Malthe Borch
On 10 August 2011 13:05, Benjamin Sims wrote: > This is: > > Chameleon-1.3.0_rc1 > pyramid-1.1a1 You should be able to upgrade to Chameleon 2.2. \malthe -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to py

Re: Does Chameleon have a comment syntax?

2011-08-10 Thread Malthe Borch
Actually I had this wrong. The syntax to drop a comment was always: That's from Genshi and it's been in there since 2.0-rc11. To add to the confusion, I've just added support for: \malthe On 9 August 2011 17:26, Benjamin Sims wrote: > I'd like to include comments which will not show u

Re: Does Chameleon have a comment syntax?

2011-08-10 Thread Malthe Borch
On 9 August 2011 21:30, Benjamin Sims wrote: > Using this syntax throws a NameError: > > NameError: nothing That's odd. What version do you have? \malthe -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to p

Re: Does Chameleon have a comment syntax?

2011-08-09 Thread Malthe Borch
On 9 August 2011 20:19, Benjamin Sims wrote: > XML comments display in the outputted source, which I am trying to avoid - I > will go with Malthe's syntax I guess. It would be nice though to be able to > use something along the lines of: > > #this is a comment It's kind of tricky this comment bus

Re: Does Chameleon have a comment syntax?

2011-08-09 Thread Malthe Borch
Traditionally, this is done like this: Some comment It's a little crude. There could be an explicit syntax for it I suppose. \malthe On 9 August 2011 17:26, Benjamin Sims wrote: > I'd like to include comments which will not show up in output, and template > languages I have used in

Re: Newbie question regarding views and models

2011-07-28 Thread Malthe Borch
Usually people check the ``request.method`` and see if it's "POST" or "GET", combined with making sure your forms submit using POST. I.e. in pseudo-code: if POST: process form maybe redirect to view render form \malthe On 27 July 2011 22:02, Eduardo Miguez wrote: > Hi guys, I'm

Re: confused on avoiding sql injections using ORM

2011-07-04 Thread Malthe Borch
Think about it this way: There's two kinds of strings when you're dealing with SQL: 1) SQL language, 2) your data input. Don't ever include (2) in (1) –– let the API do it. \malthe On 4 July 2011 21:41, Krishnakant Mane wrote: > Hello all. > I use Pylons 0.9.7 and sqlalchemy. > I use the Object

Re: Chameleon have template inheritance like mako?

2011-06-23 Thread Malthe Borch
On 22 June 2011 23:13, Bruce Wade wrote: > I have used Mako with pylons, now I am trying to rap my head around > chameleon for pyramid. How do we keep our templates DRY using chameleon? > Does it support template inheritance? (Where you can have a base file and > just include it into the other tem

Re: chameleon makes pyramid unfriendly

2011-06-21 Thread Malthe Borch
On 21 June 2011 16:00, Chris Withers wrote: > 1.x, I don't think Pyramid works with 2.x... It does. > Indeed, and making the traceback *much* shorter would also be good... Can you try 2.x and paste your traceback somewhere so we can look at it more concretely? Unless you're using some internal

Re: chameleon makes pyramid unfriendly

2011-06-21 Thread Malthe Borch
On 21 June 2011 13:16, Chris Withers wrote: > I'm finding I hate this, and it's really slowing me down. Sure, we all make > mistakes, but my feeling is that Chameleon's error messages are about as > baroque and annoying as they get. That's not good :-) > Developing with them feels like a massive

Re: problem with i18n in chameleon zpt

2011-06-01 Thread Malthe Borch
On 1 June 2011 10:11, george hu wrote: > Although the issue is fixed, but it reminds me the following points: > 1. Is there a better way to deal with this issue? Since it seems too tricky > to spot the problem, either it should be documented or there must be a fix > in the chameleon zpt. Which ve

Re: problem with i18n in chameleon zpt

2011-05-31 Thread Malthe Borch
It might be helpful if there was a debug-version of the (default) translation function which logged or recorded succesful and failed translations. \malthe On 1 June 2011 06:48, Douglas Cerna wrote: > 2011/5/31 Geo : >> but the other part, which is: >> >>   Welcome to ${project}> span>, an appli

Re: Any plans for an official Genshi renderer?

2011-05-22 Thread Malthe Borch
On 22 May 2011 04:43, Chris McDonough wrote: > I probably wouldn't bother if you need drop-in compatibility.  I haven't > used chameleon_genshi much but I know it doesn't offer that.  And as you > mention, Chameleon 2 drops Genshi support altogether. That's correct. Or at least, it hasn't been i

Re: 'View Only" pdf file

2011-05-16 Thread Malthe Borch
You could use a (free) service such as issuu.com. It relies on an embedded viewer. \malthe On 6 May 2011 03:20, Boyi Shafie wrote: > > Hi, > I'm using a pyramid. I'd like to post a pdf file in my website. However, for > a particular file, user can only view it, but are forbidden to download it.

Re: recursive macro problem with Chameleon zpt, bug? implementation issue?

2011-04-26 Thread Malthe Borch
On 25 April 2011 23:28, Iain Duncan wrote: > I don't know, I was looking for examples of ZPT recursive macros and the > examples I found seemed to imply yes, but I am new to ZPT. I have tried it in ZPT and it did not work. It's possible to make it work (in Chameleon), but it opens up some questi

Re: recursive macro problem with Chameleon zpt, bug? implementation issue?

2011-04-25 Thread Malthe Borch
On 25 April 2011 02:57, Iain Duncan wrote: > Apologies for the cross post ( and direct post), not sure whether this > should be in Pylons discuss or Repoze these days. I think it's possibly a Pylons post. > error: >     raise NameError(key) > RenderError: An uncaught exception was raised. > Name

Re: Problem with Pyramid on Debian Lenny (AttributeError: 'alias' object has no attribute '_attributes')

2011-04-20 Thread Malthe Borch
On 19 April 2011 22:26, Chris McDonough wrote: > I didn't have an answer for this at the time, but someone else brought > it up in IRC. I think this may be an incompatibility between Chameleon > and Python 2.6.0 (the dot-zero being meaningful).  Using a newer (or > older) Python may work OK.  I'm