[web2py:10155] Re: Way to change template engine

2008-10-12 Thread mdipierro
1) If you check it let me know. If I am wrong I would like to know. Both ways I would find the output odd. 3) I agree. Whatever works for you. I am happy to help is needed. Your example seems fine. On Oct 12, 6:57 pm, pigmej <[EMAIL PROTECTED]> wrote: > @massimo > > 1) You are wrong, I think :)

[web2py:10154] Re: Way to change template engine

2008-10-12 Thread pigmej
@massimo 1) You are wrong, I think :) everything without {{block}} are processed automatically, but I can manipulate everything in block content, remove it, add etc. It's usefull are you sure about this output ? I cannot check it now, but I expected something like: abcyyyefghij 2) The real wik

[web2py:10153] Re: Way to change template engine

2008-10-12 Thread mdipierro
Oops. Will fix it. Mind that T2 is still very much beta and the API will change. About jinja. Despite what I said above, I do understand this is very much an issue of subjective preference. It should work out of the box with web2py but, if you have any issue, I will be happy help you port it to

[web2py:10152] Re: Shell while running server

2008-10-12 Thread mdipierro
This is good news. It you tells what we have to change to use the latest ipython featues in shell.py I will make sure it gets packages with the next .exe and .app. It would be great to have auto-completion from the web2py shell. Massimo On Oct 12, 5:35 pm, yarko <[EMAIL PROTECTED]> wrote: > actu

[web2py:10151] Re: Way to change template engine

2008-10-12 Thread pigmej
It makes big impression. But in plugin_t2/modules/t2.py there is mix of '' (4 times space) and tabs ( tabulations )... it shouldn't be :) On 13 Paź, 01:03, yarko <[EMAIL PROTECTED]> wrote: > Note - you can read all that wiki code in about maybe 3 minutes or > less ;-) > > On Oct 12, 6:00 pm,

[web2py:10150] Re: Way to change template engine

2008-10-12 Thread mdipierro
@pigmaj yes there should be more docs. For now this recipe is on AlterEgo and in the manual. I am looking into turning AlterEgo into a real wiki very soon. @yarko Yes this is mainly a stylistic difference but there are two practical differences: 1) in Django and Jinja you cannot use Python comma

[web2py:10149] Re: generate menu with category headers

2008-10-12 Thread mdipierro
I tried this view with no problems: begin file index.html {{extend 'layout.html'}} {{submenu1=[ ['item1',False,URL(r=request,f='item1')], ['item2',False,URL(r=request,f='item2')], ] submenu2=[ ['item3',False,URL(r=request,f='item3')], ['item4',False,URL(r=request,f='item4')], ] response

[web2py:10148] Re: Way to change template engine

2008-10-12 Thread yarko
Note - you can read all that wiki code in about maybe 3 minutes or less ;-) On Oct 12, 6:00 pm, pigmej <[EMAIL PROTECTED]> wrote: > In Poland there is Monday 1 AM and... it's not sunny rotfl ;d > > On 13 Paź, 00:39, pigmej <[EMAIL PROTECTED]> wrote: > > > Thanks for naswers :) > > > In web2py I'm

[web2py:10147] Re: Way to change template engine

2008-10-12 Thread pigmej
In Poland there is Monday 1 AM and... it's not sunny rotfl ;d On 13 Paź, 00:39, pigmej <[EMAIL PROTECTED]> wrote: > Thanks for naswers :) > > In web2py I'm beginner. I generally don't like frameworks ( Django > etc ). I prefer using routers, werkzeug or paser and jinja2 for > templates, writing e

[web2py:10146] Re: Way to change template engine

2008-10-12 Thread yarko
Given that, you may NOT want to put off T2 - it's just an abstraction layer on top of web2py that makes a lot even easier (maybe so much that it's hard at first??? LOL) At least peruse the T2 example wiki (I am betting you'll have a reaction) - download from here: http://groups.google.com/grou

[web2py:10144] Re: Shell while running server

2008-10-12 Thread yarko
actually, getting this up from main is pretty easy; getting the app context updated from an app, the way to set that up right might be a little bit of stumbling I'll post when I have something rudimentary - but won't look at again for a few days (alas). On Oct 12, 5:03 pm, yarko <[EMAIL PR

[web2py:10142] Re: Way to change template engine

2008-10-12 Thread yarko
understood I was arguing that having something like {{exterior_finish(car) }} is not any different than {{ car | pime | paint | bake | add_trim }} that is - where the code sits... But in the cases you meant, yes - {{my()}} {{is_nicer_all_here()}} Thanks. As for multilne code: write "no

[web2py:10145] Re: Way to change template engine

2008-10-12 Thread pigmej
Thanks for naswers :) In web2py I'm beginner. I generally don't like frameworks ( Django etc ). I prefer using routers, werkzeug or paser and jinja2 for templates, writing everything from scratch, etc. But for web2py I can make exception. Let's see... ;) On 13 Paź, 00:28, yarko <[EMAIL PROTECTED

[web2py:10143] Re: Way to change template engine

2008-10-12 Thread yarko
...but you can already see all that from Massimo's nice, concise examples, and I should not be sitting reading posts on a sunny Sunday afternoon! I'm sure not to say much of anything smart while looking out the window ;-) On Oct 12, 5:28 pm, yarko <[EMAIL PROTECTED]> wrote: > understood >

