[web2py] Re: web2py with alchemy
not correct. web2py DAL does not use SQLAlchemy. On Feb 13, 6:48 pm, waTR wrote: > I believe the DAL is originally just another layer on top of > SQLAlchemy. So I would think you could use it extremely easily. > > Check the code in the dal python file and see how they imported the > SQLAlchemy library and simply copy and paste that. I think that should > work. > > On Feb 13, 8:44 am, vihang wrote: > > > I tinkered around a bit, but DAL did the job well, plus the benefits > > of using crud & auth made me stick to DAL. I would use sqlalchemy only > > if I was porting a legacy app using it.. > > > On Feb 13, 3:41 pm, elffikk wrote: > > > > hi, > > > > is there somebody that used sqlalchemy with web2py, > > > how hard will be to do that? > > > > my thoughts now are to try it with formalchemy as alternative to > > > web2py models + things like SQLForm or SQLTable -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: URL and URLs
We could create a switch in routes that allows to change the URL validation regex. I would take a patch. I would not change the default though. On Feb 13, 4:48 pm, Jonathan Lundell wrote: > On Feb 13, 2010, at 2:16 PM, DenesL wrote: > > > 1) Is that the only reason? > > So there is no other objection to have args with accented chars in > > them for example?. > > Foreign languages would benefit from having args without such > > restrictions. > > > By 'access filesystems' are you refering to 'static'? > > We could apply the restrictions only if the URL has c='static' or some > > other mechanism when it needs to access filesystems. > > > 2) And what about the first question: > > Shouldn't URL create only URLs that are usable with web2py? > > A lot of our systems are perfectly happy with spaces in filenames. It can be > a PITA from the command line, but not from the GUI or programatically. Seems > like an unnecessary restriction on web2py's part. > > > > > On 13 feb, 15:37, mdipierro wrote: > >> because args can be used to access filesystem and having spaces in > >> there causes trouble. > > >> On Feb 13, 12:02 pm, DenesL wrote: > > >>> Shouldn't URL create only URLs that are usable with web2py? > > >>> Example: > >>> u=URL(r=request, args='Capítulo 1') > >>> produces an URL ending with /Cap%A1tulo%201 > >>> which generates an "Invalid request" when used. > > >>> And why are these characters not allowed in URLs? > > >>> Denes. -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: web2py site problem ?!
I wanted to experience with EC2 anyway. I agree for my needs it may very well be overkill. Thanks for the pointer. On Feb 13, 6:26 pm, villas wrote: > Massimo, > When I tried EC2 it was very time-consuming and the backups were > difficult and I was just wasting time. > > In the end I saved my sanity with vps.net which (for $20 per month) > takes your Ubuntu script about 5 mins to set up. There's a really good > backup service available by ticking a box for $5 per month extra. IMO > it's a no-brainer. And, as there's 256MB you'll be able to run 6 > instances of Web2py (if the 40Mb in the other thread is right)! > > I'm sure other vps providers are also excellent, I just chose that > one because they offer Europe as well as US and it's a good service. > Give yourself a break and leave the EC2 infrastructure for the global > mega-corporations! > > --David > > On Feb 12, 4:47 pm, mdipierro wrote: > > > I am not suing any of the advanced features like load balancing. I > > have an Instance with EBS storage. I do not completely understand the > > backup process. I hope that making a snapshot of the storage results > > in data backup. Not clear to me how to recover from one the snapshots. > > > On Feb 12, 10:42 am,villas wrote: > > > > On Feb 12, 4:01 pm, mdipierro wrote: > > > > > hmmm that costs more money. > > > > Well, people moving to Amazon aren't going there to save any money, > > > that's for sure. The main thing you are paying for is the massive > > > global up-scaling you can instantly turn on. Must have geared up for > > > some big spikes on accessing that lovely new online book :-) D -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Execute file in web2py environment fails with cron
When running the command below everything works fine, the python file executes correctly. thadeus$ /usr/bin/python /web2py/web2py.py -S MYAPP -M -R /web2py/applications/MYAPP/cron/update_records.py >> /web2py/applications/MYAPP/cron/cron.log This works great when running from bash, however when I stick this into cron, the only thing that appears in the log is the following. =web2py Enterprise Web Framework =Created by Massimo Di Pierro, Copyright 2007-2010 =Version 1.74.11 (2010-02-03 10:53:34) =Database drivers available: SQLite3, PostgreSQL =Starting cron... It seems as if web2py is just stopping there, and not executing the update_records file. This is what I have in my linux crontab file. */1 * * * * /usr/bin/python /web2py/web2py.py -S MYAPP -M -R /web2py/applications/MYAPP/cron/update_records.py >> /web2py/applications/MYAPP/cron/cron.log Why does this work on the command line but not when put into external cron ? On an older version of web2py (version 1.64.*) it works perfectly, currently this is running on 1.74.11. -Thadeus -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: On the online book
I really really appreciate this. Somehow the chipin widget is not updated in real time but I do get the notifications from paypal. Massimo On Feb 13, 5:31 pm, villas wrote: > On Feb 13, 11:14 pm, Richard wrote: > > > I had no idea you were getting that much (7%) from the book, so that > > was very noble to release it. Donated $50. > > Richard > > Yes Richard -- good call! I've chipped in $50 too. > I can't tell you how much I support the decision. It will be a great > success for our community, and I hope the donations will compensate > accordingly. > Kind regards, > --David -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] modular layout
Hello, I need to built a left sidebar from a database. In the main layout file I have the following code: {{include 'default/leftsidebar.html'}} The problem is how I can built the leftsidebar. After reading chapter 5 in the web2py book is not clear to me. It is possible to make a controller, reading the database inside that controller and pass the result to the leftsidebar.html view??? Thanks in advance -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: first gae app
sounds like this will be useful. StringListProperty is a native gae type now supported by web2py: http://code.google.com/appengine/docs/python/datastore/typesandpropertyclasses.html#StringListProperty http://groups.google.com/group/web2py/browse_thread/thread/7d284c9fa488e855 To get around the like problem you can do something like this: Model.all().filter('ngrams >=', word).filter('ngrams <', word + u'\ufffd') Check out Thadeus's code for a full example. There's also info how to do this in the docs: http://code.google.com/appengine/docs/python/datastore/queriesandindexes.html#Introducing_Indexes Richard On Feb 14, 1:52 pm, Wes James wrote: > Richard, > > Do you have a python example of this? I'll check on > StringListProperty also and see how it works. (would this work on > gae?) I was trying somthing else since like is not supported, but this > might work. I would like this site to provide quick search on > anything that would be helpful in building a web2py app. There are a > lot of things in tools.py that could go here for instance, and maybe > another page with docstrings? Whatever anyone thinks would be > helpful. > > -wes > > > > On Sat, Feb 13, 2010 at 4:26 PM, Richard wrote: > > hi wes, > > > something like this could be really nice for browsing the function > > docstrings. Do you intend to take it further? > > > If you use a StringListProperty to store all the ngrams (eg: web2py, > > web2p, web2, web, we, w) then it could match partial words. > > > Richard -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: modular layout
Another question I would like a put a calendar on my website. {{include 'default/calendar.html'}} I know how to generate a calendar in python with html but is not clear to me if I need a controller and then I should pass the variables that I need to the calendar.html view or I have to put all the python code inside the calendar.html view like in chapter 5 of the web2py book. When people put http://mysite.com web2py should render the layout with all the view modules that are inside the main layout file. If I need to render, the current month, what I think is that I need a contoller to get the current month, the days that month have and then pass all that information to the view, in this case calendar.html. That view will be rendered within the main layout. I don't know how can I do that. Thanks in advance On 14 feb, 11:08, salbefe wrote: > Hello, > > I need to built a left sidebar from a database. In the main layout > file I have the following code: > > > > > {{include 'default/leftsidebar.html'}} > > > > The problem is how I can built the leftsidebar. After reading chapter > 5 in the web2py book is not clear to me. > It is possible to make a controller, reading the database inside that > controller and pass the result to the leftsidebar.html view??? > > Thanks in advance -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] fcgi problem
Hi I've problems running web2py with nginx webserver and fcgi I'm brandy new to this and the tutorial I found talks about lighttpd web server so any hints about that ? -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: onvalidation problem
I posted the code on private -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
Re: [web2py] Re: On the online book
I bought the pdf two months ago. Now i contributted with 5$, isn't so much, but i'm still studying, there's my contributtion to the cause. I aprreciate the effort you're doing on that. regards! On Sun, Feb 14, 2010 at 9:15 AM, mdipierro wrote: > I really really appreciate this. Somehow the chipin widget is not > updated in real time but I do get the notifications from paypal. > > Massimo > > On Feb 13, 5:31 pm, villas wrote: > > On Feb 13, 11:14 pm, Richard wrote: > > > > > I had no idea you were getting that much (7%) from the book, so that > > > was very noble to release it. Donated $50. > > > Richard > > > > Yes Richard -- good call! I've chipped in $50 too. > > I can't tell you how much I support the decision. It will be a great > > success for our community, and I hope the donations will compensate > > accordingly. > > Kind regards, > > --David > > -- > You received this message because you are subscribed to the Google Groups > "web2py-users" group. > To post to this group, send email to web...@googlegroups.com. > To unsubscribe from this group, send email to > web2py+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/web2py?hl=en. > > -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: modular layout
There are two types of frameworks. push and pull. In the pull frameworks, the url maps into a view and the view calls multiple controller actions. In the push, the url maps into one controller action which renders one ore more views. web2py (as well as Django, Pylons, and Rails) are push. The only way one subset of the page can call a different controller is if they ask the client to do it via AJAX. {{=LOAD('default','sidebar',ajax=True)}} # calls sidebar() is default.py On Feb 14, 4:08 am, salbefe wrote: > Hello, > > I need to built a left sidebar from a database. In the main layout > file I have the following code: > > > > > {{include 'default/leftsidebar.html'}} > > > > The problem is how I can built the leftsidebar. After reading chapter > 5 in the web2py book is not clear to me. > It is possible to make a controller, reading the database inside that > controller and pass the result to the leftsidebar.html view??? > > Thanks in advance -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: modular layout
There are two types of frameworks. push and pull. In the pull frameworks, the url maps into a view and the view calls multiple controller actions. In the push, the url maps into one controller action which renders one ore more views. web2py (as well as Django, Pylons, and Rails) are push. The only way one subset of the page can call a different controller is if they ask the client to do it via AJAX. {{=LOAD('default','sidebar',ajax=True)}} # calls sidebar() is default.py On Feb 14, 4:08 am, salbefe wrote: > Hello, > > I need to built a left sidebar from a database. In the main layout > file I have the following code: > > > > > {{include 'default/leftsidebar.html'}} > > > > The problem is how I can built the leftsidebar. After reading chapter > 5 in the web2py book is not clear to me. > It is possible to make a controller, reading the database inside that > controller and pass the result to the leftsidebar.html view??? > > Thanks in advance -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: modular layout
If you are not loading a page subset via ajax. Then your view includes another view, your one and only controller must generate all the variables needed by both views. On Feb 14, 5:54 am, salbefe wrote: > Another question > > I would like a put a calendar on my website. > > > > {{include 'default/calendar.html'}} > > > > I know how to generate a calendar in python with html but is not clear > to me if I need a controller and then I should pass the variables that > I need to the calendar.html view or > I have to put all the python code inside the calendar.html view like > in chapter 5 of the web2py book. > > When people puthttp://mysite.comweb2py should render the layout with > all the view modules that are inside the main layout file. If I need > to render, the current month, what I think is that I need a contoller > to get the current month, the days that month have and then pass all > that information to the view, in this case calendar.html. That view > will be rendered within the main layout. > > I don't know how can I do that. > Thanks in advance > On 14 feb, 11:08, salbefe wrote: > > > Hello, > > > I need to built a left sidebar from a database. In the main layout > > file I have the following code: > > > > > > > > > > {{include 'default/leftsidebar.html'}} > > > > > > > The problem is how I can built the leftsidebar. After reading chapter > > 5 in the web2py book is not clear to me. > > It is possible to make a controller, reading the database inside that > > controller and pass the result to the leftsidebar.html view??? > > > Thanks in advance -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: URL and URLs
It seems that using LOCALE in the regex would do the job but setting locale is a big can of worms. On 14 feb, 03:04, mdipierro wrote: > We could create a switch in routes that allows to change the URL > validation regex. > I would take a patch. I would not change the default though. -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: Execute file in web2py environment fails with cron
Get rid of the standard output redirect and append symbol for shell use, '>>', in your crontab. Cron jobs do not use a shell. Standard output is passed back to web2py and will appear in your web2py logs. John Heenan On Feb 14, 6:13 pm, Thadeus Burgess wrote: > When running the command below everything works fine, the python file > executes correctly. > > thadeus$ /usr/bin/python /web2py/web2py.py -S MYAPP -M -R > /web2py/applications/MYAPP/cron/update_records.py >> > /web2py/applications/MYAPP/cron/cron.log > > This works great when running from bash, however when I stick this > into cron, the only thing that appears in the log is the following. > > =web2py Enterprise Web Framework > =Created by Massimo Di Pierro, Copyright 2007-2010 > =Version 1.74.11 (2010-02-03 10:53:34) > =Database drivers available: SQLite3, PostgreSQL > =Starting cron... > > It seems as if web2py is just stopping there, and not executing the > update_records file. This is what I have in my linux crontab file. > > */1 * * * * /usr/bin/python /web2py/web2py.py -S MYAPP -M -R > /web2py/applications/MYAPP/cron/update_records.py >> > /web2py/applications/MYAPP/cron/cron.log > > Why does this work on the command line but not when put into external > cron ? On an older version of web2py (version 1.64.*) it works > perfectly, currently this is running on 1.74.11. > > -Thadeus -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: Execute file in web2py environment fails with cron
I think your crontab should just be */1 * * * * user *cron/update_records.py On Feb 14, 2:13 am, Thadeus Burgess wrote: > When running the command below everything works fine, the python file > executes correctly. > > thadeus$ /usr/bin/python /web2py/web2py.py -S MYAPP -M -R > /web2py/applications/MYAPP/cron/update_records.py >> > /web2py/applications/MYAPP/cron/cron.log > > This works great when running from bash, however when I stick this > into cron, the only thing that appears in the log is the following. > > =web2py Enterprise Web Framework > =Created by Massimo Di Pierro, Copyright 2007-2010 > =Version 1.74.11 (2010-02-03 10:53:34) > =Database drivers available: SQLite3, PostgreSQL > =Starting cron... > > It seems as if web2py is just stopping there, and not executing the > update_records file. This is what I have in my linux crontab file. > > */1 * * * * /usr/bin/python /web2py/web2py.py -S MYAPP -M -R > /web2py/applications/MYAPP/cron/update_records.py >> > /web2py/applications/MYAPP/cron/cron.log > > Why does this work on the command line but not when put into external > cron ? On an older version of web2py (version 1.64.*) it works > perfectly, currently this is running on 1.74.11. > > -Thadeus -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: Execute file in web2py environment fails with cron
I think your crontab should just be */1 * * * * user * /web2py/applications/MYAPP/cron/ update_records.py On Feb 14, 9:42 am, mdipierro wrote: > I think your crontab should just be > > */1 * * * * user *cron/update_records.py > > On Feb 14, 2:13 am, Thadeus Burgess wrote: > > > When running the command below everything works fine, the python file > > executes correctly. > > > thadeus$ /usr/bin/python /web2py/web2py.py -S MYAPP -M -R > > /web2py/applications/MYAPP/cron/update_records.py >> > > /web2py/applications/MYAPP/cron/cron.log > > > This works great when running from bash, however when I stick this > > into cron, the only thing that appears in the log is the following. > > > =web2py Enterprise Web Framework > > =Created by Massimo Di Pierro, Copyright 2007-2010 > > =Version 1.74.11 (2010-02-03 10:53:34) > > =Database drivers available: SQLite3, PostgreSQL > > =Starting cron... > > > It seems as if web2py is just stopping there, and not executing the > > update_records file. This is what I have in my linux crontab file. > > > */1 * * * * /usr/bin/python /web2py/web2py.py -S MYAPP -M -R > > /web2py/applications/MYAPP/cron/update_records.py >> > > /web2py/applications/MYAPP/cron/cron.log > > > Why does this work on the command line but not when put into external > > cron ? On an older version of web2py (version 1.64.*) it works > > perfectly, currently this is running on 1.74.11. > > > -Thadeus -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] one cool website
This is one cool web site made with web2py http://www.albendas.com -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
Re: [web2py] Re: URL and URLs
On Feb 14, 2010, at 12:04 AM, mdipierro wrote: > We could create a switch in routes that allows to change the URL > validation regex. > I would take a patch. I would not change the default though. We should revisit the logic (btw, is this something we could do on the dev list instead?) rewrite.filter_in() ... path = regex_space.sub('_', path) match = regex_url.match(path) if not match: raise HTTP(400, ... request.application = match.group('a') or 'init' request.controller = match.group('c') or 'default' request.function = match.group('f') or 'index' raw_extension = match.group('e') request.extension = raw_extension or 'html' request.args = \ List((match.group('s') and match.group('s').split('/')) or []) ... parse_get_post_vars(request, environ) where: regex_space = re.compile('(\+|\s|%20)+') # pattern to find valid paths in url /application/controller/... # this could be: # for static pages: #//static/ # for dynamic pages: #/[/[/[.][/]]] # application, controller, function and ext may only contain [a-zA-Z0-9_] # file and sub may also contain '-', '=', '.' and '/' regex_url = re.compile(r''' (^ # static pages /(?P \w+)# b=app /static # /b/static /(?P (\w[\-\=\./]?)* ) # x=file $) | # dynamic pages (^( # (/a/c/f.e/s) /(?P \w+ ) # /a=app ( # (/c.f.e/s) /(?P \w+ ) # /a/c=controller ( # (/f.e/s) /(?P \w+ ) # /a/c/f=function ( # (.e) \.(?P \w+ ) # /a/c/f.e=extension )? ( # (/s) /(?P # /a/c/f.e/s=sub ( [\...@][\=\./]? )+ ) )? )? )? )? /?$)# trailing slash ''', re.X) So *strings* of spaces (defined as an actual space, +, %20) are first converted to single underscores. And then we apply the URL test. (Note that vars are treated separately; they've already been moved to env.query_string). We're interested in match group 's', which is a somewhat peculiar pattern. I see now that it could be written a little more clearly: ( [...@-][=./]? )+ I'm really not sure what the intention is here, but this (and the spaces conversion) is were we would need to address alternatives to args parsing. Massimo? What's the intent? > > On Feb 13, 4:48 pm, Jonathan Lundell wrote: >> On Feb 13, 2010, at 2:16 PM, DenesL wrote: >> >>> 1) Is that the only reason? >>> So there is no other objection to have args with accented chars in >>> them for example?. >>> Foreign languages would benefit from having args without such >>> restrictions. >> >>> By 'access filesystems' are you refering to 'static'? >>> We could apply the restrictions only if the URL has c='static' or some >>> other mechanism when it needs to access filesystems. >> >>> 2) And what about the first question: >>> Shouldn't URL create only URLs that are usable with web2py? >> >> A lot of our systems are perfectly happy with spaces in filenames. It can be >> a PITA from the command line, but not from the GUI or programatically. Seems >> like an unnecessary restriction on web2py's part. >> >> >> >>> On 13 feb, 15:37, mdipierro wrote: because args can be used to access filesystem and having spaces in there causes trouble. >> On Feb 13, 12:02 pm, DenesL wrote: >> > Shouldn't URL create only URLs that are usable with web2py? >> > Example: > u=URL(r=request, args='Capítulo 1') > produces an URL ending with /Cap%A1tulo%201 > which generates an "Invalid request" when used. >> > And why are these characters not allowed in URLs? >> > Denes. -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: modular layout
Thank you Massimo, {{=LOAD('default','sidebar',ajax=True)}} has solved my problem. Thanks a lot On 14 feb, 16:01, mdipierro wrote: > If you are not loading a page subset via ajax. > Then your view includes another view, your one and only controller > must generate all the variables needed by both views. > > On Feb 14, 5:54 am, salbefe wrote: > > > Another question > > > I would like a put a calendar on my website. > > > > > > > {{include 'default/calendar.html'}} > > > > > > > I know how to generate a calendar in python with html but is not clear > > to me if I need a controller and then I should pass the variables that > > I need to the calendar.html view or > > I have to put all the python code inside the calendar.html view like > > in chapter 5 of the web2py book. > > > When people puthttp://mysite.comweb2pyshould render the layout with > > all the view modules that are inside the main layout file. If I need > > to render, the current month, what I think is that I need a contoller > > to get the current month, the days that month have and then pass all > > that information to the view, in this case calendar.html. That view > > will be rendered within the main layout. > > > I don't know how can I do that. > > Thanks in advance > > On 14 feb, 11:08, salbefe wrote: > > > > Hello, > > > > I need to built a left sidebar from a database. In the main layout > > > file I have the following code: > > > > > > > > > > > > > > > {{include 'default/leftsidebar.html'}} > > > > > > > > > > The problem is how I can built the leftsidebar. After reading chapter > > > 5 in the web2py book is not clear to me. > > > It is possible to make a controller, reading the database inside that > > > controller and pass the result to the leftsidebar.html view??? > > > > Thanks in advance -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: URL and URLs
Yes, let' move this to web2py_developers. On Feb 14, 11:26 am, Jonathan Lundell wrote: > On Feb 14, 2010, at 12:04 AM, mdipierro wrote: > > > We could create a switch in routes that allows to change the URL > > validation regex. > > I would take a patch. I would not change the default though. > > We should revisit the logic (btw, is this something we could do on the dev > list instead?) > > rewrite.filter_in() > ... > path = regex_space.sub('_', path) > match = regex_url.match(path) > if not match: > raise HTTP(400, > ... > request.application = match.group('a') or 'init' > request.controller = match.group('c') or 'default' > request.function = match.group('f') or 'index' > raw_extension = match.group('e') > request.extension = raw_extension or 'html' > request.args = \ > List((match.group('s') and match.group('s').split('/')) or []) > ... > parse_get_post_vars(request, environ) > > where: > > regex_space = re.compile('(\+|\s|%20)+') > > # pattern to find valid paths in url /application/controller/... > # this could be: > # for static pages: > # //static/ > # for dynamic pages: > # /[/[/[.][/]]] > # application, controller, function and ext may only contain [a-zA-Z0-9_] > # file and sub may also contain '-', '=', '.' and '/' > regex_url = re.compile(r''' > (^ # static pages > /(?P \w+) # b=app > /static # /b/static > /(?P (\w[\-\=\./]?)* ) # x=file > $) > | # dynamic pages > (^( # (/a/c/f.e/s) > /(?P \w+ ) # /a=app > ( # (/c.f.e/s) > /(?P \w+ ) # /a/c=controller > ( # (/f.e/s) > /(?P \w+ ) # /a/c/f=function > ( # (.e) > \.(?P \w+ ) # /a/c/f.e=extension > )? > ( # (/s) > /(?P # /a/c/f.e/s=sub > ( [\...@][\=\./]? )+ > ) > )? > )? > )? > )? > /?$) # trailing slash > ''', re.X) > > So *strings* of spaces (defined as an actual space, +, %20) are first > converted to single underscores. And then we apply the URL test. (Note that > vars are treated separately; they've already been moved to env.query_string). > > We're interested in match group 's', which is a somewhat peculiar pattern. I > see now that it could be written a little more clearly: > > ( [...@-][=./]? )+ > > I'm really not sure what the intention is here, but this (and the spaces > conversion) is were we would need to address alternatives to args parsing. > Massimo? What's the intent? > > > > > On Feb 13, 4:48 pm, Jonathan Lundell wrote: > >> On Feb 13, 2010, at 2:16 PM, DenesL wrote: > > >>> 1) Is that the only reason? > >>> So there is no other objection to have args with accented chars in > >>> them for example?. > >>> Foreign languages would benefit from having args without such > >>> restrictions. > > >>> By 'access filesystems' are you refering to 'static'? > >>> We could apply the restrictions only if the URL has c='static' or some > >>> other mechanism when it needs to access filesystems. > > >>> 2) And what about the first question: > >>> Shouldn't URL create only URLs that are usable with web2py? > > >> A lot of our systems are perfectly happy with spaces in filenames. It can > >> be a PITA from the command line, but not from the GUI or programatically. > >> Seems like an unnecessary restriction on web2py's part. > > >>> On 13 feb, 15:37, mdipierro wrote: > because args can be used to access filesystem and having spaces in > there causes trouble. > > On Feb 13, 12:02 pm, DenesL wrote: > > > Shouldn't URL create only URLs that are usable with web2py? > > > Example: > > u=URL(r=request, args='Capítulo 1') > > produces an URL ending with /Cap%A1tulo%201 > > which generates an "Invalid request" when used. > > > And why are these characters not allowed in URLs? > > > Denes. -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] how to deploy web2py for a single app?
hi, i have my application in the standard directory /applications/myapp i'm deployig it in a production env (webfaction) using its web2py script. once set its routes, i can access my applications like myaccount.webfactional.com/myapp, but i'd like to have it like the root application. how can i detach the app from applications or how to make it the default one? thanks -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: how to deploy web2py for a single app?
call it "init" On Feb 14, 12:36 pm, pistacchio wrote: > hi, > i have my application in the standard directory /applications/myapp > > i'm deployig it in a production env (webfaction) using its web2py > script. once set its routes, i can access my applications like > myaccount.webfactional.com/myapp, but i'd like to have it like the > root application. how can i detach the app from applications or how to > make it the default one? > > thanks -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
Re: [web2py] Re: Execute file in web2py environment fails with cron
You misunderstand. I am not using the web2py crontab file. I am using Linux (ubuntu) anacron, this is in the system crontab file. thadeusb$ crontab -e etc etc... I run three web2py servers, this works on the other two that are running older web2py versions. The output redirect works perfectly since it is anacron executing the command. Works perfectly on my other two servers. The only difference is the web2py version, so something must have changed. -Thadeus On Sun, Feb 14, 2010 at 9:43 AM, mdipierro wrote: > I think your crontab should just be > > */1 * * * * user * /web2py/applications/MYAPP/cron/ > update_records.py > > > On Feb 14, 9:42 am, mdipierro wrote: >> I think your crontab should just be >> >> */1 * * * * user *cron/update_records.py >> >> On Feb 14, 2:13 am, Thadeus Burgess wrote: >> >> > When running the command below everything works fine, the python file >> > executes correctly. >> >> > thadeus$ /usr/bin/python /web2py/web2py.py -S MYAPP -M -R >> > /web2py/applications/MYAPP/cron/update_records.py >> >> > /web2py/applications/MYAPP/cron/cron.log >> >> > This works great when running from bash, however when I stick this >> > into cron, the only thing that appears in the log is the following. >> >> > =web2py Enterprise Web Framework >> > =Created by Massimo Di Pierro, Copyright 2007-2010 >> > =Version 1.74.11 (2010-02-03 10:53:34) >> > =Database drivers available: SQLite3, PostgreSQL >> > =Starting cron... >> >> > It seems as if web2py is just stopping there, and not executing the >> > update_records file. This is what I have in my linux crontab file. >> >> > */1 * * * * /usr/bin/python /web2py/web2py.py -S MYAPP -M -R >> > /web2py/applications/MYAPP/cron/update_records.py >> >> > /web2py/applications/MYAPP/cron/cron.log >> >> > Why does this work on the command line but not when put into external >> > cron ? On an older version of web2py (version 1.64.*) it works >> > perfectly, currently this is running on 1.74.11. >> >> > -Thadeus > > -- > You received this message because you are subscribed to the Google Groups > "web2py-users" group. > To post to this group, send email to web...@googlegroups.com. > To unsubscribe from this group, send email to > web2py+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/web2py?hl=en. > > -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
Re: [web2py] Re: Execute file in web2py environment fails with cron
I can't stress this enough. This exact same line in the system crontab (I just copied and pasted over to the new server and changed the paths) works perfectly on one server running web2py 1.73.1. -Thadeus On Sun, Feb 14, 2010 at 12:54 PM, Thadeus Burgess wrote: > You misunderstand. I am not using the web2py crontab file. I am using > Linux (ubuntu) anacron, this is in the system crontab file. > > thadeusb$ crontab -e > > etc etc... > > I run three web2py servers, this works on the other two that are > running older web2py versions. The output redirect works perfectly > since it is anacron executing the command. Works perfectly on my > other two servers. The only difference is the web2py version, so something > must have changed. > > -Thadeus > > > > > > On Sun, Feb 14, 2010 at 9:43 AM, mdipierro wrote: >> I think your crontab should just be >> >> */1 * * * * user * /web2py/applications/MYAPP/cron/ >> update_records.py >> >> >> On Feb 14, 9:42 am, mdipierro wrote: >>> I think your crontab should just be >>> >>> */1 * * * * user *cron/update_records.py >>> >>> On Feb 14, 2:13 am, Thadeus Burgess wrote: >>> >>> > When running the command below everything works fine, the python file >>> > executes correctly. >>> >>> > thadeus$ /usr/bin/python /web2py/web2py.py -S MYAPP -M -R >>> > /web2py/applications/MYAPP/cron/update_records.py >> >>> > /web2py/applications/MYAPP/cron/cron.log >>> >>> > This works great when running from bash, however when I stick this >>> > into cron, the only thing that appears in the log is the following. >>> >>> > =web2py Enterprise Web Framework >>> > =Created by Massimo Di Pierro, Copyright 2007-2010 >>> > =Version 1.74.11 (2010-02-03 10:53:34) >>> > =Database drivers available: SQLite3, PostgreSQL >>> > =Starting cron... >>> >>> > It seems as if web2py is just stopping there, and not executing the >>> > update_records file. This is what I have in my linux crontab file. >>> >>> > */1 * * * * /usr/bin/python /web2py/web2py.py -S MYAPP -M -R >>> > /web2py/applications/MYAPP/cron/update_records.py >> >>> > /web2py/applications/MYAPP/cron/cron.log >>> >>> > Why does this work on the command line but not when put into external >>> > cron ? On an older version of web2py (version 1.64.*) it works >>> > perfectly, currently this is running on 1.74.11. >>> >>> > -Thadeus >> >> -- >> You received this message because you are subscribed to the Google Groups >> "web2py-users" group. >> To post to this group, send email to web...@googlegroups.com. >> To unsubscribe from this group, send email to >> web2py+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/web2py?hl=en. >> >> > -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: one cool website
On Feb 14, 10:19 am, mdipierro wrote: > This is one cool web site made with web2py > > http://www.albendas.com It is indeed nice - the main page doesn't load at all (black browser screen) in Google Chrome / Linux (at least the 64bit version, which _is_ in beta - and the 64 bit version notably has more problems), but the domotica app seems to work (e.g. all the flash seems to be working / loading); -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: adding additional elements to custom form while leaving rest untouched
I want it too look like the default rendering of {{=form}} - I just want an easy solution. I looked into the document but it only tells how to customize each and every element. I don't want that, I just want to start the form, display some custom stuff then show the main part of the form (table with labels and widgets) and close the form. >From what I know now I think what I have to do is to create a table manually with a loop through all elements, but I had the feeling that there might be a simpler way to do it than something like that {{=form.custom.begin}} my things here {{= TABLE([TR(TH(item.lable),TD(item.widget)) for item in formitems]) }} {{=form.custom.end}} For that it also takes some code to get the formitems - also I am not sure if the validator warnings would appear?? Can't I do something like? {{=form.custom.begin}} my things here {{= form.elements}} {{=form.custom.end}} On Feb 13, 2:44 pm, DenesL wrote: > Since it is custom it all depends on what you want it to look like. > Have you readhttp://www.web2py.com/AlterEgo/default/show/205? > > On 13 feb, 07:10, selecta wrote: > > > > > I want to add some elements to a form_factroy form while leaving the > > other form elements as they are. > > > My controller looks something like > > def test(): > > form = form_factory( > > Field('category'), > > Field('priority', 'integer', requires=IS_IN_SET([(1,'1 > > - Lowest'),(2,'2'),(3,'3'),(4,'4'),(5,'5 - Medium'),(6,'6'),(7,'7'), > > (8,'8'),(9,'9'),(10,'10 - Highest')], zero=None), default=1, label= > > "Change Priority"), > > ) > > ... > > > return dict(form = form, things = db(db.things.id>0).select()) > > > My test.html view looks something like > > {{=form.custom.begin}} > > {{for item in things:}} > > {{INPUT(_type='checkbox',name='thing_%s'%thing.id) ) }} <-these are > > the addidtional custom elements > > {{pass}} > > now i want to render the form elements (category and priority) - but > > how? > > {{=form.custom.end}} -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: plug-in webfolder
On Jan 29, 9:38 am, selecta wrote: > It depends on an improved IS_IN_SET validator. To use the plug-in you > need to replace the constructor of IS_IN_SET (gluon/validators.py) Hi Selecta, I like the plugin! However, I am not so happy to modify validators.py. I suggest: Either, if IS_IN_SET validator is really 'improved', then can Massimo consider the improvement for inclusion in trunk? Or, maybe Massimo could put a switch in the __init__. Or, if that's not possible, at least would you consider extending the existing IS_IN_SET and put this in plugin_webfolder.py? I mean something like the following (I am no expert, so please let me know if this is stupid): class WEBFOLDER_IS_IN_SET(IS_IN_SET): __init__(..new code here..) BTW I think import re is required. Thanks for your work on this project, it is an excellent idea. Regards --David -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: adding additional elements to custom form while leaving rest untouched
Hi selecta Maybe you mean manually adding an element like this: form[0].insert(TR(...), _id='inserted_table_row') -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: plug-in webfolder
with version 1.74.11 and above you do not need to modify validator.py :) .. will fix the missing import, thx On Feb 14, 9:35 pm, villas wrote: > On Jan 29, 9:38 am, selecta wrote: > > > It depends on an improved IS_IN_SET validator. To use the plug-in you > > need to replace the constructor of IS_IN_SET (gluon/validators.py) > > Hi Selecta, > I like the plugin! However, I am not so happy to modify > validators.py. > > I suggest: > Either, if IS_IN_SET validator is really 'improved', then can Massimo > consider the improvement for inclusion in trunk? > Or, maybe Massimo could put a switch in the __init__. > Or, if that's not possible, at least would you consider extending the > existing IS_IN_SET and put this in plugin_webfolder.py? > > I mean something like the following (I am no expert, so please let me > know if this is stupid): > > class WEBFOLDER_IS_IN_SET(IS_IN_SET): __init__(..new code here..) > > BTW I think import re is required. > > Thanks for your work on this project, it is an excellent idea. > Regards > --David -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: plug-in webfolder
ok it's fixed @villas: If you liked that I'm sure you will like some of the more advances plug-ins that I am currently developing and planing :) On Feb 14, 9:46 pm, selecta wrote: > with version 1.74.11 and above you do not need to modify > validator.py :) > > .. will fix the missing import, thx > > On Feb 14, 9:35 pm, villas wrote: > > > > > On Jan 29, 9:38 am, selecta wrote: > > > > It depends on an improved IS_IN_SET validator. To use the plug-in you > > > need to replace the constructor of IS_IN_SET (gluon/validators.py) > > > Hi Selecta, > > I like the plugin! However, I am not so happy to modify > > validators.py. > > > I suggest: > > Either, if IS_IN_SET validator is really 'improved', then can Massimo > > consider the improvement for inclusion in trunk? > > Or, maybe Massimo could put a switch in the __init__. > > Or, if that's not possible, at least would you consider extending the > > existing IS_IN_SET and put this in plugin_webfolder.py? > > > I mean something like the following (I am no expert, so please let me > > know if this is stupid): > > > class WEBFOLDER_IS_IN_SET(IS_IN_SET): __init__(..new code here..) > > > BTW I think import re is required. > > > Thanks for your work on this project, it is an excellent idea. > > Regards > > --David -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: plug-in webfolder
>> with version 1.74.11 and above you do not need to modify validator.py :) Ah! I couldn't find any instructions except your old post. Thanks. D -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: Execute file in web2py environment fails with cron
I see. Thry this then: */1 * * * * /usr/bin/python /web2py/web2py.py -S MYAPP -M -N -R /web2py/applications/MYAPP/cron/update_records.py >> /web2py/applications/MYAPP/cron/cron.log notice -N in 1.73.1 hardcorn was not working for you. Now that it is working unix cron calls you script wich calls hardcron again. This makes me think that -N should be default if -S. Massimo On Feb 14, 1:00 pm, Thadeus Burgess wrote: > I can't stress this enough. > > This exact same line in the system crontab (I just copied and pasted > over to the new server and changed the paths) works perfectly on one > server running web2py 1.73.1. > > -Thadeus > > On Sun, Feb 14, 2010 at 12:54 PM, Thadeus Burgess > wrote: > > You misunderstand. I am not using the web2py crontab file. I am using > > Linux (ubuntu) anacron, this is in the system crontab file. > > > thadeusb$ crontab -e > > > etc etc... > > > I run three web2py servers, this works on the other two that are > > running older web2py versions. The output redirect works perfectly > > since it is anacron executing the command. Works perfectly on my > > other two servers. The only difference is the web2py version, so something > > must have changed. > > > -Thadeus > > > On Sun, Feb 14, 2010 at 9:43 AM, mdipierro wrote: > >> I think your crontab should just be > > >> */1 * * * * user * /web2py/applications/MYAPP/cron/ > >> update_records.py > > >> On Feb 14, 9:42 am, mdipierro wrote: > >>> I think your crontab should just be > > >>> */1 * * * * user *cron/update_records.py > > >>> On Feb 14, 2:13 am, Thadeus Burgess wrote: > > >>> > When running the command below everything works fine, the python file > >>> > executes correctly. > > >>> > thadeus$ /usr/bin/python /web2py/web2py.py -S MYAPP -M -R > >>> > /web2py/applications/MYAPP/cron/update_records.py >> > >>> > /web2py/applications/MYAPP/cron/cron.log > > >>> > This works great when running from bash, however when I stick this > >>> > into cron, the only thing that appears in the log is the following. > > >>> > =web2py Enterprise Web Framework > >>> > =Created by Massimo Di Pierro, Copyright 2007-2010 > >>> > =Version 1.74.11 (2010-02-03 10:53:34) > >>> > =Database drivers available: SQLite3, PostgreSQL > >>> > =Starting cron... > > >>> > It seems as if web2py is just stopping there, and not executing the > >>> > update_records file. This is what I have in my linux crontab file. > > >>> > */1 * * * * /usr/bin/python /web2py/web2py.py -S MYAPP -M -R > >>> > /web2py/applications/MYAPP/cron/update_records.py >> > >>> > /web2py/applications/MYAPP/cron/cron.log > > >>> > Why does this work on the command line but not when put into external > >>> > cron ? On an older version of web2py (version 1.64.*) it works > >>> > perfectly, currently this is running on 1.74.11. > > >>> > -Thadeus > > >> -- > >> You received this message because you are subscribed to the Google Groups > >> "web2py-users" group. > >> To post to this group, send email to web...@googlegroups.com. > >> To unsubscribe from this group, send email to > >> web2py+unsubscr...@googlegroups.com. > >> For more options, visit this group > >> athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: adding additional elements to custom form while leaving rest untouched
Ah no that won't work since the extra elements are in a different HTML table. I really need form starts table with data and switches (custom) inner sqlfom here ({{=form}} without start and close) form close On Feb 14, 9:44 pm, villas wrote: > Hi selecta > > Maybe you mean manually adding an element like this: > > form[0].insert(TR(...), _id='inserted_table_row') -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] how to display date and time nicely?
This is not 100% web2py related but I am sure if this will be answered many of you will profit at some point from it. Is there a python module that helps you to display dates and times nice e.g. just now (for within the last 5 minutes) 2 hours ago 2 days ago 15th February 2009 ... I guess somebody must have done that already, right? -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: how to display date and time nicely?
Put this in a model def prettydate(d): try: dt = request.now - d except: return '' if dt.days>=365*2: return '%s years ago' % int(dt.days/365) elif dt.days>=365: return '1 years ago' elif dt.days>=60: return '%s months ago' % int(dt.days/30) elif dt.days>21: return '1 months ago' elif dt.days>=14: return '%s weeks ago' % int(dt.days/7) elif dt.days>=7: return '1 week ago' elif dt.days>=2: return '%s days ago' % int(dt.days) elif dt.days==1: return '1 day ago' else: return 'today' On Feb 14, 3:13 pm, selecta wrote: > This is not 100% web2py related but I am sure if this will be answered > many of you will profit at some point from it. > > Is there a python module that helps you to display dates and times > nice e.g. > > just now (for within the last 5 minutes) > 2 hours ago > 2 days ago > 15th February 2009 > ... > > I guess somebody must have done that already, right? -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: one cool website
on Chrome Linux 32 bit all I get is an animation at the centre. On Feb 15, 6:37 am, Yarko Tymciurak wrote: > On Feb 14, 10:19 am, mdipierro wrote: > > > This is one cool web site made with web2py > > > http://www.albendas.com > > It is indeed nice - the main page doesn't load at all (black browser > screen) in Google Chrome / Linux (at least the 64bit version, which > _is_ in beta - and the 64 bit version notably has more problems), but > the domotica app seems to work (e.g. all the flash seems to be > working / loading); -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: adding additional elements to custom form while leaving rest untouched
Just insert your table in the form: form.insert(0,your_table) and in the view use {{=form}} On 14 feb, 16:01, selecta wrote: > Ah no that won't work since the extra elements are in a different HTML > table. > I really need > > form starts > table with data and switches (custom) > inner sqlfom here ({{=form}} without start and close) > form close -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
Re: [web2py] Re: Execute file in web2py environment fails with cron
Adding -N does not fix it. Only the following happens: =web2py Enterprise Web Framework =Created by Massimo Di Pierro, Copyright 2007-2010 =Version 1.74.11 (2010-02-03 10:53:34) =Database drivers available: SQLite3, PostgreSQL Still works if executed from bash. It is the users crontab file (crontab -e) so there should be no permission issues. -Thadeus On Sun, Feb 14, 2010 at 2:58 PM, mdipierro wrote: > I see. Thry this then: > > */1 * * * * /usr/bin/python /web2py/web2py.py -S MYAPP -M -N -R > /web2py/applications/MYAPP/cron/update_records.py >> > /web2py/applications/MYAPP/cron/cron.log > > notice -N > > in 1.73.1 hardcorn was not working for you. Now that it is working > unix cron calls you script wich calls hardcron again. This makes me > think that -N should be default if -S. > > Massimo > > On Feb 14, 1:00 pm, Thadeus Burgess wrote: >> I can't stress this enough. >> >> This exact same line in the system crontab (I just copied and pasted >> over to the new server and changed the paths) works perfectly on one >> server running web2py 1.73.1. >> >> -Thadeus >> >> On Sun, Feb 14, 2010 at 12:54 PM, Thadeus Burgess >> wrote: >> > You misunderstand. I am not using the web2py crontab file. I am using >> > Linux (ubuntu) anacron, this is in the system crontab file. >> >> > thadeusb$ crontab -e >> >> > etc etc... >> >> > I run three web2py servers, this works on the other two that are >> > running older web2py versions. The output redirect works perfectly >> > since it is anacron executing the command. Works perfectly on my >> > other two servers. The only difference is the web2py version, so something >> > must have changed. >> >> > -Thadeus >> >> > On Sun, Feb 14, 2010 at 9:43 AM, mdipierro wrote: >> >> I think your crontab should just be >> >> >> */1 * * * * user * /web2py/applications/MYAPP/cron/ >> >> update_records.py >> >> >> On Feb 14, 9:42 am, mdipierro wrote: >> >>> I think your crontab should just be >> >> >>> */1 * * * * user *cron/update_records.py >> >> >>> On Feb 14, 2:13 am, Thadeus Burgess wrote: >> >> >>> > When running the command below everything works fine, the python file >> >>> > executes correctly. >> >> >>> > thadeus$ /usr/bin/python /web2py/web2py.py -S MYAPP -M -R >> >>> > /web2py/applications/MYAPP/cron/update_records.py >> >> >>> > /web2py/applications/MYAPP/cron/cron.log >> >> >>> > This works great when running from bash, however when I stick this >> >>> > into cron, the only thing that appears in the log is the following. >> >> >>> > =web2py Enterprise Web Framework >> >>> > =Created by Massimo Di Pierro, Copyright 2007-2010 >> >>> > =Version 1.74.11 (2010-02-03 10:53:34) >> >>> > =Database drivers available: SQLite3, PostgreSQL >> >>> > =Starting cron... >> >> >>> > It seems as if web2py is just stopping there, and not executing the >> >>> > update_records file. This is what I have in my linux crontab file. >> >> >>> > */1 * * * * /usr/bin/python /web2py/web2py.py -S MYAPP -M -R >> >>> > /web2py/applications/MYAPP/cron/update_records.py >> >> >>> > /web2py/applications/MYAPP/cron/cron.log >> >> >>> > Why does this work on the command line but not when put into external >> >>> > cron ? On an older version of web2py (version 1.64.*) it works >> >>> > perfectly, currently this is running on 1.74.11. >> >> >>> > -Thadeus >> >> >> -- >> >> You received this message because you are subscribed to the Google Groups >> >> "web2py-users" group. >> >> To post to this group, send email to web...@googlegroups.com. >> >> To unsubscribe from this group, send email to >> >> web2py+unsubscr...@googlegroups.com. >> >> For more options, visit this group >> >> athttp://groups.google.com/group/web2py?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "web2py-users" group. > To post to this group, send email to web...@googlegroups.com. > To unsubscribe from this group, send email to > web2py+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/web2py?hl=en. > > -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: Execute file in web2py environment fails with cron
can you print os.getcwd() to see in which folder it is being executed? On Feb 14, 9:04 pm, Thadeus Burgess wrote: > Adding -N does not fix it. > > Only the following happens: > > =web2py Enterprise Web Framework > =Created by Massimo Di Pierro, Copyright 2007-2010 > =Version 1.74.11 (2010-02-03 10:53:34) > =Database drivers available: SQLite3, PostgreSQL > > Still works if executed from bash. It is the users crontab file > (crontab -e) so there should be no permission issues. > > -Thadeus > > On Sun, Feb 14, 2010 at 2:58 PM, mdipierro wrote: > > I see. Thry this then: > > > */1 * * * * /usr/bin/python /web2py/web2py.py -S MYAPP -M -N -R > > /web2py/applications/MYAPP/cron/update_records.py >> > > /web2py/applications/MYAPP/cron/cron.log > > > notice -N > > > in 1.73.1 hardcorn was not working for you. Now that it is working > > unix cron calls you script wich calls hardcron again. This makes me > > think that -N should be default if -S. > > > Massimo > > > On Feb 14, 1:00 pm, Thadeus Burgess wrote: > >> I can't stress this enough. > > >> This exact same line in the system crontab (I just copied and pasted > >> over to the new server and changed the paths) works perfectly on one > >> server running web2py 1.73.1. > > >> -Thadeus > > >> On Sun, Feb 14, 2010 at 12:54 PM, Thadeus Burgess > >> wrote: > >> > You misunderstand. I am not using the web2py crontab file. I am using > >> > Linux (ubuntu) anacron, this is in the system crontab file. > > >> > thadeusb$ crontab -e > > >> > etc etc... > > >> > I run three web2py servers, this works on the other two that are > >> > running older web2py versions. The output redirect works perfectly > >> > since it is anacron executing the command. Works perfectly on my > >> > other two servers. The only difference is the web2py version, so > >> > something > >> > must have changed. > > >> > -Thadeus > > >> > On Sun, Feb 14, 2010 at 9:43 AM, mdipierro > >> > wrote: > >> >> I think your crontab should just be > > >> >> */1 * * * * user * /web2py/applications/MYAPP/cron/ > >> >> update_records.py > > >> >> On Feb 14, 9:42 am, mdipierro wrote: > >> >>> I think your crontab should just be > > >> >>> */1 * * * * user *cron/update_records.py > > >> >>> On Feb 14, 2:13 am, Thadeus Burgess wrote: > > >> >>> > When running the command below everything works fine, the python file > >> >>> > executes correctly. > > >> >>> > thadeus$ /usr/bin/python /web2py/web2py.py -S MYAPP -M -R > >> >>> > /web2py/applications/MYAPP/cron/update_records.py >> > >> >>> > /web2py/applications/MYAPP/cron/cron.log > > >> >>> > This works great when running from bash, however when I stick this > >> >>> > into cron, the only thing that appears in the log is the following. > > >> >>> > =web2py Enterprise Web Framework > >> >>> > =Created by Massimo Di Pierro, Copyright 2007-2010 > >> >>> > =Version 1.74.11 (2010-02-03 10:53:34) > >> >>> > =Database drivers available: SQLite3, PostgreSQL > >> >>> > =Starting cron... > > >> >>> > It seems as if web2py is just stopping there, and not executing the > >> >>> > update_records file. This is what I have in my linux crontab file. > > >> >>> > */1 * * * * /usr/bin/python /web2py/web2py.py -S MYAPP -M -R > >> >>> > /web2py/applications/MYAPP/cron/update_records.py >> > >> >>> > /web2py/applications/MYAPP/cron/cron.log > > >> >>> > Why does this work on the command line but not when put into external > >> >>> > cron ? On an older version of web2py (version 1.64.*) it works > >> >>> > perfectly, currently this is running on 1.74.11. > > >> >>> > -Thadeus > > >> >> -- > >> >> You received this message because you are subscribed to the Google > >> >> Groups "web2py-users" group. > >> >> To post to this group, send email to web...@googlegroups.com. > >> >> To unsubscribe from this group, send email to > >> >> web2py+unsubscr...@googlegroups.com. > >> >> For more options, visit this group > >> >> athttp://groups.google.com/group/web2py?hl=en. > > > -- > > You received this message because you are subscribed to the Google Groups > > "web2py-users" group. > > To post to this group, send email to web...@googlegroups.com. > > To unsubscribe from this group, send email to > > web2py+unsubscr...@googlegroups.com. > > For more options, visit this group > > athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: adding additional elements to custom form while leaving rest untouched
On Feb 14, 3:01 pm, selecta wrote: > Ah no that won't work since the extra elements are in a different HTML > table. > I really need > > form starts > table with data and switches (custom) > inner sqlfom here ({{=form}} without start and close) > form close Maybe what you really need is a FORM.factory - Mix in parts with parts from a table; You can do all the checking you want on what shows in the form from your controller, and just keep a simple view. If you need to manually validate / manipulate after input, you can do this in the controller also: form.accepts(. dbio=False), then make whatever logic you need, update whatever controller modified (potentially) field updates you need. If you have more esoteric needs than that - e.g. changing the input values, validating on a stack of validations, etc. (I recently did for email copy/paste batch registration on PyCon), you can create a memory database table, with all the fileds exactly as you want them, i.e. with all the form validation, comments, labels, etc. - and then apply to whatever table / tables / fields you want that are persistent after the accepts. Hope this will give you some useful insight. Regards, Yarko p.s. - I have not been watching this much the past few months, so I may not be aware of all the new features / changes, but basically this should still all be good advice don't try to do more than "layout" / look & feel logic in your view. > > On Feb 14, 9:44 pm, villas wrote: > > > Hi selecta > > > Maybe you mean manually adding an element like this: > > > form[0].insert(TR(...), _id='inserted_table_row') -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
Re: [web2py] Re: Execute file in web2py environment fails with cron
/web2py -Thadeus On Sun, Feb 14, 2010 at 10:30 PM, mdipierro wrote: > can you print os.getcwd() to see in which folder it is being executed? > > On Feb 14, 9:04 pm, Thadeus Burgess wrote: >> Adding -N does not fix it. >> >> Only the following happens: >> >> =web2py Enterprise Web Framework >> =Created by Massimo Di Pierro, Copyright 2007-2010 >> =Version 1.74.11 (2010-02-03 10:53:34) >> =Database drivers available: SQLite3, PostgreSQL >> >> Still works if executed from bash. It is the users crontab file >> (crontab -e) so there should be no permission issues. >> >> -Thadeus >> >> On Sun, Feb 14, 2010 at 2:58 PM, mdipierro wrote: >> > I see. Thry this then: >> >> > */1 * * * * /usr/bin/python /web2py/web2py.py -S MYAPP -M -N -R >> > /web2py/applications/MYAPP/cron/update_records.py >> >> > /web2py/applications/MYAPP/cron/cron.log >> >> > notice -N >> >> > in 1.73.1 hardcorn was not working for you. Now that it is working >> > unix cron calls you script wich calls hardcron again. This makes me >> > think that -N should be default if -S. >> >> > Massimo >> >> > On Feb 14, 1:00 pm, Thadeus Burgess wrote: >> >> I can't stress this enough. >> >> >> This exact same line in the system crontab (I just copied and pasted >> >> over to the new server and changed the paths) works perfectly on one >> >> server running web2py 1.73.1. >> >> >> -Thadeus >> >> >> On Sun, Feb 14, 2010 at 12:54 PM, Thadeus Burgess >> >> wrote: >> >> > You misunderstand. I am not using the web2py crontab file. I am using >> >> > Linux (ubuntu) anacron, this is in the system crontab file. >> >> >> > thadeusb$ crontab -e >> >> >> > etc etc... >> >> >> > I run three web2py servers, this works on the other two that are >> >> > running older web2py versions. The output redirect works perfectly >> >> > since it is anacron executing the command. Works perfectly on my >> >> > other two servers. The only difference is the web2py version, so >> >> > something >> >> > must have changed. >> >> >> > -Thadeus >> >> >> > On Sun, Feb 14, 2010 at 9:43 AM, mdipierro >> >> > wrote: >> >> >> I think your crontab should just be >> >> >> >> */1 * * * * user * /web2py/applications/MYAPP/cron/ >> >> >> update_records.py >> >> >> >> On Feb 14, 9:42 am, mdipierro wrote: >> >> >>> I think your crontab should just be >> >> >> >>> */1 * * * * user *cron/update_records.py >> >> >> >>> On Feb 14, 2:13 am, Thadeus Burgess wrote: >> >> >> >>> > When running the command below everything works fine, the python >> >> >>> > file >> >> >>> > executes correctly. >> >> >> >>> > thadeus$ /usr/bin/python /web2py/web2py.py -S MYAPP -M -R >> >> >>> > /web2py/applications/MYAPP/cron/update_records.py >> >> >> >>> > /web2py/applications/MYAPP/cron/cron.log >> >> >> >>> > This works great when running from bash, however when I stick this >> >> >>> > into cron, the only thing that appears in the log is the following. >> >> >> >>> > =web2py Enterprise Web Framework >> >> >>> > =Created by Massimo Di Pierro, Copyright 2007-2010 >> >> >>> > =Version 1.74.11 (2010-02-03 10:53:34) >> >> >>> > =Database drivers available: SQLite3, PostgreSQL >> >> >>> > =Starting cron... >> >> >> >>> > It seems as if web2py is just stopping there, and not executing the >> >> >>> > update_records file. This is what I have in my linux crontab file. >> >> >> >>> > */1 * * * * /usr/bin/python /web2py/web2py.py -S MYAPP -M -R >> >> >>> > /web2py/applications/MYAPP/cron/update_records.py >> >> >> >>> > /web2py/applications/MYAPP/cron/cron.log >> >> >> >>> > Why does this work on the command line but not when put into >> >> >>> > external >> >> >>> > cron ? On an older version of web2py (version 1.64.*) it works >> >> >>> > perfectly, currently this is running on 1.74.11. >> >> >> >>> > -Thadeus >> >> >> >> -- >> >> >> You received this message because you are subscribed to the Google >> >> >> Groups "web2py-users" group. >> >> >> To post to this group, send email to web...@googlegroups.com. >> >> >> To unsubscribe from this group, send email to >> >> >> web2py+unsubscr...@googlegroups.com. >> >> >> For more options, visit this group >> >> >> athttp://groups.google.com/group/web2py?hl=en. >> >> > -- >> > You received this message because you are subscribed to the Google Groups >> > "web2py-users" group. >> > To post to this group, send email to web...@googlegroups.com. >> > To unsubscribe from this group, send email to >> > web2py+unsubscr...@googlegroups.com. >> > For more options, visit this group >> > athttp://groups.google.com/group/web2py?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "web2py-users" group. > To post to this group, send email to web...@googlegroups.com. > To unsubscribe from this group, send email to > web2py+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/web2py?hl=en. > > -- You received this message because you are subscribed to the Google Groups "web2py-users"
[web2py] DAL integer length
How can I force the DAL to use a 64-bit integer length (BIGINT) per facebook requirements for storing UIDs? -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: how to display date and time nicely?
:) On Feb 15, 12:54 am, mdipierro wrote: > Put this in a model > > def prettydate(d): > try: > dt = request.now - d > except: > return '' > if dt.days>=365*2: > return '%s years ago' % int(dt.days/365) > elif dt.days>=365: > return '1 years ago' > elif dt.days>=60: > return '%s months ago' % int(dt.days/30) > elif dt.days>21: > return '1 months ago' > elif dt.days>=14: > return '%s weeks ago' % int(dt.days/7) > elif dt.days>=7: > return '1 week ago' > elif dt.days>=2: > return '%s days ago' % int(dt.days) > elif dt.days==1: > return '1 day ago' > else: > return 'today' > > On Feb 14, 3:13 pm, selecta wrote: > > > > > This is not 100% web2py related but I am sure if this will be answered > > many of you will profit at some point from it. > > > Is there a python module that helps you to display dates and times > > nice e.g. > > > just now (for within the last 5 minutes) > > 2 hours ago > > 2 days ago > > 15th February 2009 > > ... > > > I guess somebody must have done that already, right? -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.