[web2py] Re: Drupal alternatives in Python or web2py

2011-01-07 Thread VP
Drupal is a Trojan horse.  Don't go there.


On Jan 6, 7:21 pm, Luther Goh Lu Feng elf...@yahoo.com wrote:
 Even though it is in php, with the release of Drupal 7, I am tempted
 to give it a spin just to see what's the fuss all about. Drupal seems
 extremely popular, looking at some of the well known organisations
 that have used it. But are there any python, or hopefully, web2py
 alternatives to it?


[web2py] Re: ADVOCACY: every single other Python program ever written uses imports?

2011-01-07 Thread cjrh
On Jan 7, 2:12 am, Mariano Reingart reing...@gmail.com wrote:
 I know that in your mind skipping imports is about not repeating
 yourself. But look guys: every single other Python program ever
 written uses imports. By not including them you've basically made sure
 that learning web2py is different from learning Python.

Excessive desire to see all import statements comes from (OCD) fear.
Fear leads to hate.  Hate leads to the dark side :)

My 2c is that guys like Jacobian are really, really scared of web2py,
and want to kill it now before it grows bigger.  Otherwise, they
wouldn't go out of their way to write these huge posts about it.


[web2py] Re: Drupal alternatives in Python or web2py

2011-01-07 Thread cjrh
On Jan 7, 9:59 am, VP vtp2...@gmail.com wrote:
 Drupal is a Trojan horse.  Don't go there.

What's the enemy hiding inside?  PHP?


[web2py] Re: ADVOCACY: every single other Python program ever written uses imports?

2011-01-07 Thread VP
Jacobian made a few bogus statements.  One is about imports.

In fact, you don't need to import anything to use Python globals or
primitive data structures.  Why?  because those primitives structures
are so useful and often used that they are automatically imported for
use.

This is conceptually similar about the Web2py primitives.  These
primitives are so often used that there are automatically imported.

Another bogus statement is about web2py is harder to learn.  Now.
Jacob is a very smart guy with proven records.  But he doesn't have a
record of being a teacher, one that Massimo has.  I think it is this
experience that Massimo understands better what it is easy or
difficult for beginners to learn.  Personally, I have two Django books
in my bookshelf, but I eventually gave up Django to look for other
options that did waste my time.   A little more objective, if people
pay attention to the tweets, there are lots of beginners who love
web2py and find it so easy to learn.



The most outrageous thing that comes out of Jacob and some other folks
is this mentality that Python experts will look down to you if you
use web2py or sure, beginners love web2py because they are
beginners.   These guys seem to have no clue about the increasingly
pervasive nature of computing in society today.  There are many very
smart and intelligent beginners who know little about web frameworks
or even Python.  They simply look for tools to develop their ideas.
In fact, you see many scientists and researchers who write programs
and develop webapps (in particular).  My thinking is in the short
future many more (smart) people who will be writing programs,
naturally.  They will look for tools that in the easiest manner
facilitate the creation of what they want to do.

It is very unfortunately that these young and smart guys are trapped
in their narrow world.  So much group-think.  So narrow-minded.

My advice again is simply to ignore them.  As I said in a previous
post, as long as you mention Flask, Django in the same breath as
web2py, it's going to be a negative experience.









[web2py] Re: Drupal alternatives in Python or web2py

2011-01-07 Thread VP
It's not so much PHP (at least not directly).

It's a Trojan horse because it's a very attractive tool to create
something quick, easy and pretty.  CCK (now included in core), Panel,
Views are so powerful that you can create many websites (apps) with
them.  But as you go deeper, trying to add features, it will be so
difficult.  Just to make the app looks right to your taste is really a
challenging job.

Another thing that is not so obvious to beginners is performance.  It
will baffle you how many database queries are made just to show a page
(Drupal 6, but 7 is probably the same).  Caching is good, but sometime
you can't cache everything.

Essentially, there are so much thing in the package that you have to
piggy back for your app.  Things like web2py are much more tidy. You
have a global views of where things are.  But Drupal is huge.

well that's my point of view.




On Jan 7, 2:03 am, cjrh caleb.hatti...@gmail.com wrote:
 On Jan 7, 9:59 am, VP vtp2...@gmail.com wrote:

  Drupal is a Trojan horse.  Don't go there.

 What's the enemy hiding inside?  PHP?


[web2py] Re: new URL router release candidate

2011-01-07 Thread VP
Actually, I'm using the route.py script that Massimo provided a while
ago.  But a more understandable configuration is preferable. Here it
is (routes.conf is not listed here):

default_function = 'v'

try: config=open('routes.conf','r').read()
except: config=''