[web2py:10141] Re: Way to change template engine

2008-10-12 Thread pigmej
Now I see that I can make with web2py templates almost everything :). Massimo, I really think, You should add this recipes to howto :) @yarko: sometimes there is no staight way to modify something in controller. But ok, I modify it, and then i loop them again in template -> so there are two loo

[web2py:10140] Re: Shell while running server

2008-10-12 Thread yarko
The license is a new or revised BSD license: it allows source or binary distributions. IPython is hosted on launchpad: https://launchpad.net/ipython It's license file is in the COPYING file here: http://bazaar.launchpad.net/~ipython-dev/ipython/trunk/files On Oct 12, 4:37 pm, mdipierro <[EMA

[web2py:10138] Re: Way to change template engine

2008-10-12 Thread pigmej
mdipierro thanks for showing way for blocks I know that escaping is default and I think there should be something to change it -> I know about XML method. I know for syntax in web2py already :) The short manual on site for templating is too small, I think. Btw. Good work with web2py. PYTHON f

[web2py:10139] Re: Way to change template engine

2008-10-12 Thread yarko
This looks like only a stylistic discussion to me Django has this too, and Jinja you say have a "shell like" syntax of "pipes" --- that is output of one operation feeds input of another. n {{ car | prime | paint }} is equivalent to {{ paint(prime(car)) }}, or for that matter {{ car.paint()

[web2py:10137] Re: Shell while running server

2008-10-12 Thread mdipierro
I think this is excellent and should be supported by the shell. If the license permits it I would also like to have it included as default shell in the binary distributions. Do you know? Massimo On Oct 12, 4:31 pm, yarko <[EMAIL PROTECTED]> wrote: > I experimented yesterday a bit w/ IPython trun

[web2py:10136] Re: Way to change template engine

2008-10-12 Thread mdipierro
Yes not very pythonic. I think the web2py way is more pythonic blocks in layout.html: {{myblockcode1()}} {{myblockcode2()}} and in index.html: {{def myblockcode1():}}Hello{{return}} {{def myblockcode2():}}World{{return}} {{extend 'layout.html'}} escaping a string is the default {{="some string"}

[web2py:10135] Shell while running server

2008-10-12 Thread yarko
I experimented yesterday a bit w/ IPython trunk, to discover that Gaël Varoquaux has written a wx based front end for IPython (IPythonx, and IPtyon-wx, but I found the former at this point more interesting, as it has nice, scrolling completion). I tried to "quickly" hack up gluon/shell.py to see

[web2py:10134] Re: Way to change template engine

2008-10-12 Thread pigmej
massimo, filters... ok but what if I need to make more operations with strings etc, python operations, imports, parsing something ? More lines of code. For example I need to operate on dictionaries ( defining new, parsing etc ) Theoretically, I can apply filters on controller side... but then t

[web2py:10133] Re: Way to change template engine

2008-10-12 Thread pigmej
sure, for example in base template I define "block", then in child template I can modify content of this block, that's useful in many,many situations. Secondly. Custom filters. I write python function in any file, then I add it to jinja env and after that I can use it as a normal filter in templ

[web2py:10132] Re: generate menu with category headers

2008-10-12 Thread Snoboardfreak
hey pros! anyone tried above code and got same error? or am i doing something (very) stupid? any help great!! tx --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group,

[web2py:10131] Re: Way to change template engine

2008-10-12 Thread mdipierro
You can do both: 1) Example of passing variables to parent. Here is layout.html {{=title}}{{include}} and here is an example of index.html {{title='something'}} {{extend 'layout.html'}} Hello World Also are variables returned by the action and defined in models are also pa

[web2py:10130] Re: Way to change template engine

2008-10-12 Thread yarko
Maybe some examples would help me better understand what you mean by these two points. Could you give something short? Thanks! Yarko On Oct 12, 3:42 pm, pigmej <[EMAIL PROTECTED]> wrote: > thanks for reply. > > Python is templating engine - thats really good. > > But I can only include file in

[web2py:10129] Re: Way to change template engine

2008-10-12 Thread pigmej
thanks for reply. Python is templating engine - thats really good. But I can only include file in one place and there is no way to change anything in parrent file. That's a minus, and the minor problem for mine. The same thing with filters/macros. I need to use the same macro/ filter in many fi

[web2py:10128] Re: Way to change template engine

2008-10-12 Thread mdipierro
Yes you can as Yarko explains but: 1) your app will not be portable, since it will require the other engine installed 2) You lose the ability to byte-code compile templates and distribute them in a closed-source web2py app. 3) The current web2py template engine, because of bytecode compilation an