def auto_in(apps):
routes=[
('/robots.txt','/welcome/static/robots.txt'),
('/admin$anything','/admin$anything'),
]
for a,b in [x.strip().split() for x in apps.split('\n') if
x.strip() and not x.strip().startswith('#')]:
if not b.startswith('/'): b='/'+b
if b.endswith('/'): b=b[:-1]
app = b.split('/')[1]
routes+=[
('.*:https?://(www\.)?%s:$method /' % a,'%s' % b),
('.*:https?://(www\.)?%s:$method /$anything' % a,'%s/
$anything' % b),
('.*:https?://(.*\.)?%s:$method /static/$anything' % a,'%s/
static/$anything' % app),
('.*:https?://(.*\.)?%s:$method /appadmin/$anything' %
a,'%s/appadmin/$anything' % app),
]
return routes



default_function = 'v'

try: config=open('routes.conf','r').read()
except: config=''

def auto_in(apps):
routes=[
('/robots.txt','/welcome/static/robots.txt'),
('/admin$anything','/admin$anything'),
]
for a,b in [x.strip().split() for x in apps.split('\n') if
x.strip() and not x.strip().startswith('#')]:
if not b.startswith('/'): b='/'+b
if b.endswith('/'): b=b[:-1]
app = b.split('/')[1]
routes+=[
('.*:https?://(www\.)?%s:$method /' % a,'%s' % b),
('.*:https?://(www\.)?%s:$method /$anything' % a,'%s/
$anything' % b),
('.*:https?://(.*\.)?%s:$method /static/$anything' % a,'%s/
static/$anything' % app),
('.*:https?://(.*\.)?%s:$method /appadmin/$anything' %
a,'%s/appadmin/$anything' % app),
]
return routes





On Jan 6, 2:45 pm, Jonathan Lundell jlund...@pobox.com wrote:
 On Jan 6, 2011, at 11:52 AM, VP wrote:



  While this is intended to simplify the current specifications of
  routes.py (I think), what I have seen is more confusing to me.  Does
  this replace the old routes.py?

  Maybe, can you provide examples of typical use cases?  For example,
  one VPS account, each domain mapping to each app.  Anything else?

 BTW, I'd appreciate if you'd send me (or post here) your existing routes.py. 
 I'll send back (or post) the equivalent routers configuration.

 I'd like to see some real-world configurations before declaring that the 
 format and logic is final; it's entirely possible that I've missed some 
 needed features.


[web2py] Re: new URL router release candidate

2011-01-07 Thread VP
sorry that was copypaste mistake.  Here it is:


try: config=open('routes.conf','r').read()
except: config=''

def auto_in(apps):
routes=[
('/robots.txt','/welcome/static/robots.txt'),
('/admin$anything','/admin$anything'),
]
for a,b in [x.strip().split() for x in apps.split('\n') if
x.strip() and not x.strip().startswith('#')]:
if not b.startswith('/'): b='/'+b
if b.endswith('/'): b=b[:-1]
app = b.split('/')[1]
routes+=[
('.*:https?://(www\.)?%s:$method /' % a,'%s' % b),
('.*:https?://(www\.)?%s:$method /$anything' % a,'%s/
$anything' % b),
('.*:https?://(.*\.)?%s:$method /static/$anything' % a,'%s/
static/$anything' % app),
('.*:https?://(.*\.)?%s:$method /appadmin/$anything' %
a,'%s/appadmin/$anything' % app),
]
return routes

def auto_out(apps):
routes=[]
for a,b in [x.strip().split() for x in apps.split('\n') if
x.strip() and not x.strip().startswith('#')]:
if not b.startswith('/'): b='/'+b
if b.endswith('/'): b=b[:-1]
app = b.split('/')[1]
routes+=[
('%s/static/$anything' % app,'/static/$anything'),
('%s/appadmin/$anything' % app, '/appadmin/$anything'),
('%s/$anything' % b, '/$anything'),
]
return routes

routes_in=auto_in(config)
routes_out=auto_out(config)


[web2py] Re: web2py-related thread at reddit

2011-01-07 Thread ron_m
It is unfortunate that these things occur and hopefully people are going to 
be serious developers on a framework are smart enough to do their own 
evaluation.

I came to Python about 1.5 years ago mainly because I was doing video 
processing with gstreamer and the best control language for that is Python 
unless you want to work in C/C++ with no performance advantage because the 
heavy lifting is already going on in the gstreamer library coded mostly in 
C.

I needed to add a web site to work with the underlying application for 
general user access and while I was doing the above work I spent a lot of 
time on the various Python web framework web sites. I had already done 
extensive web work in Java and PHP, each to his own but I didn't like the 
prospects of working with either of those any more. I found most of the 
usual suspects including web2py in less than an hour and spent time reading 
the news groups etc. I saw these negative comments before, looked at the 
other frameworks but kept coming back to web2py. I made the commitment to 
use web2py sometime last summer.

Why? 

Because it was incredibly self contained but still could be extended easily. 
The others looked like a collection of libraries put together.

Because of the simplicity of defining a model in the DAL and the nice flow 
of request to response through controllers and views. 

In a pragmattic sort of way it all seemed to just fit together and work 
without an impedance mismatch to what I am trying to achieve. It required 
essentially nothing in boilerplate code. There is this small set of objects 
you work with to complete the server side workings of a web request, use 
them to do what you need, move on to next request. I see web2py as a nice 
abstraction layer that handles all the complicated details for you that 
requires the least amount of work on my part. Some call it magic, I call it 
something I don't have to worry about.

The dedication of the leader of the project Massimo and the responsiveness 
to problems and enhancements.

The commitment to backward compatibility.

The good, helpful and friendly attitude of the community.

Ron



[web2py] Re: web2py-related thread at reddit

2011-01-07 Thread ron_m
Forgot to mention the admin interface and the ability to compile and package 
an application in a couple of button presses into a single file and then 
deploy to the production servers.

The ticketing system instead of come look at my screen, it broke. My users 
are in locations up to 3000 miles away and have essentially zero computer 
skills beyond using a browser, email and other basics.


[web2py] Output literal '{{' and '}}' in template

2011-01-07 Thread hcvst
Hi,

I'm using a jQuery template plugin that also uses '{{' and '}}' as
markers.  I need to output something like img src={{url}} / in the
rendered HTML. I'm now using this but is there a better way?

{{=XML(u'img src={{url\u007D\u007D /')}}

Thanks,
HC


[web2py] Re: Multi Tabbed Menu - Any Suggestions.

2011-01-07 Thread selecta
not sure this is what you want but you can easily build tabs with
web2pys included ajax functions

default.py

def index():
 return dict()

def page1():
 return 'this is page 1'

def page2():
 return 'this is page 2'


index.html
{{=UL([LI('Page %s'%i,
_onclick=XML(web2py_component('%s','tabtarget')%URL(request.application,
'default', 'page%s'%i))) for i in range(1,3)], _class='tabs')}}
div id='tabtarget'Welcome to the initial content/div

style
 li {
list-style: none;
float: left;
border: solid 2px black;
border-bottom: none;
border-top-left-radius: 3px;
border-top-right-radius: 3px;
}
/style

just improvised a bit with the css, but this is the main idea

On Jan 6, 6:58 am, David J. da...@styleflare.com wrote:
 I was wondering if anyone on the list has seen an good multi-level
 horizontal tab menu.

 I have

 div id=menu

 ul
 li class=selectedCompany
 ul
 li class=selectedOverview/li
 liOur People/li

 /ul
 liProducts
 ul
 liProduct 1/li
 liProduct 2/li
 /ul
 /li

 /ul
 /div

 Obviously the second layer is visible on the selected tab.

 I was hoping there might be something already made that does this.

 I dont want a drop down menu;
 I am looking for horizontal tabs.

 Sorry I know its not web2py related; but my project is in web2py. =)


[web2py] wrong documentation on ajax api sample?

2011-01-07 Thread kuokon

hello,

from the document
 (page 423 of 3rd edition of web2py, and 
http://web2py.com/book/default/chapter/10)

it say the ajax api has the following signature
   input id=name onkeyup=ajax('echo', ['name'], 'target') /

however, when I tried on my own application, instead of the 'id'
field, I need to use the 'name' field
   input name=name onkeyup=ajax('echo', ['name'], 'target') /

in order for the ajax api to work. (ie, the input tag has to be 'name'
instead of 'id')

maybe the document was wrong or the API get changed recently?
I'm using the most recent (web2py-1.91.5) web2py.


Best,


[web2py] Re: ADVOCACY: every single other Python program ever written uses imports?

2011-01-07 Thread puercoespin
 Indeed.

 Moreover, while it's not best practice, it's certainly common enough to see

         from somewhere import *

 which magically injects a bunch of names into the namespace.

 Your suggestion that web2py simply has a small set of built-ins strikes me as 
 right on.

For exemple

from gluon.tools import *

in db.py.

:)



[web2py] Re: Drupal alternatives in Python or web2py

2011-01-07 Thread cjrh
On Jan 7, 10:27 am, VP vtp2...@gmail.com wrote:
 But as you go deeper, trying to add features, it will be so
 difficult.  Just to make the app looks right to your taste is really a
 challenging job.

Ok, interesting.


[web2py] Re: Using fossil-scm as a distributed backed for web2py and unhosted (on-linf off-line) apps.

2011-01-07 Thread cjrh
On Jan 6, 7:31 pm, Offray Vladimir Luna Cárdenas off...@riseup.net
wrote:
 I think that Fossil is more self contained, portable and easy to learn
 that Git, from a newbie point of view:

Go with what you like best, and don't let anyone tell you otherwise.

 By Fabric do you mean [1]?

Yes. It makes deployment a solved problem.


[web2py] Re: congratulations on making it to pycon2011 :)

2011-01-07 Thread Robert
Congratulations, I hope my vote helped! :)

I would join if it was held in Europe.




[web2py] Multilanguage wiki

2011-01-07 Thread Grezly
I'm trying to create a multilanguage wiki with the plugin_wiki.
I know i can create just a few pages with different slugs
(corresponding to the language) for the same article, but what i can't
figure out is how to create a menu, using meta-menu or another way,
that belongs to a specific language.



[web2py] Re: Output literal '{{' and '}}' in template

2011-01-07 Thread Massimo Di Pierro
Perhaps this?

from gluon.template import render

def index():
return render(filename=viewfilename,context={},delimiters=('
%','%'))

On Jan 7, 2:58 am, hcvst hcv...@googlemail.com wrote:
 Hi,

 I'm using a jQuery template plugin that also uses '{{' and '}}' as
 markers.  I need to output something like img src={{url}} / in the
 rendered HTML. I'm now using this but is there a better way?

 {{=XML(u'img src={{url\u007D\u007D /')}}

 Thanks,
 HC


[web2py] Re: ADVOCACY: every single other Python program ever written uses imports?

2011-01-07 Thread Anthony
+1

On Friday, January 7, 2011 3:18:55 AM UTC-5, VP wrote:

 Jacobian made a few bogus statements.  One is about imports. 

 In fact, you don't need to import anything to use Python globals or 
 primitive data structures.  Why?  because those primitives structures 
 are so useful and often used that they are automatically imported for 
 use. 

 This is conceptually similar about the Web2py primitives.  These 
 primitives are so often used that there are automatically imported. 

 Another bogus statement is about web2py is harder to learn.  Now. 
 Jacob is a very smart guy with proven records.  But he doesn't have a 
 record of being a teacher, one that Massimo has.  I think it is this 
 experience that Massimo understands better what it is easy or 
 difficult for beginners to learn.  Personally, I have two Django books 
 in my bookshelf, but I eventually gave up Django to look for other 
 options that did waste my time.   A little more objective, if people 
 pay attention to the tweets, there are lots of beginners who love 
 web2py and find it so easy to learn. 



 The most outrageous thing that comes out of Jacob and some other folks 
 is this mentality that Python experts will look down to you if you 
 use web2py or sure, beginners love web2py because they are 
 beginners.   These guys seem to have no clue about the increasingly 
 pervasive nature of computing in society today.  There are many very 
 smart and intelligent beginners who know little about web frameworks 
 or even Python.  They simply look for tools to develop their ideas. 
 In fact, you see many scientists and researchers who write programs 
 and develop webapps (in particular).  My thinking is in the short 
 future many more (smart) people who will be writing programs, 
 naturally.  They will look for tools that in the easiest manner 
 facilitate the creation of what they want to do. 

 It is very unfortunately that these young and smart guys are trapped 
 in their narrow world.  So much group-think.  So narrow-minded. 

 My advice again is simply to ignore them.  As I said in a previous 
 post, as long as you mention Flask, Django in the same breath as 
 web2py, it's going to be a negative experience. 









[web2py] Re: web2py-related thread at reddit

2011-01-07 Thread Anthony
On Friday, January 7, 2011 2:58:14 AM UTC-5, cjrh wrote: 

 On Jan 7, 12:06 am, Anthony abas...@gmail.com wrote: 
  In case anyone is interested... 
  
  http://www.reddit.com/r/Python/comments/ex54j/seeking_clarification_o... 


 Massimo should just stop caring.   The reddit people have already 
 heard the sales pitch, and further energy spent on trying to convince 
 them is wasted.

 
You're right, it's not worth spending energy to try to convince these 
particular individuals -- they've all got vested interests (personal or 
professional) in alternatives. However, lots of disinterested folks are also 
reading those reddit threads, so sometimes it's worth correcting the record 
just so web2py is not publicly defined solely by its detractors. I was 
reading these kinds of discussions a few months back when I was researching 
web frameworks, and if it hadn't been for Massimo correcting some false 
claims of others, I might have been scared off of web2py.
 
Anthony


[web2py] Re: wrong documentation on ajax api sample?

2011-01-07 Thread DenesL

Hmmm... somewhere after 1.56.2 the ajax function was changed.
It now uses serialize (which encodes a set of form elements as a
string for submission) instead of the original getElementById.


On Jan 7, 5:15 am, kuokon kuo...@gmail.com wrote:
 hello,

 from the document
      (page 423 of 3rd edition of web2py, 
 andhttp://web2py.com/book/default/chapter/10)

 it say the ajax api has the following signature
    input id=name onkeyup=ajax('echo', ['name'], 'target') /

 however, when I tried on my own application, instead of the 'id'
 field, I need to use the 'name' field
    input name=name onkeyup=ajax('echo', ['name'], 'target') /

 in order for the ajax api to work. (ie, the input tag has to be 'name'
 instead of 'id')

 maybe the document was wrong or the API get changed recently?
 I'm using the most recent (web2py-1.91.5) web2py.

 Best,


Re: [web2py] Re: ADVOCACY: every single other Python program ever written uses imports?

2011-01-07 Thread Jonathan Lundell
On Jan 7, 2011, at 2:15 AM, puercoespin wrote:
 
 Indeed.
 
 Moreover, while it's not best practice, it's certainly common enough to see
 
 from somewhere import *
 
 which magically injects a bunch of names into the namespace.
 
 Your suggestion that web2py simply has a small set of built-ins strikes me 
 as right on.
 
 For exemple
 
 from gluon.tools import *
 
 in db.py.
 
 :)

Exactly right. I've removed a few of those, but it's tedious work.

I've been using pyflakes as a quick check on my Python coding. Pyflakes is very 
handy, but it's also fairly simpleminded. If you say from gluon.tools import 
*, it doesn't look in gluon.tools to see what that might mean; it just turns 
off its search for undefined symbols. So to get its benefit, you have to fix 
the import *.

For the same reason, a lot of my code starts out with:

if False:
import request, response, session, T, (etc)

OTOH, pyflakes has built-in knowledge of built-in Python globals.

One of the things that the web2py-imports discussion tends to miss, though, is 
that the web2py globals exist precisely because they're *not* globals--they 
have request scope, not global scope. They can't be imported (in a 
straightforward way, anyway), and it would be a PITA to have to pass them 
around everywhere. That would have been an alternative strategy for web2py: 
every argument list starts with the request-global, which would include all 
that stuff.

Re: [web2py] Re: ADVOCACY: every single other Python program ever written uses imports?

2011-01-07 Thread Bruno Rocha
After being offended by web2py being in Pycon, they made a major
attack on reddit, raised a bunch of lies. Alarmed against web2py on
twitter (they managed to enter to the top tweets) and
this created a certain discomfort.

Some of my clients (two of them) called me asking for explanations about it.
(Interestingly, after my explanation they seem much more confident)

Moreover two new possible new clients came to me today (one by
experts4solutions), one of them commented about the topic and the tweets, so
it awakened interest to evaluate web2py to a new small project.

A company that offers online training came to me asking me to submit a
web2py training to their program,  they think web2py is trendy and many
people are talking about it on the web, then it is a good
time to offer training.

thanks to @jacob, @armin, @GrahamDumpleton and @benbangert and others. They
promote web2py!

After that:

@jacob decide to escape from threads (leaving unanswered questions)
http://twitter.com/#!/jacobian/status/23138026796355584

@Mike slept upset
http://twitter.com/#!/zzzeek/status/23160805851668480

http://twitter.com/#!/zzzeek/status/22788155665031168

and @armin still wants to propose a PEP which tends to remove the execfile()
statement from Python2.x language. LOL
http://twitter.com/#!/mitsuhiko/status/23082854590185472

http://twitter.com/#!/mitsuhiko/status/23089568890753025


I love this community... :)

Please: Don't call me Pythonic I never wrote a PEP.. LOL

http://twitter.com/#!/jacobian/status/23138026796355584--
Bruno Rocha
http://about.me/rochacbruno/bio


Re: [web2py] Re: web2py-related thread at reddit

2011-01-07 Thread Albert Abril
It remains me that django conference where they make joke about the girl who
wants the pony:
http://www.linuxformat.com/files/nopony.jpg

disclaimer: i love django too, but they have respect all the ways of doing
things.

On Fri, Jan 7, 2011 at 4:20 PM, Anthony abasta...@gmail.com wrote:

 On Friday, January 7, 2011 2:58:14 AM UTC-5, cjrh wrote:

 On Jan 7, 12:06 am, Anthony abas...@gmail.com wrote:
  In case anyone is interested...
 
  http://www.reddit.com/r/Python/comments/ex54j/seeking_clarification_o...


 Massimo should just stop caring.   The reddit people have already
 heard the sales pitch, and further energy spent on trying to convince
 them is wasted.


 You're right, it's not worth spending energy to try to convince these
 particular individuals -- they've all got vested interests (personal or
 professional) in alternatives. However, lots of disinterested folks are also
 reading those reddit threads, so sometimes it's worth correcting the record
 just so web2py is not publicly defined solely by its detractors. I was
 reading these kinds of discussions a few months back when I was researching
 web frameworks, and if it hadn't been for Massimo correcting some false
 claims of others, I might have been scared off of web2py.

 Anthony



Re: [web2py] Re: web2py-related thread at reddit

2011-01-07 Thread Albert Abril
they **should** have

On Fri, Jan 7, 2011 at 4:51 PM, Albert Abril albert.ab...@gmail.com wrote:

 It remains me that django conference where they make joke about the girl
 who wants the pony:
 http://www.linuxformat.com/files/nopony.jpg

 disclaimer: i love django too, but they have respect all the ways of doing
 things.


 On Fri, Jan 7, 2011 at 4:20 PM, Anthony abasta...@gmail.com wrote:

 On Friday, January 7, 2011 2:58:14 AM UTC-5, cjrh wrote:

 On Jan 7, 12:06 am, Anthony abas...@gmail.com wrote:
  In case anyone is interested...
 
  http://www.reddit.com/r/Python/comments/ex54j/seeking_clarification_o...


 Massimo should just stop caring.   The reddit people have already
 heard the sales pitch, and further energy spent on trying to convince
 them is wasted.


 You're right, it's not worth spending energy to try to convince these
 particular individuals -- they've all got vested interests (personal or
 professional) in alternatives. However, lots of disinterested folks are also
 reading those reddit threads, so sometimes it's worth correcting the record
 just so web2py is not publicly defined solely by its detractors. I was
 reading these kinds of discussions a few months back when I was researching
 web frameworks, and if it hadn't been for Massimo correcting some false
 claims of others, I might have been scared off of web2py.

 Anthony





[web2py] Re: ADVOCACY: every single other Python program ever written uses imports?

2011-01-07 Thread Luther Goh Lu Feng
Gosh I am glad I can share about web2py in with my country's php,
django and rails programmers without all this nonsense.

On Jan 7, 11:40 pm, Bruno Rocha rochacbr...@gmail.com wrote:
 After being offended by web2py being in Pycon, they made a major
 attack on reddit, raised a bunch of lies. Alarmed against web2py on
 twitter (they managed to enter to the top tweets) and
 this created a certain discomfort.

 Some of my clients (two of them) called me asking for explanations about it.
 (Interestingly, after my explanation they seem much more confident)

 Moreover two new possible new clients came to me today (one by
 experts4solutions), one of them commented about the topic and the tweets, so
 it awakened interest to evaluate web2py to a new small project.

 A company that offers online training came to me asking me to submit a
 web2py training to their program,  they think web2py is trendy and many
 people are talking about it on the web, then it is a good
 time to offer training.

 thanks to @jacob, @armin, @GrahamDumpleton and @benbangert and others. They
 promote web2py!

 After that:

 @jacob decide to escape from threads (leaving unanswered 
 questions)http://twitter.com/#!/jacobian/status/23138026796355584

 @Mike slept upsethttp://twitter.com/#!/zzzeek/status/23160805851668480

 http://twitter.com/#!/zzzeek/status/22788155665031168

 and @armin still wants to propose a PEP which tends to remove the execfile()
 statement from Python2.x language. 
 LOLhttp://twitter.com/#!/mitsuhiko/status/23082854590185472

 http://twitter.com/#!/mitsuhiko/status/23089568890753025

 I love this community... :)

 Please: Don't call me Pythonic I never wrote a PEP.. LOL

 http://twitter.com/#!/jacobian/status/23138026796355584--
 Bruno Rochahttp://about.me/rochacbruno/bio


[web2py] Re: Drupal alternatives in Python or web2py

2011-01-07 Thread Luther Goh Lu Feng


On Jan 7, 6:37 pm, cjrh caleb.hatti...@gmail.com wrote:
 On Jan 7, 10:27 am, VP vtp2...@gmail.com wrote:

  But as you go deeper, trying to add features, it will be so
  difficult.  Just to make the app looks right to your taste is really a
  challenging job.

 Ok, interesting.

So quick question, is this challenge particular to the nature of CMS-
es like drupal, or just drupal specific?


Re: [web2py] Re: Drupal alternatives in Python or web2py

2011-01-07 Thread Jonathan Lundell
On Jan 7, 2011, at 8:40 AM, Luther Goh Lu Feng wrote:
 
 On Jan 7, 6:37 pm, cjrh caleb.hatti...@gmail.com wrote:
 On Jan 7, 10:27 am, VP vtp2...@gmail.com wrote:
 
 But as you go deeper, trying to add features, it will be so
 difficult.  Just to make the app looks right to your taste is really a
 challenging job.
 
 Ok, interesting.
 
 So quick question, is this challenge particular to the nature of CMS-
 es like drupal, or just drupal specific?

I'd say it's pretty much true of the major CMS's out there (it's certainly true 
of Expression Engine), but it may not be because of the nature of CMS's 
generally. I think it might be possible to write a good one. Difficult, though, 
especially at the definition/architecture stage. It's too easy to leave 
necessary functionality out, and too easy to screw things up by patching it in 
later.



[web2py] Re: Drupal alternatives in Python or web2py

2011-01-07 Thread Luther Goh Lu Feng


On Jan 8, 12:48 am, Jonathan Lundell jlund...@pobox.com wrote:
 On Jan 7, 2011, at 8:40 AM, Luther Goh Lu Feng wrote:



  On Jan 7, 6:37 pm, cjrh caleb.hatti...@gmail.com wrote:
  On Jan 7, 10:27 am, VP vtp2...@gmail.com wrote:

  But as you go deeper, trying to add features, it will be so
  difficult.  Just to make the app looks right to your taste is really a
  challenging job.

  Ok, interesting.

  So quick question, is this challenge particular to the nature of CMS-
  es like drupal, or just drupal specific?

 I'd say it's pretty much true of the major CMS's out there (it's certainly 
 true of Expression Engine), but it may not be because of the nature of CMS's 
 generally. I think it might be possible to write a good one. Difficult, 
 though, especially at the definition/architecture stage. It's too easy to 
 leave necessary functionality out, and too easy to screw things up by 
 patching it in later.

Looking at web2py, we already have an IDE, a wizard, and a plugin
wiki. Might be the beginnings of a drupal-like CMS for this year's
web2py exhibition.


[web2py] Re: Drupal alternatives in Python or web2py

2011-01-07 Thread VP
In essence, a CMS is not really a framework.  Just like a forum
software, or a blog software is not a CMS.  I think unless VBulletin
or Wordpress drastic changes their structure, they will not be as
capable as Drupal, as a CMS.

A CMS is a platform to build systems that manage content.  It happens
to be the the core of most web app are about managing contents.  This
is why Drupal is very popular and powerful.   But as you add features
on top of your apps that have little to do with the management of
content, you will find it difficult in Drupal.

A framework is more general.  With web2py (or perhaps other
frameworks) you can relatively easily build something like a Stock
Exchange App.  With Drupal, you probably can too, but it will be more
difficult, and you'll have to piggy back lots of unnecessary things
that have to do with CMS.

Drupal is very nice at what it is.  But because of that I think it's
very dangerous.  Most web apps have some form of management of
content.   This makes it very tempting to quickly adopt something like
Drupal.  But as you add on top of that core behavior other things, it
will bite you in the butt.   But for 80% of web apps, Drupal does very
well.






On Jan 7, 10:48 am, Jonathan Lundell jlund...@pobox.com wrote:
 On Jan 7, 2011, at 8:40 AM, Luther Goh Lu Feng wrote:



  On Jan 7, 6:37 pm, cjrh caleb.hatti...@gmail.com wrote:
  On Jan 7, 10:27 am, VP vtp2...@gmail.com wrote:

  But as you go deeper, trying to add features, it will be so
  difficult.  Just to make the app looks right to your taste is really a
  challenging job.

  Ok, interesting.

  So quick question, is this challenge particular to the nature of CMS-
  es like drupal, or just drupal specific?

 I'd say it's pretty much true of the major CMS's out there (it's certainly 
 true of Expression Engine), but it may not be because of the nature of CMS's 
 generally. I think it might be possible to write a good one. Difficult, 
 though, especially at the definition/architecture stage. It's too easy to 
 leave necessary functionality out, and too easy to screw things up by 
 patching it in later.


Re: [web2py] Re: new URL router release candidate

2011-01-07 Thread Jonathan Lundell
On Jan 7, 2011, at 12:34 AM, VP wrote:
 
 sorry that was copypaste mistake.  Here it is:

Thanks. What's your routes.conf?

 
 
 try: config=open('routes.conf','r').read()
 except: config=''
 
 def auto_in(apps):
routes=[
('/robots.txt','/welcome/static/robots.txt'),
('/admin$anything','/admin$anything'),
]
for a,b in [x.strip().split() for x in apps.split('\n') if
 x.strip() and not x.strip().startswith('#')]:
if not b.startswith('/'): b='/'+b
if b.endswith('/'): b=b[:-1]
app = b.split('/')[1]
routes+=[
('.*:https?://(www\.)?%s:$method /' % a,'%s' % b),
('.*:https?://(www\.)?%s:$method /$anything' % a,'%s/
 $anything' % b),
('.*:https?://(.*\.)?%s:$method /static/$anything' % a,'%s/
 static/$anything' % app),
('.*:https?://(.*\.)?%s:$method /appadmin/$anything' %
 a,'%s/appadmin/$anything' % app),
]
return routes
 
 def auto_out(apps):
routes=[]
for a,b in [x.strip().split() for x in apps.split('\n') if
 x.strip() and not x.strip().startswith('#')]:
if not b.startswith('/'): b='/'+b
if b.endswith('/'): b=b[:-1]
app = b.split('/')[1]
routes+=[
('%s/static/$anything' % app,'/static/$anything'),
('%s/appadmin/$anything' % app, '/appadmin/$anything'),
('%s/$anything' % b, '/$anything'),
]
return routes
 
 routes_in=auto_in(config)
 routes_out=auto_out(config)




[web2py] Re: Drupal alternatives in Python or web2py

2011-01-07 Thread Luther Goh Lu Feng
Tks for your opinions.

So I take it that it may not be worthwhile to consider building a
drupal-like CMS off web2py for non-programmers?

On Jan 8, 1:11 am, VP vtp2...@gmail.com wrote:
 In essence, a CMS is not really a framework.  Just like a forum
 software, or a blog software is not a CMS.  I think unless VBulletin
 or Wordpress drastic changes their structure, they will not be as
 capable as Drupal, as a CMS.

 A CMS is a platform to build systems that manage content.  It happens
 to be the the core of most web app are about managing contents.  This
 is why Drupal is very popular and powerful.   But as you add features
 on top of your apps that have little to do with the management of
 content, you will find it difficult in Drupal.

 A framework is more general.  With web2py (or perhaps other
 frameworks) you can relatively easily build something like a Stock
 Exchange App.  With Drupal, you probably can too, but it will be more
 difficult, and you'll have to piggy back lots of unnecessary things
 that have to do with CMS.

 Drupal is very nice at what it is.  But because of that I think it's
 very dangerous.  Most web apps have some form of management of
 content.   This makes it very tempting to quickly adopt something like
 Drupal.  But as you add on top of that core behavior other things, it
 will bite you in the butt.   But for 80% of web apps, Drupal does very
 well.

 On Jan 7, 10:48 am, Jonathan Lundell jlund...@pobox.com wrote:







  On Jan 7, 2011, at 8:40 AM, Luther Goh Lu Feng wrote:

   On Jan 7, 6:37 pm, cjrh caleb.hatti...@gmail.com wrote:
   On Jan 7, 10:27 am, VP vtp2...@gmail.com wrote:

   But as you go deeper, trying to add features, it will be so
   difficult.  Just to make the app looks right to your taste is really a
   challenging job.

   Ok, interesting.

   So quick question, is this challenge particular to the nature of CMS-
   es like drupal, or just drupal specific?

  I'd say it's pretty much true of the major CMS's out there (it's certainly 
  true of Expression Engine), but it may not be because of the nature of 
  CMS's generally. I think it might be possible to write a good one. 
  Difficult, though, especially at the definition/architecture stage. It's 
  too easy to leave necessary functionality out, and too easy to screw things 
  up by patching it in later.


[web2py] Re: patch for URL() in meta-menu (plugin_wiki)

2011-01-07 Thread blackthorne
ok, after some work, here's the patch.
Massimo, I tried to follow your way, hope you like it.
The code is made in non strict way, so it shouldn't break at the first
non valid input.

URL() in meta-menu plugin_wiki patch:
http://www.speedyshare.com/files/26117790/url-in-meta-menu_plugin_wiki.patch

Best regards

On Jan 5, 1:53 pm, Jonathan Lundell jlund...@pobox.com wrote:
 On Jan 5, 2011, at 2:25 AM, blackthorne wrote:



  ok

  What about the menu option /Computer /option, wouldn it be caught by
  the same regex currently used?

 I haven't been following this thread too closely, but all this stuff should 
 be fine in vars. Question marks, slashes, spaces--all ought to be escaped. 
 The only problem, IIRC, is '+', since I believe that quote-plus is being used 
 for vars.

 If the regex doesn't handle it right, the new router will (or I'll fix it).





  On Jan 5, 1:07 am, mdipierro mdipie...@cs.depaul.edu wrote:
  No it would not because ? is not allowed in args.

  On Jan 4, 5:58 pm, blackthorne francisco@gmail.com wrote:

  there I'm just giving you counter-examples that may break that
  notation.
  On your second question, the / on the right of = would be an argument
  'a' with '/Computer /option' just without quotes as they are optional.
  Making a regular expression for that seems very hard, a real parser
  would be required.

  My point is that those rules even if well implemented, can fail in
  predictable ways.

  So, should I go ahead for it or reconsider other options such as my
  suggestion based on newlines?

  On Jan 4, 10:20 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  I do not understand the notation you propose. Are you suggesting a= to
  specify args? Why the / on the right of =?

  On Jan 4, 3:55 pm, blackthorne francisco@gmail.com wrote:

  what if?
    menu item             path               possible arg
  /Computer_option     /path/function?a=/Computer /option
  /Computer /option     /path/function?a='/Computer /option'
  /Computer_option       page:computer

  I'm complicating, I know but I'm sure that could find more realistic
  examples to fit these real possibilities.

  On Jan 4, 9:39 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  I mean

  page_name /controller/action/arg1/arg2?a='Hello Computer'b=5
  page_name /controller/action/arg1/arg2?a=Hello+Computerb=5

  Should be equivalent. So the code should:
  0) If path starts with /
  1) use regex to find '(?Px.*(?!))' and replace with
  urllib.quote(math.group('x'))
  2) break the URL into controller, action, everything-else
  3) rebuild the url using URL(..) (in case routes is being used)

  Not too easy but should do it.

  On Jan 4, 3:33 pm, blackthorne francisco@gmail.com wrote:

  sure, I'm just not sure what you mean with optional quotes.

  e.g.:
  page_name /controller/action/arg1/arg2?a='Welcome page2'
  /Computers /controller/action/arg1/arg2?a=Hello Computer

  should become:
  page_name - /controller/action/arg1/arg2?a='Welcome page2'
  /Computers - /controller/action/arg1/arg2?a='Hello Computer'

  like this?

  On Jan 4, 5:47 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  I think we can go this way:

      page_name /controller/action/arg1/arg2?a='Welcome page2'

  but I would make so that the quotes optional (if provided content 
  will
  be replaced by urllib.quote(content).

  Would you send me a revised patch?

  On Jan 4, 11:21 am, blackthorne francisco@gmail.com wrote:

  Well, I see your view.

  In some cases, you can just use %20 instead of white space but not 
  if
  that is part of the argument.
  example:http://prernalal.com/banned%20books/==http://prernalal.com/banned
  books/ - validhttp://example.com/?page=banned%20books; 
  !=http://example.com/?page=banned
  books - not valid

  I think this character separation (white space) for meta-menu is way
  too common. It's likely that the limitations won't stick with my
  examples. An option to define it manually would solve it for all
  cases, even if not by convention.

  Aanother idea would be using newlines. One for different parts, two
  for different options, e.g:
  page_name
  /controller/action/arg1/arg2?a='Welcome page'

  page_name2
  page_name /controller/action/arg1/arg2?a='Welcome page2'

  This way it's clean, almost fail-proof and leaves you room to add
  things with an arbitrary number of arguments/parts.

  On the other hand, your latest suggestion doesn't require any 
  change,
  which is a plus.

  On Jan 4, 4:59 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  This is a big can of worms... Do we really need to pass vars?

  On Jan 4, 10:45 am, blackthorne francisco@gmail.com wrote:

  sorry, I was considering on using the same code to the wiki pages 
  in
  the markmin syntax so that you could also make this kind of links 
  in
  wiki pages.
  [[namehttp://example.com, args=[], vars={}]]

  Other thing, you might want to consider...
  check your example
  page_name /controller/action/arg1/arg2?a=b

  instead 

Re: [web2py] Re: Drupal alternatives in Python or web2py

2011-01-07 Thread Jonathan Lundell
On Jan 7, 2011, at 9:00 AM, Luther Goh Lu Feng wrote:
 
 Looking at web2py, we already have an IDE, a wizard, and a plugin
 wiki. Might be the beginnings of a drupal-like CMS for this year's
 web2py exhibition.

I'd like to see a good CMS based on web2py (the analogy isn't exact, but sort 
of like Plone is based on Zope). However, building a good CMS on web2py is at 
least as much work as building web2py in the first place (order of magnitude, 
anyway). I don't believe that you can cobble together a good CMS like that.



Re: [web2py] Re: patch for URL() in meta-menu (plugin_wiki)

2011-01-07 Thread Jonathan Lundell
On Jan 7, 2011, at 9:26 AM, blackthorne wrote:
 
 ok, after some work, here's the patch.
 Massimo, I tried to follow your way, hope you like it.
 The code is made in non strict way, so it shouldn't break at the first
 non valid input.
 
 URL() in meta-menu plugin_wiki patch:
 http://www.speedyshare.com/files/26117790/url-in-meta-menu_plugin_wiki.patch

FWIW, in the first line of the patch:

+elif url.lower().startswith('/'):

...the lower() call is a nop.

[web2py] Re: patch for URL() in meta-menu (plugin_wiki)

2011-01-07 Thread blackthorne
thanks, that must have been the only line of code I haven't really
thought about

On Jan 7, 5:36 pm, Jonathan Lundell jlund...@pobox.com wrote:
 On Jan 7, 2011, at 9:26 AM, blackthorne wrote:



  ok, after some work, here's the patch.
  Massimo, I tried to follow your way, hope you like it.
  The code is made in non strict way, so it shouldn't break at the first
  non valid input.

  URL() in meta-menu plugin_wiki patch:
 http://www.speedyshare.com/files/26117790/url-in-meta-menu_plugin_wik...

 FWIW, in the first line of the patch:

 +                elif url.lower().startswith('/'):

 ...the lower() call is a nop.


[web2py] Re: ADVOCACY: every single other Python program ever written uses imports?

2011-01-07 Thread Philip
 These guys seem to have no clue about the increasingly
 pervasive nature of computing in society today.  There are many very
 smart and intelligent beginners who know little about web frameworks
 or even Python.  They simply look for tools to develop their ideas.
 In fact, you see many scientists and researchers who write programs
 and develop webapps (in particular).  My thinking is in the short
 future many more (smart) people who will be writing programs,
 naturally.  They will look for tools that in the easiest manner
 facilitate the creation of what they want to do.

I just want to second this point.  I fit this description.  I'm a
business guy, and no part of my job description would mention setting
up databases or writing software, but often software is a way to
increase efficiency dramatically, even if it's just a VB script in
Excel to automate some repetitive or complex task. I recognized that
my team would benefit a lot if we had a gold copy of certain data in a
database accessible to everyone (with normal CRUD features and some
canned ways of presenting it).  In the past, I would have thrown
together a MS Access DB, but I realized that a web-based app would be
far better, and that the web frameworks out there would make that
equally as easy to put together.  I took some CS classes in college
(15 years ago) and wrote a decent amount of code back then (Fortran,
Lisp, C) but had never used Python nor had I ever done any web-related
development (heck, I even had to brush up on HTML!) before deciding to
set this up.
After looking around at frameworks (with the most time spent on Django
including some initial app prototyping), I chose web2py.  It was a no-
brainer, because it was very easy to get started with, and yet as far
as I can tell, there is nothing that I cannot do in web2py that I
could do, or could do easier, in any other framework. I taught myself
Python to use web2py, and I put together an app that we now use in
production in our firm.  It was a nights and weekends project, and it
took longer than it should have because of my inexperience, but in the
grand scheme of things it took very little effort relative to the
value it created.

Web2py is to me the next generation of MS Access, and I mean that as a
compliment.  MS Access first opened up the world of database-driven
applications to business people.  With Access they could throw
together a simple application to manage a database (CRUD and reports)
without having to hire a developer or wait on their IT staff to write
one.  Web2py does the same thing.  It is easy enough for a business
user to throw something together very quickly and be up and running
immediately.  The amount of development expertise required is
trivial.  For a basic app, if you read the web2py book, you don't even
have to understand more than the very basics of python.

For really, big complex apps, there may be some reason that Django is
preferable - I'll leave that to the professional web developers to
figure out the tools they need - but I can't say enough about how
great my experience has been with web2py, as a non-developer looking
for the tools that in the easiest manner facilitate the creation of
what I want to do (to use your words).  I just needed to get stuff
done, and web2py worked.



[web2py] Re: need help with db table

2011-01-07 Thread pk
no help???

On 6 Jan., 17:38, pk peter.kirch...@youngdesigners.de wrote:
 or just better:
 how can i avoid this with the selection box: IS_IN_DB()?
 because i will also not that friends.hauptperson == friends.freund

 i need help very badly...
 thanks

 On 6 Jan., 17:24, pk peter.kirch...@youngdesigners.de wrote:







  this combination should not be more than one time in the db table:
  nueva_vido      makir

  but i still get this with:

  friends.id      friends.userid  friends.hauptperson
  friends.freund
  friends.freundseit      friends.bestaetigt
  9       5       nueva_vido      makir   2011-01-04 18:09:46     False
  11      5       nueva_vido      makir   2011-01-05 23:47:54     False

  db.friends.freund.requires =
  IS_NOT_IN_DB(db(db.friends.hauptperson==request.vars.hauptperson),db.friend
  s.freund)

  On 6 Jan., 15:16, pk peter.kirch...@youngdesigners.de wrote:

   no i tested it now with a clear table, but i can still add the same
   values

   On 6 Jan., 14:51, DenesL denes1...@yahoo.ca wrote:

It works for me.
Maybe you had those values in the DB.

On Jan 5, 5:51 pm, pk peter.kirch...@youngdesigners.de wrote:

 hi thanks for your help but i still get this:

 friends.id      friends.userid  friends.hauptperson     friends.freund
 friends.freundseit      friends.bestaetigt
 9       5       nueva_vido      makir   2011-01-04 18:09:46     False
 11      5       nueva_vido      makir   2011-01-05 23:47:54     False

 with: db.friends.freund.requires =
 IS_NOT_IN_DB(db(db.friends.hauptperson==request.vars.hauptperson),db.friend
  s.freund)

 and how can i say:
 db.friends.freund.requires=IS_IN_DB(db,'auth_user.user_name') without
 the self user name???

 thanks so much.
 peter

 On 5 Jan., 21:05, DenesL denes1...@yahoo.ca wrote:

  If you want the combination of two fields a,b from table t to be
  unique then use:

  db.t.b.requires = IS_NOT_IN_DB(db(db.t.a==request.vars.a),db.t.b)


[web2py] Re: new URL router release candidate

2011-01-07 Thread VP
It is something like this:

example1.com   /app1/default
example2.com   /app2/default
example3.com   /app3/default


On Jan 7, 11:17 am, Jonathan Lundell jlund...@pobox.com wrote:
 On Jan 7, 2011, at 12:34 AM, VP wrote:



  sorry that was copypaste mistake.  Here it is:

 Thanks. What's your routes.conf?



  try: config=open('routes.conf','r').read()
  except: config=''

  def auto_in(apps):
     routes=[
         ('/robots.txt','/welcome/static/robots.txt'),
         ('/admin$anything','/admin$anything'),
         ]
     for a,b in [x.strip().split() for x in apps.split('\n') if
  x.strip() and not x.strip().startswith('#')]:
         if not b.startswith('/'): b='/'+b
         if b.endswith('/'): b=b[:-1]
         app = b.split('/')[1]
         routes+=[
             ('.*:https?://(www\.)?%s:$method /' % a,'%s' % b),
             ('.*:https?://(www\.)?%s:$method /$anything' % a,'%s/
  $anything' % b),
             ('.*:https?://(.*\.)?%s:$method /static/$anything' % a,'%s/
  static/$anything' % app),
             ('.*:https?://(.*\.)?%s:$method /appadmin/$anything' %
  a,'%s/appadmin/$anything' % app),
             ]
     return routes

  def auto_out(apps):
     routes=[]
     for a,b in [x.strip().split() for x in apps.split('\n') if
  x.strip() and not x.strip().startswith('#')]:
         if not b.startswith('/'): b='/'+b
         if b.endswith('/'): b=b[:-1]
         app = b.split('/')[1]
         routes+=[
             ('%s/static/$anything' % app,'/static/$anything'),
             ('%s/appadmin/$anything' % app, '/appadmin/$anything'),
             ('%s/$anything' % b, '/$anything'),
             ]
     return routes

  routes_in=auto_in(config)
  routes_out=auto_out(config)




[web2py] web2py book

2011-01-07 Thread puercoespin
Is there an errata file of the printed book? Because Lulu's book has
many errors, and I have to be in comparison to the online version of
it.

 I also think it would be interesting that users can add comments in
the book, and that anyone can also display, as is for example in the
postgresql manual. To this end, the online version should be more
structured and divided, so that comments can be made in sections, not
whole chapters.

In my opinion, a great book (not good, but great) is very important
for the prestige of web2py framework and for more people to
incorporate it as part of their technical background.


Re: [web2py] Re: new URL router release candidate

2011-01-07 Thread Jonathan Lundell
On Jan 7, 2011, at 12:14 PM, VP wrote:
 
 It is something like this:
 
 example1.com   /app1/default
 example2.com   /app2/default
 example3.com   /app3/default

In that case:

routers = dict(
app1 = dict(domain='example1.com'),
app2 = dict(domain='example2.com'),
app3 = dict(domain='example3.com'),
)



 
 
 On Jan 7, 11:17 am, Jonathan Lundell jlund...@pobox.com wrote:
 On Jan 7, 2011, at 12:34 AM, VP wrote:
 
 
 
 sorry that was copypaste mistake.  Here it is:
 
 Thanks. What's your routes.conf?
 
 
 
 try: config=open('routes.conf','r').read()
 except: config=''
 
 def auto_in(apps):
routes=[
('/robots.txt','/welcome/static/robots.txt'),
('/admin$anything','/admin$anything'),
]
for a,b in [x.strip().split() for x in apps.split('\n') if
 x.strip() and not x.strip().startswith('#')]:
if not b.startswith('/'): b='/'+b
if b.endswith('/'): b=b[:-1]
app = b.split('/')[1]
routes+=[
('.*:https?://(www\.)?%s:$method /' % a,'%s' % b),
('.*:https?://(www\.)?%s:$method /$anything' % a,'%s/
 $anything' % b),
('.*:https?://(.*\.)?%s:$method /static/$anything' % a,'%s/
 static/$anything' % app),
('.*:https?://(.*\.)?%s:$method /appadmin/$anything' %
 a,'%s/appadmin/$anything' % app),
]
return routes
 
 def auto_out(apps):
routes=[]
for a,b in [x.strip().split() for x in apps.split('\n') if
 x.strip() and not x.strip().startswith('#')]:
if not b.startswith('/'): b='/'+b
if b.endswith('/'): b=b[:-1]
app = b.split('/')[1]
routes+=[
('%s/static/$anything' % app,'/static/$anything'),
('%s/appadmin/$anything' % app, '/appadmin/$anything'),
('%s/$anything' % b, '/$anything'),
]
return routes
 
 routes_in=auto_in(config)
 routes_out=auto_out(config)
 
 




Re: [web2py] Re: new URL router release candidate

2011-01-07 Thread Jonathan Lundell
On Jan 7, 2011, at 12:25 PM, Jonathan Lundell wrote:
 
 On Jan 7, 2011, at 12:14 PM, VP wrote:
 
 It is something like this:
 
 example1.com   /app1/default
 example2.com   /app2/default
 example3.com   /app3/default
 
 In that case:
 
 routers = dict(
app1 = dict(domain='example1.com'),
app2 = dict(domain='example2.com'),
app3 = dict(domain='example3.com'),
 )

By way of a little more explanation: 'default' doesn't appear because 'default' 
is already the default controller. There's a router named BASE for overrides 
that apply to all apps, but it's left out here because it's empty. The defaults 
are shown in router.example.py.



[web2py] Re: web2py-related thread at reddit

2011-01-07 Thread Stefaan Himpe

first they laugh at you then they fight you then you win
(Mohandas Karamchand Gandhi)

Best regards,
Stefaan.





[web2py] Re: Drupal alternatives in Python or web2py

2011-01-07 Thread pbreit
I think it would definitely be worthwhile for there to be a decent 
Web2py-based CMS. But it doesn't need to be as extensive and complicated as 
Drupal. Keep it simple.

Re: [web2py] Re: ADVOCACY: every single other Python program ever written uses imports?

2011-01-07 Thread Philip Kilner

Hi Philip,

On 07/01/11 18:17, Philip wrote:

Web2py is to me the next generation of MS Access, and I mean that as a
compliment.  MS Access first opened up the world of database-driven
applications to business people.  With Access they could throw
together a simple application to manage a database (CRUD and reports)
without having to hire a developer or wait on their IT staff to write
one.  Web2py does the same thing.  It is easy enough for a business
user to throw something together very quickly and be up and running
immediately.  The amount of development expertise required is
trivial.  For a basic app, if you read the web2py book, you don't even
have to understand more than the very basics of python.



+1

I'm  database developer (going back to DataEase for DOS and FoxPro, and 
the IBM S/26) in need of a data-driven front end, and I see web2py as 
the perfect tool for me. I have no desire to tinker /inside/ web2py - I 
just want to use it to develop apps.


Rather than competing with Django /et al/, which are defined as much by 
a culture as the technology, I'd like to see some advocacy to promote 
web2py to people who simply aren't in a position to use Django, but who 
can get up to speed with web2py very easily.


The comment earlier about Massimo's approach being informed by his 
teaching experience seemed very sharp to me.



For really, big complex apps, there may be some reason that Django is
preferable - I'll leave that to the professional web developers to
figure out the tools they need - but I can't say enough about how
great my experience has been with web2py, as a non-developer looking
for the tools that in the easiest manner facilitate the creation of
what I want to do (to use your words).  I just needed to get stuff
done, and web2py worked.



Just so.

--

Cheers,

PhilK


Re: [web2py] Re: [OT] Drupal alternatives in Python or web2py

2011-01-07 Thread Martín Mulone
Don't compare instantpress with another big cms, I developed instant press
in 3 month myself, plus learning web2py. How much develop and programmers
have wordpress? :P. I started to learn web2py and what can I do with the
framework. Yes is need it a lot of time to make it instantpress big.

I2p is a CMS, with little minimal modification, you can have it. Take a look
to http://www.hospedajelacima.com.ar is made it with instant press and is
not a blog. A very simple site that fit very well with i2p objective.

I planned some modification to the next version of i2p, that is going to
make it more like a CMS. I am going to integrate more with web2py theme also
the next version will have the admin separated of the i2p layout, plus
hierarchy to articles.

2011/1/7 Luther Goh Lu Feng elf...@yahoo.com

 I see. I did hear about InstantPress, but was under the impression
 that it is simply meant to be a blog because the similar name to
 Wordpress.

 Will look into it. Tks.

 On Jan 7, 10:19 am, rochacbruno rochacbr...@gmail.com wrote:
  I just can see Instant Press as alternative to cms and blog.
 
  There are toomuch work to do in InstantPress and I am sure Martin are
 open to contributions.
 
  Just need to gather some people and start using, testing and extending
 it.
 
  I hope to contribute more to instant press as I get more free time.
 
  This is IMO the best open source ready to use w2p app we had and it needs
 more people working on it.
 
  Btw I am testing Pymantis which seems to be very interesting.
 
  Enviado via iPhone
 
  Em 06/01/2011, às 23:21, Luther Goh Lu Feng elf...@yahoo.com escreveu:
 
 
 
 
 
 
 
   Even though it is in php, with the release of Drupal 7, I am tempted
   to give it a spin just to see what's the fuss all about. Drupal seems
   extremely popular, looking at some of the well known organisations
   that have used it. But are there any python, or hopefully, web2py
   alternatives to it?




-- 
My blog: http://martin.tecnodoc.com.ar
My portfolio *spanish*: http://www.tecnodoc.com.ar
Checkout my last proyect instant-press: http://www.instant2press.com
Expert4Solution Profile:
http://www.experts4solutions.com/e4s/default/expert/6


Re: [web2py] Re: Drupal alternatives in Python or web2py

2011-01-07 Thread Philip Kilner

Hi Jonathan,

On 07/01/11 17:28, Jonathan Lundell wrote:

I'd like to see a good CMS based on web2py (the analogy isn't exact, but sort 
of like Plone is based on Zope). However, building a good CMS on web2py is at 
least as much work as building web2py in the first place (order of magnitude, 
anyway). I don't believe that you can cobble together a good CMS like that.



I'd ideally like to see an all web2py solution too, but I agree that 
it's a big task, which I suspect some underestimate.


As a long-time Plone user (specifically, integrating RDBMS applications 
with Plone CMSs), I'm actually very happy using Plone as a CMS and 
web2py for RDBMS apps, and integrating the two where I need to.


There is another issue, which is dilution - Plone has somewhat 
eclipsed Zope, and there is debate on and off about whether Plone is a 
CMS application or a framework, while Zope is now sometimes described as 
a CMS. I think that confusion has had a cost for both Zope and Plone.


My hope is that: -

- Web2py keeps focussing on being an excellent framework.

- If someone develops a heavyweight CMS in web2py, which would be good, 
it does not get confused with web2py itself.


FWIW, I'm hoping to start publishing my web2py notes later this month, 
and have been a little bit concerned that I might get a negative 
reaction to their being in a Plone CMS. I'm going to stop worrying about 
that - I've picked the best framework for my work in web2py, and the 
best CMS for me to document it in Plone.


--

Cheers,

PhilK


Re: [web2py] Re: ADVOCACY: every single other Python program ever written uses imports?

2011-01-07 Thread Michele Comitini
I think the most misunderstood fact with web2py is that web2py
implementation is improving every day,
because of TOP-DOWN approach choosen by Massimo.
What does that mean? If someone finds that something has big impact
on perfomace, web2py gets changed to better and the users can upgrade
safely, because
the external simple API of the framework does not change.
So critics are welcome, the more the better.

exec ccode in  is not injection? It is IoC for sure.
http://en.wikipedia.org/wiki/Inversion_of_control

 where is it deprecated? I cannot read it.
http://docs.python.org/reference/simple_stmts.html#the-exec-statement


remove exec ... in ... from python? On what basis? if you want a
static language go out of python. I wonder what GVR thinks about that.

The only good reasons at the moment to change that are:
1) exec statement bug
2) drastic performance improvement

Neither is true AFAIK, but maybe web2py's IoC will change, for testing
and debugging purposes, this is free (not as a beer) software indeed,
so a  new solution would be adopted if one comes with a better one
instead of talking about plain aesthetics, which is a good thing
although it is not alway viable in this world.  But if that would
happen fear not, we won't notice, we will not have to change our code.

mic/mcm

2011/1/7 Philip Kilner phil.kil...@gmail.com:
 Hi Philip,

 On 07/01/11 18:17, Philip wrote:

 Web2py is to me the next generation of MS Access, and I mean that as a
 compliment.  MS Access first opened up the world of database-driven
 applications to business people.  With Access they could throw
 together a simple application to manage a database (CRUD and reports)
 without having to hire a developer or wait on their IT staff to write
 one.  Web2py does the same thing.  It is easy enough for a business
 user to throw something together very quickly and be up and running
 immediately.  The amount of development expertise required is
 trivial.  For a basic app, if you read the web2py book, you don't even
 have to understand more than the very basics of python.


 +1

 I'm  database developer (going back to DataEase for DOS and FoxPro, and the
 IBM S/26) in need of a data-driven front end, and I see web2py as the
 perfect tool for me. I have no desire to tinker /inside/ web2py - I just
 want to use it to develop apps.

 Rather than competing with Django /et al/, which are defined as much by a
 culture as the technology, I'd like to see some advocacy to promote web2py
 to people who simply aren't in a position to use Django, but who can get up
 to speed with web2py very easily.

 The comment earlier about Massimo's approach being informed by his teaching
 experience seemed very sharp to me.

 For really, big complex apps, there may be some reason that Django is
 preferable - I'll leave that to the professional web developers to
 figure out the tools they need - but I can't say enough about how
 great my experience has been with web2py, as a non-developer looking
 for the tools that in the easiest manner facilitate the creation of
 what I want to do (to use your words).  I just needed to get stuff
 done, and web2py worked.


 Just so.

 --

 Cheers,

 PhilK



[web2py] Re: web2py-related thread at reddit

2011-01-07 Thread Stefaan Himpe

Kuba Kucharski wrote:

On Fri, Jan 7, 2011 at 9:43 PM, Stefaan Himpestefaan.hi...@gmail.com  wrote:

first they laugh at you then they fight you then you win

http://www.mail-archive.com/web2py@googlegroups.com/msg32314.html



Your link didn't work for me, but I assume this points to the same:
http://www.mail-archive.com/web2py@googlegroups.com/msg32314.html

Wise words :)