[web2py:10127] Re: Way to change template engine

2008-10-12 Thread yarko
Also - if you want to use Genshi Templates (or try to do something similar for Jinja2), see the Genshi4web2py.py file and instructions here: http://mdp.cti.depaul.edu/AlterEgo/default/show/162 On Oct 12, 2:59 pm, yarko <[EMAIL PROTECTED]> wrote: > There have been several discussions on this li

[web2py:10126] Re: Way to change template engine

2008-10-12 Thread yarko
There have been several discussions on this list on the topic - for example, look through http://groups.google.com/group/web2py/browse_thread/thread/1ef4eea826f3a1f6/dc6d1b52b31fa196?hl=en&lnk=gst&q=template+engine#dc6d1b52b31fa196 I think a raesonable summary is: - web2py's templating, being

[web2py:10125] Way to change template engine

2008-10-12 Thread pigmej
Is there any way to change default template engine in web2py? I would like to change it to something better with more features like Jinja2 Or maybe there is a lot of undocumented things in default template engine ? --~--~-~--~~~---~--~~ You received this message

[web2py:10124] Re: Need help with validation and info on IS_LIST_OF

2008-10-12 Thread mdipierro
IS_LIST_OF does not apply to a single field but applies to the case when you have multiple input fields with the same name. In this case request.vars.fieldname contains a list of values (literally a python list of strings, not a list in a string). IS_LIST_OF(IS_INT_IN_RANGE(...)) would validate al

[web2py:10123] Re: Need help with validation and info on IS_LIST_OF

2008-10-12 Thread billf
Massimo Many thanks for your MY_VALIDATOR. It works fine and helps me visualize writing my own validators. I still don't know what IS_LIST_OF does though :-) 5 part days into learning web2py and python from scratch I think I will leave t2 for a little while. Thanks again, Bill On Oct 12, 5:2

[web2py:10122] Re: Need help with validation and info on IS_LIST_OF