[web2py] Re: web2py-related thread at reddit

2011-01-07 Thread Stefaan Himpe

first they laugh at you then they fight you then you win

http://www.mail-archive.com/web2py@googlegroups.com/msg32314.html


Your link didn't work for me, but I assume this points to the same:
http://www.mail-archive.com/web2py@googlegroups.com/msg32314.html


Lol! Interesting how gmane rewrites one's posts...
h t t p : / / w w w . m a i l - a r c h i v e . c o m / w e b 2 p y @ g 
o o g l e g r o u p s . c o m / m s g 3 2 3 1 4 . h t m l





[web2py] Re: new URL router release candidate

2011-01-07 Thread VP
Thanks.
What if I have something like this:

example1.com   /app1/controller1
example1.net   /app1/controller2

How would this translate into this new syntax?

Thanks.

On Jan 7, 2:39 pm, Jonathan Lundell jlund...@pobox.com wrote:
 On Jan 7, 2011, at 12:25 PM, Jonathan Lundell wrote:





  On Jan 7, 2011, at 12:14 PM, VP wrote:

  It is something like this:

  example1.com   /app1/default
  example2.com   /app2/default
  example3.com   /app3/default

  In that case:

  routers = dict(
     app1 = dict(domain='example1.com'),
     app2 = dict(domain='example2.com'),
     app3 = dict(domain='example3.com'),
  )

 By way of a little more explanation: 'default' doesn't appear because 
 'default' is already the default controller. There's a router named BASE for 
 overrides that apply to all apps, but it's left out here because it's empty. 
 The defaults are shown in router.example.py.


[web2py] [OFF] Guido released a new DataStore API for GAE

2011-01-07 Thread Bruno Rocha
Guido released a new DataStore API for GAE

I read the docs and I think this syntax looks like DAL syntax

*Look the NewDataStoreAPI syntax:*
msg = yield Greeting.get_or_insert_async('hello', message='Hello world')

Let's break this up further into its constituents:

f = Greeting.get_or_insert_async('hello', message='Hello world')

msg = yield f

---

BTW, The old API will remain intact and working.

Announcement
http://neopythonic.blogspot.com/2011/01/new-app-engine-datastore-api.html

Docs
https://docs.google.com/document/d/1hJI0Jk4vQMIoyrfqFpWhYODHXBtxpMHHeR2hjQ9NyXY/edit?ndplr=1pli=1#

https://docs.google.com/document/d/1hJI0Jk4vQMIoyrfqFpWhYODHXBtxpMHHeR2hjQ9NyXY/edit?ndplr=1pli=1#

-- 

Bruno Rocha
http://about.me/rochacbruno/bio


[web2py] Re: web2py-related thread at reddit

2011-01-07 Thread ma...@rockiger.com
Who cares about reddit, anyway?

All communities are biased. Don't mind that shit.

Marco


Re: [web2py] Re: new URL router release candidate

2011-01-07 Thread Jonathan Lundell
On Jan 7, 2011, at 1:56 PM, VP wrote:
 
 Thanks.
 What if I have something like this:
 
 example1.com   /app1/controller1
 example1.net   /app1/controller2
 
 How would this translate into this new syntax?

Right now it doesn't split an application across domains. If that's useful, I 
could extend the syntax. There's an alternative syntax to the one I showed 
earlier, where the domain map is defined globally in the BASE router. While 
it's not currently a feature, it would look like this:

routers = dict(
BASE = dict(
domains = {
example1.com : app1/controller1,
example1.net : app1/controller2
},
)
)

 
 Thanks.
 
 On Jan 7, 2:39 pm, Jonathan Lundell jlund...@pobox.com wrote:
 On Jan 7, 2011, at 12:25 PM, Jonathan Lundell wrote:
 
 
 
 
 
 On Jan 7, 2011, at 12:14 PM, VP wrote:
 
 It is something like this:
 
 example1.com   /app1/default
 example2.com   /app2/default
 example3.com   /app3/default
 
 In that case:
 
 routers = dict(
app1 = dict(domain='example1.com'),
app2 = dict(domain='example2.com'),
app3 = dict(domain='example3.com'),
 )
 
 By way of a little more explanation: 'default' doesn't appear because 
 'default' is already the default controller. There's a router named BASE for 
 overrides that apply to all apps, but it's left out here because it's empty. 
 The defaults are shown in router.example.py.




[web2py] Re: web2py-related thread at reddit

2011-01-07 Thread Julio Schwarzbeck
Who is http://www.reddit.com/user/av201001 I want to marry her...

Hold on.. is he a dude? argh .. nevermind ;)

On Jan 7, 7:20 am, Anthony abasta...@gmail.com wrote:
 On Friday, January 7, 2011 2:58:14 AM UTC-5, cjrh wrote:

  On Jan 7, 12:06 am, Anthony abas...@gmail.com wrote:
   In case anyone is interested...

  http://www.reddit.com/r/Python/comments/ex54j/seeking_clarification_o...

  Massimo should just stop caring.   The reddit people have already
  heard the sales pitch, and further energy spent on trying to convince
  them is wasted.

 You're right, it's not worth spending energy to try to convince these
 particular individuals -- they've all got vested interests (personal or
 professional) in alternatives. However, lots of disinterested folks are also
 reading those reddit threads, so sometimes it's worth correcting the record
 just so web2py is not publicly defined solely by its detractors. I was
 reading these kinds of discussions a few months back when I was researching
 web frameworks, and if it hadn't been for Massimo correcting some false
 claims of others, I might have been scared off of web2py.

 Anthony


[web2py] on a possible web2py memory leak

2011-01-07 Thread Massimo Di Pierro
Mitsuhiko on reddit brings up a good issue that I was not aware of: a
bug in exec.

code=
class Foo(object):
def __del__(self):
pass
foo = Foo()

while True: exec code in {}

causes a memory leak. Web2py does this. The memory leak is small in
practice and in fact nobody noticed it. Yet it is a concern, in
theory.

So far I have the current solution

code=
class Foo(object):
def __del__(self):
pass
foo = Foo()

import gc
while True:
exec code in {}
gc.collect()

It works for me and I cannot reproduce the leak.
I patched trunk with this. Give it a try and let me know what you
think.

Massimo


[web2py] Re: on a possible web2py memory leak

2011-01-07 Thread Massimo Di Pierro
Actually this works for all classes but classes that have a __del__
(and this is not a web2py specific problem) so for now:

Attention: do not define classes with a __del__ method in models or
controllers.

Even if you do not use web2py but use another framework, do not create
classes with __del__ methods if they may have self references, whether
or not you use exec.

Here is an example of a python program without exec that has the leak
we are talking about:

class Foo(object):
def __del__(self):
pass
while True:
foo = Foo()
foo.x = foo



On Jan 7, 6:56 pm, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 Mitsuhiko on reddit brings up a good issue that I was not aware of: a
 bug in exec.

 code=
 class Foo(object):
     def __del__(self):
         pass
 foo = Foo()
 
 while True: exec code in {}

 causes a memory leak. Web2py does this. The memory leak is small in
 practice and in fact nobody noticed it. Yet it is a concern, in
 theory.

 So far I have the current solution

 code=
 class Foo(object):
     def __del__(self):
         pass
 foo = Foo()
 
 import gc
 while True:
     exec code in {}
     gc.collect()

 It works for me and I cannot reproduce the leak.
 I patched trunk with this. Give it a try and let me know what you
 think.

 Massimo


[web2py] Re: on a possible web2py memory leak

2011-01-07 Thread Massimo Di Pierro
More about the subject of circular references:...

http://www.jython.org/archive/21/docs/differences.html

In Jython users don't need to worry about handling circular
references as these are guaranteed to be collected properly

CPython uses reference counting instead of proper garbage collection
and suffers from this problem.


On Jan 7, 8:09 pm, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 Actually this works for all classes but classes that have a __del__
 (and this is not a web2py specific problem) so for now:

 Attention: do not define classes with a __del__ method in models or
 controllers.

 Even if you do not use web2py but use another framework, do not create
 classes with __del__ methods if they may have self references, whether
 or not you use exec.

 Here is an example of a python program without exec that has the leak
 we are talking about:

 class Foo(object):
     def __del__(self):
         pass
 while True:
     foo = Foo()
     foo.x = foo

 On Jan 7, 6:56 pm, Massimo Di Pierro massimo.dipie...@gmail.com
 wrote:







  Mitsuhiko on reddit brings up a good issue that I was not aware of: a
  bug in exec.

  code=
  class Foo(object):
      def __del__(self):
          pass
  foo = Foo()
  
  while True: exec code in {}

  causes a memory leak. Web2py does this. The memory leak is small in
  practice and in fact nobody noticed it. Yet it is a concern, in
  theory.

  So far I have the current solution

  code=
  class Foo(object):
      def __del__(self):
          pass
  foo = Foo()
  
  import gc
  while True:
      exec code in {}
      gc.collect()

  It works for me and I cannot reproduce the leak.
  I patched trunk with this. Give it a try and let me know what you
  think.

  Massimo


[web2py] Re: on a possible web2py memory leak

2011-01-07 Thread Anthony
As far as I can tell, the change in trunk didn't have any effect for me. I'm 
on Windows 7 with Python 2.7.1 (just using the built-in Rocket server). I 
added the following code to the top of default.py (outside any functions) in 
the welcome app: 
 
class Foo(object):
def __del__(self):
pass
foo = Foo()
foo.payload = [1] * 100
 
I then load the index page of the welcome app and start watching my 
python.exe process memory in the Windows Task Manager. Every time I reload 
the page (by hitting F5), the memory increases by about 7MB, which is 
exactly the same behavior I observe when running the same experiment in 
1.91.6 (i.e., before gc was added). These large memory increases do not 
occur when I remove the above code from default.py. Am I doing something 
wrong?
 
I'm also wondering if there may be a small memory leak either in the 
framework or the welcome app, even without the above code. I notice that 
when I reload the welcome app index page (without the above code), I still 
get small memory increases, on the order of a few KB per reload. It's not 
consistent -- sometimes a few KB, sometimes a bit more, sometimes no 
increase at all -- but memory does consistently creep up as I keep reloading 
(both in trunk and in 1.91.6). Is that expected behavior?
 
Thanks.
 
Anthony
 
 On Friday, January 7, 2011 7:56:51 PM UTC-5, Massimo Di Pierro wrote:

 Mitsuhiko on reddit brings up a good issue that I was not aware of: a 
 bug in exec. 
  
 code= 
 class Foo(object): 
 def __del__(self): 
 pass 
 foo = Foo() 
  
 while True: exec code in {} 
  
 causes a memory leak. Web2py does this. The memory leak is small in 
 practice and in fact nobody noticed it. Yet it is a concern, in 
 theory. 
  
 So far I have the current solution 
  
 code= 
 class Foo(object): 
 def __del__(self): 
 pass 
 foo = Foo() 
  
 import gc 
 while True: 
 exec code in {} 
 gc.collect() 
  
 It works for me and I cannot reproduce the leak. 
 I patched trunk with this. Give it a try and let me know what you 
 think. 
  
 Massimo 
  



[web2py] Re: web2py-related thread at reddit

2011-01-07 Thread Anthony
On Friday, January 7, 2011 5:50:38 PM UTC-5, Julio Schwarzbeck wrote: 

 Who is http://www.reddit.com/user/av201001 I want to marry her... 

 Hold on.. is he a dude? argh .. nevermind ;) 

 
Sorry, I'm already married, and I'm a dude. But thanks for asking.
 
For the record, I'm a fan of your work as well (though I'm not going to 
propose).
 
Cheers,
 
Anthony


[web2py] Can any help me with new dal in trunk?

2011-01-07 Thread drayco
Hi, this code works with web2py 1.89.5 with mysql

but with web2py in trunk and mysql it dosent works.