2008-10-12 Thread mdipierro
or you may want to consider from applications.plugin_t2.modules.t2 import T2 db.yourtable.yourtable.widget=T2.tag_widget(['red','green','blue']) Masimo On Oct 12, 10:50 am, mdipierro <[EMAIL PROTECTED]> wrote: > class MY_VALIDATOR: > def __init__(self,theset=['red','green'],error_message='

[web2py:10121] Re: Need help with validation and info on IS_LIST_OF

2008-10-12 Thread mdipierro
class MY_VALIDATOR: def __init__(self,theset=['red','green'],error_message='ouch!'): self.theset=theset self.em=error_message def _call_(self,value): items=[x.strip() for x in value.split(',')] for item in items: if not item in self.theset: retu

[web2py:10120] Re: SQLFORM not generating SELECT

2008-10-12 Thread mdipierro
This is intentional. It gives you an option. On Oct 12, 7:23 am, billf <[EMAIL PROTECTED]> wrote: > It seems the problem is that IS_IN_SET cannot be in a list. > > Although there is no specific example of [IS_IN_SET(['Y','N'])], there > are examples that group several validators together in a lis

[web2py:10119] Re: T2: search (unresolved)

2008-10-12 Thread mdipierro
what if you are searching for records that have leading or training spaces? (perhaps inserted by mistake) On Oct 12, 5:42 am, vihang <[EMAIL PROTECTED]> wrote: > just checked.. the search works fine now in t2, > > one more thing, the input box value would do well with .strip() added > to remove w

[web2py:10118] Re: web2py book finally online in PDF

2008-10-12 Thread mdipierro
Let me ask them. If you do not consider I break of agreement I would not mind sending you my own PDF copy. On Oct 12, 5:42 am, "Phyo Arkar" <[EMAIL PROTECTED]> wrote: > I think u will have to pay for that ,. Massimo have no control over that i > think. > > On Sun, Oct 12, 2008 at 6:21 AM, vihang

[web2py:10117] Re: downloading files from server.

2008-10-12 Thread mdipierro
yes, static On Oct 12, 5:37 am, "Phyo Arkar" <[EMAIL PROTECTED]> wrote: > Dear massimo; > > Thanks now i got it working. What i am doing is a  directory listing of the > download folder. > > Where is a good place to put files thats for download purpose only? Static ? > I put it there. > > I will

[web2py:10116] Need help with validation and info on IS_LIST_OF

2008-10-12 Thread billf
Can anyone help with the following? I want to validate an input string like "red,green,blue" where all the elements occur in a list,e.g. ['red','orange','yellow','green','blue','indigo','violet'] such that "red,green,blue" is valid and "puce,yellow" is invalid. I was thinking that maybe IS_LIST

[web2py:10115] Re: SQLFORM not generating SELECT

2008-10-12 Thread billf
It seems the problem is that IS_IN_SET cannot be in a list. Although there is no specific example of [IS_IN_SET(['Y','N'])], there are examples that group several validators together in a list and also [IS_NOT_EMPTY] (one validator in a list) so it seems a bit perverse that if IS_IN_SET is in a l

[web2py:10114] Re: SQLFORM not generating SELECT

2008-10-12 Thread billf
It seems the problem is that IS_IN_SET cannot be in a list. Although there is no specific example of [IS_IN_SET(['Y','N'])], there are examples that group several validators together in a list and also [IS_NOT_EMPTY] (one validator in a list) so it seems a bit perverse that if IS_IN_SET is in a l

[web2py:10113] Re: T2: search (unresolved)

2008-10-12 Thread vihang
just checked.. the search works fine now in t2, one more thing, the input box value would do well with .strip() added to remove whitespaces... they are definitely a problem with the search.. but I was just wondering that would it be useful if its added to the framework... I cannot think of any in

[web2py:10112] Re: web2py book finally online in PDF

2008-10-12 Thread Phyo Arkar
I think u will have to pay for that ,. Massimo have no control over that i think. On Sun, Oct 12, 2008 at 6:21 AM, vihang <[EMAIL PROTECTED]> wrote: > > Hi Massimo, > > If we buy from vitalsource right now, can we also get the pdf version > if/when its released later or do we have to pay for that

[web2py:10111] Re: downloading files from server.

2008-10-12 Thread Phyo Arkar
Dear massimo; Thanks now i got it working. What i am doing is a directory listing of the download folder. Where is a good place to put files thats for download purpose only? Static ? I put it there. I will check appadmin.py. On Sat, Oct 11, 2008 at 9:53 PM, mdipierro <[EMAIL PROTECTED]> wrote

[web2py:10110] SQLFORM not generating SELECT

2008-10-12 Thread billf
My model contains: db.define_table('recipe', SQLField('last_action_ts','datetime',required=True,default=now), SQLField('ability','string',length=1,required=True,requires=IS_IN_SET(['B','C'],labels=['straightforward','slightly adventurous'])), SQLField('amount','integer',require