db.define_table(lentes,
audit,
Field(tecnoGradua, 'string',
requires=IS_IN_SET(['MONOFOCAL','BIFOCAL','MULTIFOCAL']),label=Num.
de Graduaciones),
Field(material, string, requires=IS_IN_SET(['MICA CR-39','ORMA
1.50','HIGH INDEX','THIN  LITE 1.67
ASFÉRICA','POLICARBONATO','CRISTAL'])),
Field(tipo, string,requires=IS_NULL_OR(IS_IN_SET(['FLAT
TOP','BLEND O YOUNGER','PROGRESIVOS','PROGRESIVOS VARILUX COMFORT
NE','PROGRESIVOS COMPACTOS','PROGRESIVOS VARILUX COMFORT SHORT']))),
Field(tecnoVisual,
'string',requires=IS_NULL_OR(IS_IN_SET(['PHOTOGRAY','TRANSITIONS'])),label=Tecnologia
de Visualización),
Field(tratamiento, string,requires=IS_NULL_OR(IS_IN_SET(['CON
ANTIRREFLEJANTE','ESPEJEADO','CRIZAL FORTE','CRIZAL ALIZÉ']))),
Field('limitup','double', writable=False, readable=False),
Field('limitdown','double', writable=False, readable=False),
Field(promo, double, requires=[IS_NOT_EMPTY(error_message='No
puede estar vacio'),IS_FLOAT_IN_RANGE(0,1,error_message='Debe ser
un numero positivo entre 0 y 1')], label='Precio de Promoción'),
Field(precio, double, writable=False, readable=False),
Field(costo, double, writable=False, readable=False),
Field(observaciones,text, writable=False, readable=False))

This is the traceback

Traceback (most recent call last):
  File /home/drayco/web2py/gluon/restricted.py, line 188, in
restricted
exec ccode in environment
  File /home/drayco/web2py/applications/movil/models/db.py, line
272, in module
Field(observaciones,text, writable=False, readable=False))
  File /home/drayco/web2py/gluon/dal.py, line 3441, in define_table
polymodel=polymodel)
  File /home/drayco/web2py/gluon/dal.py, line 551, in create_table
fake_migrate=fake_migrate)
  File /home/drayco/web2py/gluon/dal.py, line 595, in migrate_table
and not isinstance(table[key].type, SQLCustomType) \
  File /home/drayco/web2py/gluon/dal.py, line 3778, in __getitem__
return dict.__getitem__(self, str(key))
KeyError: 'tecnogradua'

Can I need to change something?


[web2py] Re: on a possible web2py memory leak

2011-01-07 Thread Anthony
Also, I noticed the changeset in trunk included main.py and restricted.py, 
but there were no actual changes in restricted.py. Was there supposed to be 
a change in restricted.py that was mistakenly left out?

On Saturday, January 8, 2011 12:41:27 AM UTC-5, Anthony wrote:

 As far as I can tell, the change in trunk didn't have any effect for me. 
 I'm on Windows 7 with Python 2.7.1 (just using the built-in Rocket server). 
 I added the following code to the top of default.py (outside any functions) 
 in the welcome app: 
  
 class Foo(object):
 def __del__(self):
 pass
 foo = Foo()
 foo.payload = [1] * 100
  
 I then load the index page of the welcome app and start watching my 
 python.exe process memory in the Windows Task Manager. Every time I reload 
 the page (by hitting F5), the memory increases by about 7MB, which is 
 exactly the same behavior I observe when running the same experiment in 
 1.91.6 (i.e., before gc was added). These large memory increases do not 
 occur when I remove the above code from default.py. Am I doing something 
 wrong?
  
 I'm also wondering if there may be a small memory leak either in the 
 framework or the welcome app, even without the above code. I notice that 
 when I reload the welcome app index page (without the above code), I still 
 get small memory increases, on the order of a few KB per reload. It's not 
 consistent -- sometimes a few KB, sometimes a bit more, sometimes no 
 increase at all -- but memory does consistently creep up as I keep reloading 
 (both in trunk and in 1.91.6). Is that expected behavior?
  
 Thanks.
  
 Anthony
  
  On Friday, January 7, 2011 7:56:51 PM UTC-5, Massimo Di Pierro wrote:

 Mitsuhiko on reddit brings up a good issue that I was not aware of: a 
 bug in exec. 
  
 code= 
 class Foo(object): 
 def __del__(self): 
 pass 
 foo = Foo() 
  
 while True: exec code in {} 
  
 causes a memory leak. Web2py does this. The memory leak is small in 
 practice and in fact nobody noticed it. Yet it is a concern, in 
 theory. 
  
 So far I have the current solution 
  
 code= 
 class Foo(object): 
 def __del__(self): 
 pass 
 foo = Foo() 
  
 import gc 
 while True: 
 exec code in {} 
 gc.collect() 
  
 It works for me and I cannot reproduce the leak. 
 I patched trunk with this. Give it a try and let me know what you 
 think. 
  
 Massimo 
  



[web2py] Re: Can any help me with new dal in trunk?

2011-01-07 Thread mart
Probably just being unhappy with the case :)

tecnoGradua != tecnogradua


Mart :)


Field(tecnoGradua, 'string',

On Jan 8, 12:57 am, drayco antrod...@gmail.com wrote:
 Hi, this code works with web2py 1.89.5 with mysql

 but with web2py in trunk and mysql it dosent works.

 db.define_table(lentes,
     audit,
     Field(tecnoGradua, 'string',
 requires=IS_IN_SET(['MONOFOCAL','BIFOCAL','MULTIFOCAL']),label=Num.
 de Graduaciones),
     Field(material, string, requires=IS_IN_SET(['MICA CR-39','ORMA
 1.50','HIGH INDEX','THIN  LITE 1.67
 ASFÉRICA','POLICARBONATO','CRISTAL'])),
     Field(tipo, string,requires=IS_NULL_OR(IS_IN_SET(['FLAT
 TOP','BLEND O YOUNGER','PROGRESIVOS','PROGRESIVOS VARILUX COMFORT
 NE','PROGRESIVOS COMPACTOS','PROGRESIVOS VARILUX COMFORT SHORT']))),
     Field(tecnoVisual,
 'string',requires=IS_NULL_OR(IS_IN_SET(['PHOTOGRAY','TRANSITIONS'])),label= 
 Tecnologia
 de Visualización),
     Field(tratamiento, string,requires=IS_NULL_OR(IS_IN_SET(['CON
 ANTIRREFLEJANTE','ESPEJEADO','CRIZAL FORTE','CRIZAL ALIZÉ']))),
     Field('limitup','double', writable=False, readable=False),
     Field('limitdown','double', writable=False, readable=False),
     Field(promo, double, requires=[IS_NOT_EMPTY(error_message='No
 puede estar vacio'),IS_FLOAT_IN_RANGE(0,1,error_message='Debe ser
 un numero positivo entre 0 y 1')], label='Precio de Promoción'),
     Field(precio, double, writable=False, readable=False),
     Field(costo, double, writable=False, readable=False),
     Field(observaciones,text, writable=False, readable=False))

 This is the traceback

 Traceback (most recent call last):
   File /home/drayco/web2py/gluon/restricted.py, line 188, in
 restricted
     exec ccode in environment
   File /home/drayco/web2py/applications/movil/models/db.py, line
 272, in module
     Field(observaciones,text, writable=False, readable=False))
   File /home/drayco/web2py/gluon/dal.py, line 3441, in define_table
     polymodel=polymodel)
   File /home/drayco/web2py/gluon/dal.py, line 551, in create_table
     fake_migrate=fake_migrate)
   File /home/drayco/web2py/gluon/dal.py, line 595, in migrate_table
     and not isinstance(table[key].type, SQLCustomType) \
   File /home/drayco/web2py/gluon/dal.py, line 3778, in __getitem__
     return dict.__getitem__(self, str(key))
 KeyError: 'tecnogradua'

 Can I need to change something?


[web2py] Can any help me with new dal in trunk (2)?

2011-01-07 Thread drayco
Hi, this code works with web2py 1.83.2 and mysql

but,with web2py in trunk and mysql it doesn't works

cfedb.define_table('med_dnpmst_4',
Field('DireccionUTR', 'integer' , length = 6 ),
Field('Indice', 'id' ),
Field('ValorActual', 'double' ),
Field('Resolucion', 'integer' , length = 4 ),
Field('ClaveMaxyMinIngenieril', 'integer' , length = 1 ),
Field('BandaMuerta', 'double' ),
Field('Tipo', 'integer' , length = 1 ),
Field('ClaveMediciones', 'integer' , length = 6 ),
primarykey=['DireccionUTR','Indice'],
migrate = False)

This is the traceback

Traceback (most recent call last):
  File /home/drayco/web2py/gluon/restricted.py, line 188, in
restricted
exec ccode in environment
  File /home/drayco/web2py/applications/iscada/models/cfedb.py, line
16, in module
migrate = False)
  File /home/drayco/web2py/gluon/dal.py, line 3429, in define_table
sequence_name=sequence_name))
  File /home/drayco/web2py/gluon/dal.py, line 3713, in __init__
primarykey must be a list of fields from table '%s  % tablename
SyntaxError: primarykey must be a list of fields from table
'med_dnpmst_4

Can I need to change something?


[web2py] Re: Can any help me with new dal in trunk?

2011-01-07 Thread drayco
Ok, I understand your point.

But this is a issue of DAL or what?

because I only update web2py to trunk version

On Jan 8, 12:15 am, mart msenecal...@gmail.com wrote:
 Probably just being unhappy with the case :)

 tecnoGradua != tecnogradua

 Mart :)

 Field(tecnoGradua, 'string',

 On Jan 8, 12:57 am, drayco antrod...@gmail.com wrote:

  Hi, this code works with web2py 1.89.5 with mysql

  but with web2py in trunk and mysql it dosent works.

  db.define_table(lentes,
      audit,
      Field(tecnoGradua, 'string',
  requires=IS_IN_SET(['MONOFOCAL','BIFOCAL','MULTIFOCAL']),label=Num.
  de Graduaciones),
      Field(material, string, requires=IS_IN_SET(['MICA CR-39','ORMA
  1.50','HIGH INDEX','THIN  LITE 1.67
  ASFÉRICA','POLICARBONATO','CRISTAL'])),
      Field(tipo, string,requires=IS_NULL_OR(IS_IN_SET(['FLAT
  TOP','BLEND O YOUNGER','PROGRESIVOS','PROGRESIVOS VARILUX COMFORT
  NE','PROGRESIVOS COMPACTOS','PROGRESIVOS VARILUX COMFORT SHORT']))),
      Field(tecnoVisual,
  'string',requires=IS_NULL_OR(IS_IN_SET(['PHOTOGRAY','TRANSITIONS'])),label= 
  Tecnologia
  de Visualización),
      Field(tratamiento, string,requires=IS_NULL_OR(IS_IN_SET(['CON
  ANTIRREFLEJANTE','ESPEJEADO','CRIZAL FORTE','CRIZAL ALIZÉ']))),
      Field('limitup','double', writable=False, readable=False),
      Field('limitdown','double', writable=False, readable=False),
      Field(promo, double, requires=[IS_NOT_EMPTY(error_message='No
  puede estar vacio'),IS_FLOAT_IN_RANGE(0,1,error_message='Debe ser
  un numero positivo entre 0 y 1')], label='Precio de Promoción'),
      Field(precio, double, writable=False, readable=False),
      Field(costo, double, writable=False, readable=False),
      Field(observaciones,text, writable=False, readable=False))

  This is the traceback

  Traceback (most recent call last):
    File /home/drayco/web2py/gluon/restricted.py, line 188, in
  restricted
      exec ccode in environment
    File /home/drayco/web2py/applications/movil/models/db.py, line
  272, in module
      Field(observaciones,text, writable=False, readable=False))
    File /home/drayco/web2py/gluon/dal.py, line 3441, in define_table
      polymodel=polymodel)
    File /home/drayco/web2py/gluon/dal.py, line 551, in create_table
      fake_migrate=fake_migrate)
    File /home/drayco/web2py/gluon/dal.py, line 595, in migrate_table
      and not isinstance(table[key].type, SQLCustomType) \
    File /home/drayco/web2py/gluon/dal.py, line 3778, in __getitem__
      return dict.__getitem__(self, str(key))
  KeyError: 'tecnogradua'

  Can I need to change something?




[web2py] Re: Can any help me with new dal in trunk?

2011-01-07 Thread mart
no, this is python...

not sure how it could have worked before, but the key (technogradua)
in .keys() is not being picked up... dal is simply pointing that out
with the exception being thrown. I did notice when I made the switch
that a few more of my mistakes got picked up (or it could be that I
forgot that I changed something), but regardless... since switching to
the latest DAL release and fixing my mistakes that it quickly picked
up, I have had no problems (except those that I cause). I would simply
take those exceptions for cash, change the case and enjoy one less
exception ;)

Mart :)



On Jan 8, 1:19 am, drayco antrod...@gmail.com wrote:
 Ok, I understand your point.

 But this is a issue of DAL or what?

 because I only update web2py to trunk version

 On Jan 8, 12:15 am, mart msenecal...@gmail.com wrote:







  Probably just being unhappy with the case :)

  tecnoGradua != tecnogradua

  Mart :)

  Field(tecnoGradua, 'string',

  On Jan 8, 12:57 am, drayco antrod...@gmail.com wrote:

   Hi, this code works with web2py 1.89.5 with mysql

   but with web2py in trunk and mysql it dosent works.

   db.define_table(lentes,
       audit,
       Field(tecnoGradua, 'string',
   requires=IS_IN_SET(['MONOFOCAL','BIFOCAL','MULTIFOCAL']),label=Num.
   de Graduaciones),
       Field(material, string, requires=IS_IN_SET(['MICA CR-39','ORMA
   1.50','HIGH INDEX','THIN  LITE 1.67
   ASFÉRICA','POLICARBONATO','CRISTAL'])),
       Field(tipo, string,requires=IS_NULL_OR(IS_IN_SET(['FLAT
   TOP','BLEND O YOUNGER','PROGRESIVOS','PROGRESIVOS VARILUX COMFORT
   NE','PROGRESIVOS COMPACTOS','PROGRESIVOS VARILUX COMFORT SHORT']))),
       Field(tecnoVisual,
   'string',requires=IS_NULL_OR(IS_IN_SET(['PHOTOGRAY','TRANSITIONS'])),label=
Tecnologia
   de Visualización),
       Field(tratamiento, string,requires=IS_NULL_OR(IS_IN_SET(['CON
   ANTIRREFLEJANTE','ESPEJEADO','CRIZAL FORTE','CRIZAL ALIZÉ']))),
       Field('limitup','double', writable=False, readable=False),
       Field('limitdown','double', writable=False, readable=False),
       Field(promo, double, requires=[IS_NOT_EMPTY(error_message='No
   puede estar vacio'),IS_FLOAT_IN_RANGE(0,1,error_message='Debe ser
   un numero positivo entre 0 y 1')], label='Precio de Promoción'),
       Field(precio, double, writable=False, readable=False),
       Field(costo, double, writable=False, readable=False),
       Field(observaciones,text, writable=False, readable=False))

   This is the traceback

   Traceback (most recent call last):
     File /home/drayco/web2py/gluon/restricted.py, line 188, in
   restricted
       exec ccode in environment
     File /home/drayco/web2py/applications/movil/models/db.py, line
   272, in module
       Field(observaciones,text, writable=False, readable=False))
     File /home/drayco/web2py/gluon/dal.py, line 3441, in define_table
       polymodel=polymodel)
     File /home/drayco/web2py/gluon/dal.py, line 551, in create_table
       fake_migrate=fake_migrate)
     File /home/drayco/web2py/gluon/dal.py, line 595, in migrate_table
       and not isinstance(table[key].type, SQLCustomType) \
     File /home/drayco/web2py/gluon/dal.py, line 3778, in __getitem__
       return dict.__getitem__(self, str(key))
   KeyError: 'tecnogradua'

   Can I need to change something?


Re: [web2py] Re: Can any help me with new dal in trunk?

2011-01-07 Thread Thadeus Burgess
I can also confirm this is a bug with the new DAL.

It is only caused when using upper case characters in the table or field
names. It seems that web2py converts all of the tablenames to lower case
when issuing the SQL (so your actual tables are lower regardless of what you
specify in the python). There is something in the migrations that cause this
to come up, because it will work just fine one run and crash on another run
after changing some unrelated tables.

I don't think the DAL should force the tables to lowercase.

--
Thadeus




On Sat, Jan 8, 2011 at 12:38 AM, mart msenecal...@gmail.com wrote:

 no, this is python...

 not sure how it could have worked before, but the key (technogradua)
 in .keys() is not being picked up... dal is simply pointing that out
 with the exception being thrown. I did notice when I made the switch
 that a few more of my mistakes got picked up (or it could be that I
 forgot that I changed something), but regardless... since switching to
 the latest DAL release and fixing my mistakes that it quickly picked
 up, I have had no problems (except those that I cause). I would simply
 take those exceptions for cash, change the case and enjoy one less
 exception ;)

 Mart :)



 On Jan 8, 1:19 am, drayco antrod...@gmail.com wrote:
  Ok, I understand your point.
 
  But this is a issue of DAL or what?
 
  because I only update web2py to trunk version
 
  On Jan 8, 12:15 am, mart msenecal...@gmail.com wrote:
 
 
 
 
 
 
 
   Probably just being unhappy with the case :)
 
   tecnoGradua != tecnogradua
 
   Mart :)
 
   Field(tecnoGradua, 'string',
 
   On Jan 8, 12:57 am, drayco antrod...@gmail.com wrote:
 
Hi, this code works with web2py 1.89.5 with mysql
 
but with web2py in trunk and mysql it dosent works.
 
db.define_table(lentes,
audit,
Field(tecnoGradua, 'string',
requires=IS_IN_SET(['MONOFOCAL','BIFOCAL','MULTIFOCAL']),label=Num.
de Graduaciones),
Field(material, string, requires=IS_IN_SET(['MICA
 CR-39','ORMA
1.50','HIGH INDEX','THIN  LITE 1.67
ASFÉRICA','POLICARBONATO','CRISTAL'])),
Field(tipo, string,requires=IS_NULL_OR(IS_IN_SET(['FLAT
TOP','BLEND O YOUNGER','PROGRESIVOS','PROGRESIVOS VARILUX COMFORT
NE','PROGRESIVOS COMPACTOS','PROGRESIVOS VARILUX COMFORT SHORT']))),
Field(tecnoVisual,
   
 'string',requires=IS_NULL_OR(IS_IN_SET(['PHOTOGRAY','TRANSITIONS'])),label=
 Tecnologia
de Visualización),
Field(tratamiento, string,requires=IS_NULL_OR(IS_IN_SET(['CON
ANTIRREFLEJANTE','ESPEJEADO','CRIZAL FORTE','CRIZAL ALIZÉ']))),
Field('limitup','double', writable=False, readable=False),
Field('limitdown','double', writable=False, readable=False),
Field(promo, double, requires=[IS_NOT_EMPTY(error_message='No
puede estar vacio'),IS_FLOAT_IN_RANGE(0,1,error_message='Debe ser
un numero positivo entre 0 y 1')], label='Precio de Promoción'),
Field(precio, double, writable=False, readable=False),
Field(costo, double, writable=False, readable=False),
Field(observaciones,text, writable=False, readable=False))
 
This is the traceback
 
Traceback (most recent call last):
  File /home/drayco/web2py/gluon/restricted.py, line 188, in
restricted
exec ccode in environment
  File /home/drayco/web2py/applications/movil/models/db.py, line
272, in module
Field(observaciones,text, writable=False, readable=False))
  File /home/drayco/web2py/gluon/dal.py, line 3441, in define_table
polymodel=polymodel)
  File /home/drayco/web2py/gluon/dal.py, line 551, in create_table
fake_migrate=fake_migrate)
  File /home/drayco/web2py/gluon/dal.py, line 595, in migrate_table
and not isinstance(table[key].type, SQLCustomType) \
  File /home/drayco/web2py/gluon/dal.py, line 3778, in __getitem__
return dict.__getitem__(self, str(key))
KeyError: 'tecnogradua'
 
Can I need to change something?



[web2py] Re: Can any help me with crud.archive?

2011-01-07 Thread drayco
Well, only a litle typo in page 324

db.define_table('notas_archive',
Field('current_record',db.notas),
db.notas)

However all it's works ok.

On Dec 8 2010, 7:58 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 which web2py version?

 On Dec 8, 6:30 pm, drayco antrod...@gmail.com wrote:

  Hi

  I have this in model

  #audit field group
  audit = db.Table(db,'audit',
      Field('unique_id', 'string',default=uuid.uuid4(), writable=False,
  readable=False),
      Field('active', 'boolean', default=True, writable=False,
  readable=False, label='Activo',comment='Desactiva para eliminar este
  registro'),
      Field('created_by', db.auth_user, default=user_id, writable=False,
  readable=False, label='Creado por'),
      Field('created_on', 'datetime', default=request.now,
  writable=False, readable=False, label='Creado el'),
      Field('modified_by', db.auth_user, default=user_id,
  update=user_id, writable=False, readable=False, label='Modificado
  por'),
      Field('modified_on', 'datetime', default=request.now,
  update=request.now, writable=False, readable=False, label='Modificado
  el'),
      Field('reason','string' ,default='nueva
  información',requires=IS_IN_SET(['cambio', 'nueva información',
  'corrección']), writable=False, readable=False, label='Razon'))

  db.define_table(notas,
      audit,
      Field(store_id,db.stores, default=store.store_id,
  writable=False, label='Sucursal',comment='A la que se encuentra
  asignado'),
      Field('nota', 'integer', default=None,
  writable=False,label='No.Nota(Sistema)',comment='Remisión generada por
  el Sistema'),
      Field('notaFisica','integer', default=None,
  requires=IS_NULL_OR(IS_INT_IN_RANGE(2500,66500,error_message='Debe ser
  Numero positivo entre 2500 y
  66500')),label='No.Nota(Elaborada)',comment='Remision'),
      Field('vale', 'integer', default=None,
  requires=IS_NULL_OR(IS_INT_IN_RANGE(1,500,error_message='Debe ser
  Numero positivo entre 1 y 500')),label='Num.Vale',comment='Descuento
  para Arm1/Len1'),
      Field('folio', 'integer', default=None,
  requires=IS_NULL_OR(IS_INT_IN_RANGE(11,191999,error_message='Debe
  ser Numero positivo entre 11 y 191999')),label='Num.Folio'),
      Field('first_name','string', default=None,
  requires=IS_NULL_OR(IS_UPPER()),label='Nombre(s)'),
      Field('last_name','string', default=None,
  requires=IS_NULL_OR(IS_UPPER()),label='Apellido Paterno'),
      Field('end_name','string', default=None,
  requires=IS_NULL_OR(IS_UPPER()),label='Apellido Materno'),
      Field('tel','double', default=None,
  requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(0,1e1000,error_message='Debe ser
  Numero positivo')), label='Tel.Casa'),
      Field('tel1','double', default=None,
  requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(0,1e1000,error_message='Debe ser
  Numero positivo')), label='Tel.Trabajo'),
      Field('cel','double', default=None,
  requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(0,1e1000,error_message='Debe ser
  Numero positivo')), label='Tel.Celular',comment='Sin 044'),
      Field('email','string', default=None,
  requires=IS_NULL_OR(IS_EMAIL()),comment='Para enviar copia(pdf)'),
      Field('armazon1',db.eyewear,
  default=None,requires=IS_NULL_OR(IS_IN_DB(db,'eyewear.id','%(marca)s %
  (modelo)s %(color)s %(caract1)s $%(promo)s'))),
      Field('modelo1','string', default=None,
  requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser
  caracteres alfanumericos, sin espacios en blanco ó ñ!')),label='Modelo
  armazon1'),
      Field('color1','string', default=None,
  requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser
  caracteres alfanumericos, sin espacios en blanco ó
  ñ!')),label='Color(es) armazon1'),
      Field('lente1',db.lentes,
  default=None,requires=IS_NULL_OR(IS_IN_DB(db,'lentes.id','%
  (tecnoGradua)s %(material)s %(tipo)s %(tecnoVisual)s %(tratamiento)s $%
  (promo)s'))),
      Field('soloLoC1','string',
  default=None,requires=IS_NULL_OR(IS_IN_SET(['Solo para cerca','Solo
  para lejos'])), label='Lejos ó Cerca 1'),
      Field('tinte1','string', default=None,
  requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser
  caracteres alfanumericos, sin espacios en blanco ó ñ!'))),
      Field(vendedor,db.auth_user, default=user_id,
  requires=IS_NULL_OR(IS_IN_DB(vendedores,'auth_user.id','%(first_name)s
  %(last_name)s %(end_name)s'))),
      Field(total, double, default=0, writable=False),
      Field(anticipo, double, default=0,
  requires=[IS_NOT_EMPTY(error_message='No puede estar
  vacio'),IS_FLOAT_IN_RANGE(0,1,error_message='Debe ser un numero
  positivo entre 0 y 1')]),
      Field(pagos, double, default=0, writable=False),
      Field(saldo, double, default=0, writable=False),
      Field(fechaEntrega, date,default=(request.now
  +datetime.timedelta(14)), label='Fecha de Entrega'),
      Field(optometrista,db.auth_user,
  default=None,requires=IS_NULL_OR(IS_IN_DB(optometristas,'auth_user.id','%
  (first_name)s %(last_name)s %(end_name)s'))),
      

[web2py] Re: Can any help me with new dal in trunk?

2011-01-07 Thread mart
really? I didn't know, thanks for pointing that out...

just out of curiosity

in

in __getitem__
return dict.__getitem__(self, str(key))
KeyError: 'tecnogradua'

don't the attribute lookups get done by python ultimately?  Just
trying to understand...
how could this have worked if doing x.__getitem__ ? Even if dal does a
string.lower() or something, once the table is named and created,
would something (outside of migrate) not catch that error and set off
the alarm even before any change need to happen?

Thanks,
Mart :)


On Jan 8, 1:44 am, Thadeus Burgess thade...@thadeusb.com wrote:
 I can also confirm this is a bug with the new DAL.

 It is only caused when using upper case characters in the table or field
 names. It seems that web2py converts all of the tablenames to lower case
 when issuing the SQL (so your actual tables are lower regardless of what you
 specify in the python). There is something in the migrations that cause this
 to come up, because it will work just fine one run and crash on another run
 after changing some unrelated tables.

 I don't think the DAL should force the tables to lowercase.

 --
 Thadeus







 On Sat, Jan 8, 2011 at 12:38 AM, mart msenecal...@gmail.com wrote:
  no, this is python...

  not sure how it could have worked before, but the key (technogradua)
  in .keys() is not being picked up... dal is simply pointing that out
  with the exception being thrown. I did notice when I made the switch
  that a few more of my mistakes got picked up (or it could be that I
  forgot that I changed something), but regardless... since switching to
  the latest DAL release and fixing my mistakes that it quickly picked
  up, I have had no problems (except those that I cause). I would simply
  take those exceptions for cash, change the case and enjoy one less
  exception ;)

  Mart :)

  On Jan 8, 1:19 am, drayco antrod...@gmail.com wrote:
   Ok, I understand your point.

   But this is a issue of DAL or what?

   because I only update web2py to trunk version

   On Jan 8, 12:15 am, mart msenecal...@gmail.com wrote:

Probably just being unhappy with the case :)

tecnoGradua != tecnogradua

Mart :)

Field(tecnoGradua, 'string',

On Jan 8, 12:57 am, drayco antrod...@gmail.com wrote:

 Hi, this code works with web2py 1.89.5 with mysql

 but with web2py in trunk and mysql it dosent works.

 db.define_table(lentes,
     audit,
     Field(tecnoGradua, 'string',
 requires=IS_IN_SET(['MONOFOCAL','BIFOCAL','MULTIFOCAL']),label=Num.
 de Graduaciones),
     Field(material, string, requires=IS_IN_SET(['MICA
  CR-39','ORMA
 1.50','HIGH INDEX','THIN  LITE 1.67
 ASFÉRICA','POLICARBONATO','CRISTAL'])),
     Field(tipo, string,requires=IS_NULL_OR(IS_IN_SET(['FLAT
 TOP','BLEND O YOUNGER','PROGRESIVOS','PROGRESIVOS VARILUX COMFORT
 NE','PROGRESIVOS COMPACTOS','PROGRESIVOS VARILUX COMFORT SHORT']))),
     Field(tecnoVisual,

  'string',requires=IS_NULL_OR(IS_IN_SET(['PHOTOGRAY','TRANSITIONS'])),label=
  Tecnologia
 de Visualización),
     Field(tratamiento, string,requires=IS_NULL_OR(IS_IN_SET(['CON
 ANTIRREFLEJANTE','ESPEJEADO','CRIZAL FORTE','CRIZAL ALIZÉ']))),
     Field('limitup','double', writable=False, readable=False),
     Field('limitdown','double', writable=False, readable=False),
     Field(promo, double, requires=[IS_NOT_EMPTY(error_message='No
 puede estar vacio'),IS_FLOAT_IN_RANGE(0,1,error_message='Debe ser
 un numero positivo entre 0 y 1')], label='Precio de Promoción'),
     Field(precio, double, writable=False, readable=False),
     Field(costo, double, writable=False, readable=False),
     Field(observaciones,text, writable=False, readable=False))

 This is the traceback

 Traceback (most recent call last):
   File /home/drayco/web2py/gluon/restricted.py, line 188, in
 restricted
     exec ccode in environment
   File /home/drayco/web2py/applications/movil/models/db.py, line
 272, in module
     Field(observaciones,text, writable=False, readable=False))
   File /home/drayco/web2py/gluon/dal.py, line 3441, in define_table
     polymodel=polymodel)
   File /home/drayco/web2py/gluon/dal.py, line 551, in create_table
     fake_migrate=fake_migrate)
   File /home/drayco/web2py/gluon/dal.py, line 595, in migrate_table
     and not isinstance(table[key].type, SQLCustomType) \
   File /home/drayco/web2py/gluon/dal.py, line 3778, in __getitem__
     return dict.__getitem__(self, str(key))
 KeyError: 'tecnogradua'

 Can I need to change something?


[web2py] Re: on a possible web2py memory leak

2011-01-07 Thread ron_m
Doesn't adding the gc.collect() just force the garbage collector to run 
right now instead of waiting until some usage threshold is crossed and then 
it runs to do the cleanup at some time in the future. Any accumulation of 
heap use until gc gets around to running isn't really a leak, it is just 
uncollected garbage. The __del__ doesn't do anything and also doesn't force 
a gc.collect() by its presence.

http://www.algorithm.co.il/blogs/programming/python-gotchas-1-__del__-is-not-the-opposite-of-__init__/