[web2py] orderby first, then limitby

2011-06-09 Thread pbreit
I have a query that includes both orderby and limitby. What seems to happen 
is that the db returns some set of records as dictated by the limit and then 
orders the records in that set. So I pretty much get the same set every time 
even though I know the field being ordered has changed for various records. 
Is this how SQL works? Is there any way to order the whole set first and 
then return the sub-set?

[web2py] Re: How to implement flags?

2011-06-09 Thread pbreit
Thanks, ron_m, good info.

[web2py] vars vs. kwargs

2011-06-09 Thread Pawel Jasinski
hi,
it is cosmetic, but can be a pain for someone no so familiar with
python.
In examples for restful api:

def index():
def GET(*args,**vars):
patterns = [
"/persons[person]",
"/{person.name.startswith}",
"/{person.name}/:field",
"/{person.name}/pets[pet.person]",
"/{person.name}/pet[pet.person]/{pet.name}",
"/{person.name}/pet[pet.person]/{pet.name}/:field"
]
parser = db.parse_as_rest(patterns,args,vars)
if parser.status == 200:
return dict(content=parser.response)
else:
raise HTTP(parser.status,parser.error)
def POST(table_name,**vars):
if table_name == 'person':
return db.person.validate_and_insert(**vars)
elif table_name == 'pet':
return db.pet.validate_and_insert(**vars)
else:
raise HTTP(400)
return locals()

after copy paste everything is ok, but the problem is waiting to
happen ...
vars hides built-in vars function.

cheers,
pawel


[web2py] Re: orderby first, then limitby

2011-06-09 Thread luifran
In sql, you can apply first order by and then limitby for example in
Oracle:

select * from
(select * from table
 order by field)
where rownum<11//row 1 to 10 after order

On 9 jun, 09:52, pbreit  wrote:
> I have a query that includes both orderby and limitby. What seems to happen
> is that the db returns some set of records as dictated by the limit and then
> orders the records in that set. So I pretty much get the same set every time
> even though I know the field being ordered has changed for various records.
> Is this how SQL works? Is there any way to order the whole set first and
> then return the sub-set?


[web2py] Re: orderby first, then limitby

2011-06-09 Thread luifran
In DAL, I don´t know If this can be done.

On 9 jun, 10:40, luifran  wrote:
> In sql, you can apply first order by and then limitby for example in
> Oracle:
>
> select * from
> (select * from table
>  order by field)
> where rownum<11//row 1 to 10 after order
>
> On 9 jun, 09:52, pbreit  wrote:
>
>
>
>
>
>
>
> > I have a query that includes both orderby and limitby. What seems to happen
> > is that the db returns some set of records as dictated by the limit and then
> > orders the records in that set. So I pretty much get the same set every time
> > even though I know the field being ordered has changed for various records.
> > Is this how SQL works? Is there any way to order the whole set first and
> > then return the sub-set?


[web2py] Re: Cubrid?

2011-06-09 Thread CUBRID RDBMS
Hello Massimo,

How is it going? As I promised we have uploaded the new CUBRID Python API 
Doc. You can download it from 
http://www.cubrid.org/python_programming#manual or view it online at 
ftp://ftp.cubrid.org/CUBRID_Docs/Drivers/Python/8.4.0/index.html.

The documentation is prepared by Epydoc. I also wonder if anyone has some 
preferences regarding the documentation generator. I would be glad to know.


Re: [web2py] Offtopic: Who's at Pycon APAC?

2011-06-09 Thread Martín Mulone
Very Nice!.

2011/6/9 Luther Goh Lu Feng 

> Event starts today
>
> http://apac.pycon.org/
>
> (built with web2py goodness too!)




-- 
 http://martin.tecnodoc.com.ar


Re: [web2py] Re: amfrpc problem

2011-06-09 Thread Alexei Vinidiktov
I followed the instruction in the slice, but I keep getting the same error
message "AttributeError: 'Envelope' object has no attribute 'clientType'".

I'm on Windows, running web2py 1.95.1, Active Python 2.7 and Flash Builder
4.5

On Thu, Dec 2, 2010 at 2:54 AM, mdipierro  wrote:

> The domain must be specified in the flash app.
>
> http://www.web2pyslices.com/main/slices/take_slice/72
>
> I am not a flash expert myself anyway. Perhaps other people here can
> help more.
>
> Massimo
>
> On Dec 1, 5:25 pm, "dustin.b"  wrote:
> > thx for the quick answer!
> >
> > on the clintside i have the same error message. i forgot to mention
> > the w2p ticket
> >
> > with amfrpc:
> > Traceback (most recent call last):
> >   File "D:\DEV\python\web2py\1_89_5\web2py_src\web2py\gluon
> > \restricted.py", line 188, in restricted
> > exec ccode in environment
> >   File "D:/DEV/python/web2py/1_89_5/web2py_src/web2py/applications/
> > FlashSoldat_Server/controllers/default.py", line 63, in 
> >   File "D:\DEV\python\web2py\1_89_5\web2py_src\web2py\gluon
> > \globals.py", line 96, in 
> > self._caller = lambda f: f()
> >   File "D:/DEV/python/web2py/1_89_5/web2py_src/web2py/applications/
> > FlashSoldat_Server/controllers/default.py", line 61, in call
> > return service()
> >   File "D:\DEV\python\web2py\1_89_5\web2py_src\web2py\gluon\tools.py",
> > line 3647, in __call__
> > return self.serve_amfrpc()
> >   File "D:\DEV\python\web2py\1_89_5\web2py_src\web2py\gluon\tools.py",
> > line 3520, in serve_amfrpc
> > context = pyamf.get_context(pyamf.AMF0)
> > AttributeError: 'module' object has no attribute 'get_context'
> >
> > amfrpc3:
> > Traceback (most recent call last):
> >   File "D:\DEV\python\web2py\1_89_5\web2py_src\web2py\gluon
> > \restricted.py", line 188, in restricted
> > exec ccode in environment
> >   File "D:/DEV/python/web2py/1_89_5/web2py_src/web2py/applications/
> > FlashSoldat_Server/controllers/default.py", line 63, in 
> >   File "D:\DEV\python\web2py\1_89_5\web2py_src\web2py\gluon
> > \globals.py", line 96, in 
> > self._caller = lambda f: f()
> >   File "D:/DEV/python/web2py/1_89_5/web2py_src/web2py/applications/
> > FlashSoldat_Server/controllers/default.py", line 61, in call
> > return service()
> >   File "D:\DEV\python\web2py\1_89_5\web2py_src\web2py\gluon\tools.py",
> > line 3649, in __call__
> > return self.serve_amfrpc(3)
> >   File "D:\DEV\python\web2py\1_89_5\web2py_src\web2py\gluon\tools.py",
> > line 3523, in serve_amfrpc
> > pyamf_request.clientType)
> > AttributeError: 'Envelope' object has no attribute 'clientType'
> >
> > last but not least, what is the meaning of 'domain' in
> > @service.amfrpc3('domain') in contrast to the one with amfrpc, i
> > thought its some kind of renaming the function.
> >
> > On 2 Dez., 00:15, mdipierro  wrote:
> >
> > > Try use amf3
> >
> > > @service.amfrpc3('domain')
> > > def service1():
> > > return "test"
> >
> > > and
> >
> > > gateway.connect("
> http://127.0.0.1:8000/FlashSoldat_Server/default/call/
> > > amfrpc3/");
> >
> > > gateway.connect("http://127.0.0.1:8000/FlashSoldat_Server/default/
> > > call/amfrpc/");
> > > On Dec 1, 4:55 pm, "dustin.b"  wrote:
> >
> > > > hi,
> > > > im stuck in getting flash to work with (web2py) amfrpc. i must
> confess
> > > > that i am very limited in my flash knowledge so far.
> >
> > > > i tryed the sample from the book and getting into "import" problems.
> i
> > > > think this is related to the flash version. im using flash cs5 and
> > > > flashdevelop .. with as3.
> >
> > > > i installed pyamf so there is no "missing lib warning" if i invoke
> the
> > > > call/amfrpc (3) ; and running w2p from source. im a little confused
> > > > with the libs an the flash/flex side ... the only version i found
> > > > which is not causing "import errors" is the following
> >
> > > > public class Main extends MovieClip
> > > > {
> >
> > > > public function Main() {
> >
> > > > var gateway:NetConnection = new
> NetConnection();
> > > >
> gateway.addEventListener(NetStatusEvent.NET_STATUS  ,
> > > > gateway_status);
> > > > gateway.connect("
> http://127.0.0.1:8000/FlashSoldat_Server/default/
> > > > call/amfrpc/");
> > > > var resp:Responder = new
> Responder(show_results, on_fault);
> > > > gateway.call("service1", resp);
> >
> > > > trace("main started");
> > > > stage.stageWidth = 100;
> > > > stage.stageHeight = 100;
> >
> > > > var textlabel:TextField = new TextField();
> > > > textlabel.x = (stage.stageWidth -
> textlabel.width) / 2;
> > > > textlabel.y = (stage.stageHeight -
> textlabel.height) / 2;
> >
> > > > textlabel.text = "flex hello wold!";
> >
> > > > addChild(textlabel);

Re: [web2py] Re: amfrpc problem

2011-06-09 Thread Alexei Vinidiktov
And here is the traceback:


Traceback (most recent call last):

  File "C:\Users\Alexei\Dev\web2py\web2py\gluon\restricted.py", line
181, in restricted

exec ccode in environment

  File 
"C:\Users\Alexei\Dev\web2py\web2py\applications\amfrpctest\controllers/default.py",
line 59, in 

  File "C:\Users\Alexei\Dev\web2py\web2py\gluon\globals.py", line 133,
in 

self._caller = lambda f: f()

  File 
"C:\Users\Alexei\Dev\web2py\web2py\applications\amfrpctest\controllers/default.py",
line 52, in call

return service()

  File "C:\Users\Alexei\Dev\web2py\web2py\gluon\tools.py", line 3734,
in __call__

return self.serve_amfrpc(3)

  File "C:\Users\Alexei\Dev\web2py\web2py\gluon\tools.py", line 3608,
in serve_amfrpc

pyamf_request.clientType)
AttributeError: 'Envelope' object has no attribute 'clientType'


On Thu, Jun 9, 2011 at 2:22 PM, Alexei Vinidiktov <
alexei.vinidik...@gmail.com> wrote:

> I followed the instruction in the slice, but I keep getting the same error
> message "AttributeError: 'Envelope' object has no attribute 'clientType'".
>
> I'm on Windows, running web2py 1.95.1, Active Python 2.7 and Flash Builder
> 4.5
>
>
> On Thu, Dec 2, 2010 at 2:54 AM, mdipierro  wrote:
>
>> The domain must be specified in the flash app.
>>
>> http://www.web2pyslices.com/main/slices/take_slice/72
>>
>> I am not a flash expert myself anyway. Perhaps other people here can
>> help more.
>>
>> Massimo
>>
>> On Dec 1, 5:25 pm, "dustin.b"  wrote:
>> > thx for the quick answer!
>> >
>> > on the clintside i have the same error message. i forgot to mention
>> > the w2p ticket
>> >
>> > with amfrpc:
>> > Traceback (most recent call last):
>> >   File "D:\DEV\python\web2py\1_89_5\web2py_src\web2py\gluon
>> > \restricted.py", line 188, in restricted
>> > exec ccode in environment
>> >   File "D:/DEV/python/web2py/1_89_5/web2py_src/web2py/applications/
>> > FlashSoldat_Server/controllers/default.py", line 63, in 
>> >   File "D:\DEV\python\web2py\1_89_5\web2py_src\web2py\gluon
>> > \globals.py", line 96, in 
>> > self._caller = lambda f: f()
>> >   File "D:/DEV/python/web2py/1_89_5/web2py_src/web2py/applications/
>> > FlashSoldat_Server/controllers/default.py", line 61, in call
>> > return service()
>> >   File "D:\DEV\python\web2py\1_89_5\web2py_src\web2py\gluon\tools.py",
>> > line 3647, in __call__
>> > return self.serve_amfrpc()
>> >   File "D:\DEV\python\web2py\1_89_5\web2py_src\web2py\gluon\tools.py",
>> > line 3520, in serve_amfrpc
>> > context = pyamf.get_context(pyamf.AMF0)
>> > AttributeError: 'module' object has no attribute 'get_context'
>> >
>> > amfrpc3:
>> > Traceback (most recent call last):
>> >   File "D:\DEV\python\web2py\1_89_5\web2py_src\web2py\gluon
>> > \restricted.py", line 188, in restricted
>> > exec ccode in environment
>> >   File "D:/DEV/python/web2py/1_89_5/web2py_src/web2py/applications/
>> > FlashSoldat_Server/controllers/default.py", line 63, in 
>> >   File "D:\DEV\python\web2py\1_89_5\web2py_src\web2py\gluon
>> > \globals.py", line 96, in 
>> > self._caller = lambda f: f()
>> >   File "D:/DEV/python/web2py/1_89_5/web2py_src/web2py/applications/
>> > FlashSoldat_Server/controllers/default.py", line 61, in call
>> > return service()
>> >   File "D:\DEV\python\web2py\1_89_5\web2py_src\web2py\gluon\tools.py",
>> > line 3649, in __call__
>> > return self.serve_amfrpc(3)
>> >   File "D:\DEV\python\web2py\1_89_5\web2py_src\web2py\gluon\tools.py",
>> > line 3523, in serve_amfrpc
>> > pyamf_request.clientType)
>> > AttributeError: 'Envelope' object has no attribute 'clientType'
>> >
>> > last but not least, what is the meaning of 'domain' in
>> > @service.amfrpc3('domain') in contrast to the one with amfrpc, i
>> > thought its some kind of renaming the function.
>> >
>> > On 2 Dez., 00:15, mdipierro  wrote:
>> >
>> > > Try use amf3
>> >
>> > > @service.amfrpc3('domain')
>> > > def service1():
>> > > return "test"
>> >
>> > > and
>> >
>> > > gateway.connect("
>> http://127.0.0.1:8000/FlashSoldat_Server/default/call/
>> > > amfrpc3/");
>> >
>> > > gateway.connect("http://127.0.0.1:8000/FlashSoldat_Server/default/
>> > > call/amfrpc/");
>> > > On Dec 1, 4:55 pm, "dustin.b"  wrote:
>> >
>> > > > hi,
>> > > > im stuck in getting flash to work with (web2py) amfrpc. i must
>> confess
>> > > > that i am very limited in my flash knowledge so far.
>> >
>> > > > i tryed the sample from the book and getting into "import" problems.
>> i
>> > > > think this is related to the flash version. im using flash cs5 and
>> > > > flashdevelop .. with as3.
>> >
>> > > > i installed pyamf so there is no "missing lib warning" if i invoke
>> the
>> > > > call/amfrpc (3) ; and running w2p from source. im a little confused
>> > > > with the libs an the flash/flex side ... the only version i found
>> > > > which is not causing "import errors" is the following
>> >
>> > > > public class Main extends MovieClip
>> > > > {
>> >
>> > > > public functi

[web2py] BUG causes all error tickets to be unknown

2011-06-09 Thread selecta
I check out the latest web2py version from the hg
I created a "New simple application"

I modified the first menu item in models/menu.py
response.menu = [
(TAG['']('Index'), False,
URL(request.application,'default','index'), [])
]

this does not make sense, and is just for testing, actualy I want to
do something like
(TAG[''](IMG( _src = URL(request.application, 'static/ico','bug.png'),
_alt='bug'),'Issues'), False, issueurl , []),

now i created a bug by adding random characters in a controller ...
any bug will do

def index():
asdf
return dict()

this will cause all error tickets to appear like
Internal error
Ticket issued: unknown
the error will be displayed in the shell though

What is wrong? This used to work. How do i get the images back into
the menu?


Re: [web2py] BUG causes all error tickets to be unknown

2011-06-09 Thread Daniel Gonzalez
Im not working with the latest version, but sometimesn it happens to me,
and is because there's not write permissions on the /errors folder, or
because the  /errors folder does not exists.

I hope this help to you.

El jue, 09-06-2011 a las 03:28 -0700, selecta escribió:
> I check out the latest web2py version from the hg
> I created a "New simple application"
> 
> I modified the first menu item in models/menu.py
> response.menu = [
> (TAG['']('Index'), False,
> URL(request.application,'default','index'), [])
> ]
> 
> this does not make sense, and is just for testing, actualy I want to
> do something like
> (TAG[''](IMG( _src = URL(request.application, 'static/ico','bug.png'),
> _alt='bug'),'Issues'), False, issueurl , []),
> 
> now i created a bug by adding random characters in a controller ...
> any bug will do
> 
> def index():
> asdf
> return dict()
> 
> this will cause all error tickets to appear like
> Internal error
> Ticket issued: unknown
> the error will be displayed in the shell though
> 
> What is wrong? This used to work. How do i get the images back into
> the menu?




[web2py] help on a query

2011-06-09 Thread Manuele Pesenti

defining a table like that

db.define_table('power_curve',
Field('site', db.site, notnull=True, requires = IS_IN_DB(db,
'site.id', '%(name)s')),
Field('file_name', 'upload', uploadfield=True, notnull=True,
required=True),
Field('validity', 'date', default=datetime.date(1970, 1, 1), 
requires=IS_EMPTY_OR(IS_DATE(format='%d/%m/%Y'))

)

how can I select for each site id the last file name inserted?
I tryied this two query but they give the same result and they returns 
the first file name in each case:


db(db.power_curve).select(db.power_curve.site
db.power_curve.file_name,
db.power_curve.validity,
groupby=db.power_curve.site,
orderby=db.power_curve.site|~db.power_curve.start)

db(db.power_curve).select(db.power_curve.site
db.power_curve.file_name,
db.power_curve.validity,
groupby=db.power_curve.site,
orderby=db.power_curve.site|db.power_curve.start)

thank you

Manuele


Re: [web2py] help on a query

2011-06-09 Thread Vasile Ermicioi
db(db.power_curve).select(orderby=~db.power.id,
group_by=db.power_curve.site)


Re: [web2py] help on a query

2011-06-09 Thread Vasile Ermicioi
groupby instead of group_by


Re: [web2py] Re: orderby first, then limitby

2011-06-09 Thread Vasile Ermicioi
>
> I have a query that includes both orderby and limitby. What seems to happen
> is that the db returns some set of records as dictated by the limit and
> then
> orders the records in that set. So I pretty much get the same set every
> time
> even though I know the field being ordered has changed for various records.
> Is this how SQL works? Is there any way to order the whole set first and
> then return the sub-set?


what is you DAL Query ?


[web2py] Re: BUG causes all error tickets to be unknown

2011-06-09 Thread selecta
On Jun 9, 12:37 pm, Daniel Gonzalez  wrote:
> Im not working with the latest version, but sometimesn it happens to me,
> and is because there's not write permissions on the /errors folder, or
> because the  /errors folder does not exists.
no this is not the case for me, you can help by following my
instructions and reproducing this error
> I hope this help to you.
nop


[web2py] Re: Small toolbar bug in 1.96.3

2011-06-09 Thread Ross Peoples
No proxy, just default Ubuntu Server 10.04.2 with web2py trunk, plus pyodbc. 
No web server is installed on the machine and I am running it using python 
web2py.py -i 0.0.0.0 -a password -c cert.crt -k key.key, so I wonder if it 
has something to do with SSL? And the generic views have not been modified 
by me.

Re: [web2py] Re: New Features in Book

2011-06-09 Thread Martín Mulone
I proposed to massimo some ideas and improvements, regarding to this.

2011/6/9 cjrh 

> On Jun 9, 3:02 am, Stifan Kristi  wrote:
> > is the book has already been updated right now?
> > thank you
>
> I made some small fixes last night, if that is the kind of thing you
> mean.  If you mean to ask whether the book is completely up to date
> with the capabilities and features of the current stable web2py, the
> answer is probably "no", or more optimistically, "not yet".




-- 
 http://martin.tecnodoc.com.ar


[web2py] Re: PyCharm is going to support web2py

2011-06-09 Thread Ross Peoples
Not to start a holy war or anything, but I hear people talking all the time 
about how emacs or vim is the best code editor ever. Why is that? Does it do 
code completion or have some other really helpful feature that I just 
missed? I've used vim to edit text files, but editing code in a tiny console 
window just doesn't seem very friendly. Is there something I'm missing here?

Re: [web2py] Re: PyCharm is going to support web2py

2011-06-09 Thread Martín Mulone
intelliyole  Dmitry Jemerov
@
@rochacbruno  actually *web2py* support is
not on the PyCharm roadmap. the number of votes is not the only thing
driving our development plans


2011/6/9 Ross Peoples 

> Not to start a holy war or anything, but I hear people talking all the time
> about how emacs or vim is the best code editor ever. Why is that? Does it do
> code completion or have some other really helpful feature that I just
> missed? I've used vim to edit text files, but editing code in a tiny console
> window just doesn't seem very friendly. Is there something I'm missing here?




-- 
 http://martin.tecnodoc.com.ar


[web2py] Re: BUG causes all error tickets to be unknown

2011-06-09 Thread selecta
replacing TAG[''] with DIV solved the problem, but still it would be
nice to find out why this causes web2py to act this way


Re: [web2py] Re: web2py 1.96.4 is OUT

2011-06-09 Thread Pierre Thibault
2011/6/9 cjrh 

> On Thursday, 9 June 2011 03:03:51 UTC+2, Massimo Di Pierro wrote:
>>
>> Users who have an opinion please share it now. This is important.
>>
>
> Could you direct us to more details about the issue?My current
> understanding is shallow, but I agree with Pierre that platform-specific
> environment settings are very likely not the way to go here.   I much prefer
> all cross-platform issues to be handled with the "os" and sub modules.   Why
> can't we do that here?
>

It seems we have no developer with Windows where is the problem.



-- 


A+

-
Pierre
My blog and profile
(http://pierrethibault.posterous.com)
YouTube page 
(http://www.youtube.com/user/tubetib)
Twitter (http://twitter.com/pierreth2) 


Re: [web2py] Re: PyCharm is going to support web2py

2011-06-09 Thread Pierre Thibault
2011/6/9 Ross Peoples 

> Not to start a holy war or anything, but I hear people talking all the time
> about how emacs or vim is the best code editor ever. Why is that? Does it do
> code completion or have some other really helpful feature that I just
> missed? I've used vim to edit text files, but editing code in a tiny console
> window just doesn't seem very friendly. Is there something I'm missing here?



I think they are very powerful editors but they are also difficult to learn.
Emacs is too hard for me I believe.

I prefer Eclipse with Pydev because it is very integrated: editor, debugger,
static code analyzer, Mercurial commands in the contextual menu, access to
tickets from the editor, code coverage reports and more.

I documented the integration I did with Eclipse:
http://pierrethibault.posterous.com/?tag=web2py&page=2

These questions lead to very personal response.

-- 


A+

-
Pierre
My blog and profile
(http://pierrethibault.posterous.com)
YouTube page 
(http://www.youtube.com/user/tubetib)
Twitter (http://twitter.com/pierreth2) 


Re: Re: [web2py] Re: web2py 1.96.4 is OUT

2011-06-09 Thread caleb . hattingh

On , Pierre Thibault  wrote:

2011/6/9 cjrh caleb.hatti...@gmail.com>


On Thursday, 9 June 2011 03:03:51 UTC+2, Massimo Di Pierro wrote:Users  
who have an opinion please share it now. This is important.


Could you direct us to more details about the issue? My current  
understanding is shallow, but I agree with Pierre that platform-specific  
environment settings are very likely not the way to go here. I much  
prefer all cross-platform issues to be handled with the "os" and sub  
modules. Why can't we do that here?



It seems we have no developer with Windows where is the problem.


I am on Windows, still XP even. Is there a small zipped app that I could  
test quickly to see the problem?


[web2py] Re: Skype Group and/or IRC

2011-06-09 Thread LarryEitel
Thank you for the suggestion!!!
Request to join group sent. :)


Re: Re: [web2py] Re: web2py 1.96.4 is OUT

2011-06-09 Thread Pierre Thibault
2011/6/9 

> On , Pierre Thibault  wrote:
> > 2011/6/9 cjrh caleb.hatti...@gmail.com>
> >
> > On Thursday, 9 June 2011 03:03:51 UTC+2, Massimo Di Pierro wrote:Users
> who have an opinion please share it now. This is important.
> >
> > Could you direct us to more details about the issue?My current
> understanding is shallow, but I agree with Pierre that platform-specific
> environment settings are very likely not the way to go here.   I much prefer
> all cross-platform issues to be handled with the "os" and sub modules.   Why
> can't we do that here?
> >
> > It seems we have no developer with Windows where is the problem.
>
> I am on Windows, still XP even. Is there a small zipped app that I could
> test quickly to see the problem?


Sure, if you can debug code. Get code from the Mercurial repository. Debug
and submit the patch to Massimo. Look for the problem described by
Alessandro.

You'll find the information you need on the problem on the threads named
"web2py 1.96.*x* is OUT".

It is probably a bug with the code I wrote but I don't have a Windows
machine to debug a problem specific to this platform.

-- 


A+

-
Pierre
My blog and profile
(http://pierrethibault.posterous.com)
YouTube page 
(http://www.youtube.com/user/tubetib)
Twitter (http://twitter.com/pierreth2) 


[web2py] database access

2011-06-09 Thread anil manikyam
i created a database with tablename,fieldname
and i created a form-textbox in html language in views
how to compare these two things


[web2py] database

2011-06-09 Thread anil manikyam
created in html
login:
password:
when i entered the submit button it compare with the  values in
database.
if correct go to another page
send the web2py code 2 my email


[web2py] Re: vars vs. kwargs

2011-06-09 Thread Massimo Di Pierro
I do not understand. :-(

On Jun 9, 3:21 am, Pawel Jasinski  wrote:
> hi,
> it is cosmetic, but can be a pain for someone no so familiar with
> python.
> In examples for restful api:
>
> def index():
>     def GET(*args,**vars):
>         patterns = [
>             "/persons[person]",
>             "/{person.name.startswith}",
>             "/{person.name}/:field",
>             "/{person.name}/pets[pet.person]",
>             "/{person.name}/pet[pet.person]/{pet.name}",
>             "/{person.name}/pet[pet.person]/{pet.name}/:field"
>             ]
>         parser = db.parse_as_rest(patterns,args,vars)
>         if parser.status == 200:
>             return dict(content=parser.response)
>         else:
>             raise HTTP(parser.status,parser.error)
>     def POST(table_name,**vars):
>         if table_name == 'person':
>             return db.person.validate_and_insert(**vars)
>         elif table_name == 'pet':
>             return db.pet.validate_and_insert(**vars)
>         else:
>             raise HTTP(400)
>     return locals()
>
> after copy paste everything is ok, but the problem is waiting to
> happen ...
> vars hides built-in vars function.
>
> cheers,
> pawel


Re: Re: [web2py] Re: web2py 1.96.4 is OUT

2011-06-09 Thread cjrh
For anyone else following, the thread is 
here. 
  I am going to have a look at this.

Re: [web2py] Re: PyCharm is going to support web2py

2011-06-09 Thread Pierre Thibault
2011/6/9 Ross Peoples 

> Not to start a holy war or anything, but I hear people talking all the time
> about how emacs or vim is the best code editor ever. Why is that? Does it do
> code completion or have some other really helpful feature that I just
> missed? I've used vim to edit text files, but editing code in a tiny console
> window just doesn't seem very friendly. Is there something I'm missing here?


Here is a thread on the subject:
http://groups.google.com/group/montrealpython/browse_thread/thread/87a05b7188e28168/2dc66732948da2ba?lnk=gst&q=eclipse#2dc66732948da2ba

-- 


A+

-
Pierre
My blog and profile
(http://pierrethibault.posterous.com)
YouTube page 
(http://www.youtube.com/user/tubetib)
Twitter (http://twitter.com/pierreth2) 


[web2py] Re: orderby first, then limitby

2011-06-09 Thread Massimo Di Pierro
Limitby should be executed after olderby. Are you sure that is not the
case? What DB?

On Jun 9, 2:52 am, pbreit  wrote:
> I have a query that includes both orderby and limitby. What seems to happen
> is that the db returns some set of records as dictated by the limit and then
> orders the records in that set. So I pretty much get the same set every time
> even though I know the field being ordered has changed for various records.
> Is this how SQL works? Is there any way to order the whole set first and
> then return the sub-set?


[web2py] Web2Py & RoR performances

2011-06-09 Thread Alexandre Strzelewicz
Hi,

I learned Web2Py and I'm learning Ruby on Rails.

Is Ruby on Rails faster than Web2py ?

It seems web2py open/read/close each files (db.py, controller...) to
render a page (including all partials, layout...).

Ruby Rails seems to cache all this files into memory, so it's faster.

Any note about that ?

Thanks





[web2py] Re: database

2011-06-09 Thread Massimo Di Pierro
Not sure if you have a question for us. Good to have you on board :-)

On Jun 9, 7:54 am, anil manikyam  wrote:
> created in html
> login:
> password:
> when i entered the submit button it compare with the  values in
> database.
> if correct go to another page
> send the web2py code 2 my email


Re: Re: [web2py] Re: web2py 1.96.4 is OUT

2011-06-09 Thread Massimo Di Pierro
So you suggest removing the case insensitive flag that was added in 1.96.4?

Re: Re: Re: [web2py] Re: web2py 1.96.4 is OUT

2011-06-09 Thread caleb . hattingh

On , Massimo Di Pierro  wrote:
So you suggest removing the case insensitive flag that was added in  
1.96.4?


Yes. In Alessandro's specific case, he should use:

import app.Castalia.blah.blah.castialia

and all will be fine.


Re: Re: [web2py] Re: web2py 1.96.4 is OUT

2011-06-09 Thread Anthony
But in a web2py app, you would have something like 
/applications/Cast/modules/cast.py, and in your code you would just do 
'import cast'. My understanding of the problem is that in that case, the new 
web2py importer tries to import applications.cast.modules.cast instead of 
applications.Cast.modules.cast, which results in an import error. In fact, I 
cannot actually reproduce that problem (Windows 7, Python 2.7, web2py 
1.96.3) -- if I capitalize the name of the application folder, the web2py 
importer still appears to work. So, as far as I can tell, the importer 
works, even without the fix in trunk, though maybe I have misunderstood the 
problem.
 
Anthony

On Thursday, June 9, 2011 10:03:01 AM UTC-4, cjrh wrote: 

> Ok, so here is the thing: it appears that on Windows, everything works if 
> the capitalization of the import statement matches the capitalization of the 
> folder structure. 
>
> Consider this folder structure (and there is an __init__.py in each folder 
> hierarchy): 
>
>  /app/Cast/inner/cast.py
>
>
> In my file /test_imp.py, these contents WORK:
>
>  try:
>  import app.Cast.inner.cast
>  print 'Pass'
>  except:
>  print 'Fail'
>  pass
>
>
> These contents FAIL:
>
>  try:
>  import app.cast.inner.cast
>  print 'Pass'
>  except:
>  print 'Fail'
>  pass
>
>
> If, however, I change the folder structure to this:
>
>  /app/cast/inner/cast.py
>
>
> Then I get *exactly opposite results*.  In other words, the capitalization 
> of the import path in the python file and on the file system must exactly 
> match.  This is on Windows XP x64 SP2.  I have attached my test.
>
> In my opinion, we should just document that the cast must match.  Note that 
> this issue has *nothing to do with web2py*, and as a Windows user, I am 
> not too surprised by this behaviour anyway.
>


[web2py] Re: Web2Py & RoR performances

2011-06-09 Thread Massimo Di Pierro
web2py is 3x - 10x faster because the python interpreter is faster
then ruby. The bottle neck is always the database anyway.

On Jun 9, 9:07 am, Bruno Rocha  wrote:
> In web2py you can cache anything in RAM or use memcache.
> Em 09/06/2011 10:40, "Alexandre Strzelewicz" <
> strzelewicz.alexan...@gmail.com> escreveu:
>
>
>
>
>
>
>
> > Hi,
>
> > I learned Web2Py and I'm learning Ruby on Rails.
>
> > Is Ruby on Rails faster than Web2py ?
>
> > It seems web2py open/read/close each files (db.py, controller...) to
> > render a page (including all partials, layout...).
>
> > Ruby Rails seems to cache all this files into memory, so it's faster.
>
> > Any note about that ?
>
> > Thanks


Re: Re: [web2py] Re: web2py 1.96.4 is OUT

2011-06-09 Thread cjrh

On Thursday, 9 June 2011 16:03:01 UTC+2, cjrh wrote:
>
> In my opinion, we should just document that the cast must match.  Note that 
> this issue has *nothing to do with web2py*, and as a Windows user, I am 
> not too surprised by this behaviour anyway.
>

...should just document that the *case *must match. 

(Sorry for any confusion)


Re: [web2py] Re: vars vs. kwargs

2011-06-09 Thread Pawel Jasinski
hi,
sorry for being to cryptic.

In [1]: def foo(*args,**kwargs):
   ...: print vars
   ...:
   ...:

In [2]: foo()


In [3]: def bar(*args,**vars):
   ...: print vars
   ...:
   ...:

In [4]: bar()
{}

ref: http://docs.python.org/library/functions.html#vars
as I said, it is cosmetic. I believe it is a bad idea to give variable
a name which matches name of the build-in function

cheers,
pawel

On Thu, Jun 9, 2011 at 3:26 PM, Massimo Di Pierro
 wrote:
> I do not understand. :-(
>
> On Jun 9, 3:21 am, Pawel Jasinski  wrote:
>> hi,
>> it is cosmetic, but can be a pain for someone no so familiar with
>> python.
>> In examples for restful api:
>>
>> def index():
>>     def GET(*args,**vars):
>>         patterns = [
>>             "/persons[person]",
>>             "/{person.name.startswith}",
>>             "/{person.name}/:field",
>>             "/{person.name}/pets[pet.person]",
>>             "/{person.name}/pet[pet.person]/{pet.name}",
>>             "/{person.name}/pet[pet.person]/{pet.name}/:field"
>>             ]
>>         parser = db.parse_as_rest(patterns,args,vars)
>>         if parser.status == 200:
>>             return dict(content=parser.response)
>>         else:
>>             raise HTTP(parser.status,parser.error)
>>     def POST(table_name,**vars):
>>         if table_name == 'person':
>>             return db.person.validate_and_insert(**vars)
>>         elif table_name == 'pet':
>>             return db.pet.validate_and_insert(**vars)
>>         else:
>>             raise HTTP(400)
>>     return locals()
>>
>> after copy paste everything is ok, but the problem is waiting to
>> happen ...
>> vars hides built-in vars function.
>>
>> cheers,
>> pawel


Re: [web2py] Web2Py & RoR performances

2011-06-09 Thread Bruno Rocha
In web2py you can cache anything in RAM or use memcache.
Em 09/06/2011 10:40, "Alexandre Strzelewicz" <
strzelewicz.alexan...@gmail.com> escreveu:
> Hi,
>
> I learned Web2Py and I'm learning Ruby on Rails.
>
> Is Ruby on Rails faster than Web2py ?
>
> It seems web2py open/read/close each files (db.py, controller...) to
> render a page (including all partials, layout...).
>
> Ruby Rails seems to cache all this files into memory, so it's faster.
>
> Any note about that ?
>
> Thanks
>
>
>


[web2py] web2py 1.96.4 - Blocks in View not working

2011-06-09 Thread contatogilson...@gmail.com
I use the blocks to couple eating several portions of the layout pages for
quite a while.Only in this last version is not working.

layout.html

> {{ block test }}{{ end }}


test.html

> {{ extend 'layout.html' }}



> {{ block test }}
> It is working
> {{ end }}


When I run the application, it displays nothing.
_
*Gilson Filho*
*Web Developer
http://gilsondev.com*


Re: Re: Re: [web2py] Re: web2py 1.96.4 is OUT

2011-06-09 Thread Anthony
On Thursday, June 9, 2011 10:18:41 AM UTC-4, cjrh wrote: 
>
> On , Massimo Di Pierro  wrote:
> > So you suggest removing the case insensitive flag that was added in 
> 1.96.4?
>
> Yes. In Alessandro's specific case, he should use:
>
> import app.Castalia.blah.blah.castialia

 
But shouldn't he be able to just do 'import castalia' and have it work 
(again, for me it actually does work on Windows, but assuming it doesn't 
work on some systems, shouldn't it be fixed)?
 
Anthony


Re: Re: Re: Re: [web2py] Re: web2py 1.96.4 is OUT

2011-06-09 Thread caleb . hattingh

On , Anthony  wrote:

On Thursday, June 9, 2011 10:18:41 AM UTC-4, cjrh wrote:
On , Massimo Di Pierro massim...@gmail.com> wrote:
> So you suggest removing the case insensitive flag that was added in  
1.96.4?



Yes. In Alessandro's specific case, he should use:



import app.Castalia.blah.blah.castialia


But shouldn't he be able to just do 'import castalia' and have it work  
(again, for me it actually does work on Windows, but assuming it doesn't  
work on some systems, shouldn't it be fixed)?


The issue seems to appear only when there is a repeated name in the chain.  
Could you test that too? My attachment has such a test-case ready to run.  
It seems that when a name is not repeated, the case-insensitive name  
matching works. This smells like a bug in Python, and probably needs to be  
fixed there.


[web2py] Re: vars vs. kwargs

2011-06-09 Thread Massimo Di Pierro
Now I understand. It is a problem witg the example. Will fix it.

On Jun 9, 9:24 am, Pawel Jasinski  wrote:
> hi,
> sorry for being to cryptic.
>
> In [1]: def foo(*args,**kwargs):
>    ...:     print vars
>    ...:
>    ...:
>
> In [2]: foo()
> 
>
> In [3]: def bar(*args,**vars):
>    ...:     print vars
>    ...:
>    ...:
>
> In [4]: bar()
> {}
>
> ref:http://docs.python.org/library/functions.html#vars
> as I said, it is cosmetic. I believe it is a bad idea to give variable
> a name which matches name of the build-in function
>
> cheers,
> pawel
>
> On Thu, Jun 9, 2011 at 3:26 PM, Massimo Di Pierro
>
>
>
>
>
>
>
>  wrote:
> > I do not understand. :-(
>
> > On Jun 9, 3:21 am, Pawel Jasinski  wrote:
> >> hi,
> >> it is cosmetic, but can be a pain for someone no so familiar with
> >> python.
> >> In examples for restful api:
>
> >> def index():
> >>     def GET(*args,**vars):
> >>         patterns = [
> >>             "/persons[person]",
> >>             "/{person.name.startswith}",
> >>             "/{person.name}/:field",
> >>             "/{person.name}/pets[pet.person]",
> >>             "/{person.name}/pet[pet.person]/{pet.name}",
> >>             "/{person.name}/pet[pet.person]/{pet.name}/:field"
> >>             ]
> >>         parser = db.parse_as_rest(patterns,args,vars)
> >>         if parser.status == 200:
> >>             return dict(content=parser.response)
> >>         else:
> >>             raise HTTP(parser.status,parser.error)
> >>     def POST(table_name,**vars):
> >>         if table_name == 'person':
> >>             return db.person.validate_and_insert(**vars)
> >>         elif table_name == 'pet':
> >>             return db.pet.validate_and_insert(**vars)
> >>         else:
> >>             raise HTTP(400)
> >>     return locals()
>
> >> after copy paste everything is ok, but the problem is waiting to
> >> happen ...
> >> vars hides built-in vars function.
>
> >> cheers,
> >> pawel


[web2py] Re: web2py 1.96.4 - Blocks in View not working

2011-06-09 Thread Massimo Di Pierro
Can you tell me which is the last version that worked? I do no think
we changed anything there recently.

On Jun 9, 9:02 am, "contatogilson...@gmail.com"
 wrote:
> I use the blocks to couple eating several portions of the layout pages for
> quite a while.Only in this last version is not working.
>
> layout.html
>
> > {{ block test }}{{ end }}
>
> test.html
>
> > {{ extend 'layout.html' }}
> > {{ block test }}
> >     It is working
> > {{ end }}
>
> When I run the application, it displays nothing.
> _
> *Gilson Filho*
> *Web Developerhttp://gilsondev.com*


[web2py] Re: web2py 1.96.4 is OUT

2011-06-09 Thread Massimo Di Pierro
It works for you because of the temporary fix (ignore capitalization).
What Pierre and Caleb are saying is that it should NOT work if you get
capitalization wrong.

On Jun 9, 9:25 am, Anthony  wrote:
> On Thursday, June 9, 2011 10:18:41 AM UTC-4, cjrh wrote:
>
> > On , Massimo Di Pierro  wrote:
> > > So you suggest removing the case insensitive flag that was added in
> > 1.96.4?
>
> > Yes. In Alessandro's specific case, he should use:
>
> > import app.Castalia.blah.blah.castialia
>
> But shouldn't he be able to just do 'import castalia' and have it work
> (again, for me it actually does work on Windows, but assuming it doesn't
> work on some systems, shouldn't it be fixed)?
>
> Anthony


[web2py] Re: database

2011-06-09 Thread Anthony
On Thursday, June 9, 2011 8:54:07 AM UTC-4, anil manikyam wrote: 
>
> created in html 
> login: 
> password: 
> when i entered the submit button it compare with the  values in 
> database. 
> if correct go to another page 
> send the web2py code 2 my email

 
Are you asking how to do this? If so, look at 
http://web2py.com/book/default/chapter/08#Authentication (note, the relevant 
code is already set up for you in the 'welcome' app -- auth is defined in 
/models/db.py, the auth actions are handled by the user() function in 
/controllers/default.py, and the view is in /views/default/user.html). By 
default, after login, it redirects to /default/index, but you can change 
that by setting auth.settings.login_next (see 
http://web2py.com/book/default/chapter/08#Settings-and-Messages).
 
Anthony


Re: Re: [web2py] Re: web2py 1.96.4 is OUT

2011-06-09 Thread cjrh
On Thursday, 9 June 2011 16:22:10 UTC+2, Anthony wrote:
>
> importer still appears to work. So, as far as I can tell, the importer 
> works, even without the fix in trunk, though maybe I have misunderstood the 
> problem.
>

Yes, it is confusing.  The case-insensitivity works only until a name is 
repeated in the import chain.  When that occurs, it fails.


Re: [web2py] Re: web2py 1.96.4 - Blocks in View not working

2011-06-09 Thread contatogilson...@gmail.com
I think it was in version 1.94.1 to 1.95.1
_
*Gilson Filho*
*Web Developer
http://gilsondev.com*



2011/6/9 Massimo Di Pierro 

> Can you tell me which is the last version that worked? I do no think
> we changed anything there recently.
>
> On Jun 9, 9:02 am, "contatogilson...@gmail.com"
>  wrote:
> > I use the blocks to couple eating several portions of the layout pages
> for
> > quite a while.Only in this last version is not working.
> >
> > layout.html
> >
> > > {{ block test }}{{ end }}
> >
> > test.html
> >
> > > {{ extend 'layout.html' }}
> > > {{ block test }}
> > > It is working
> > > {{ end }}
> >
> > When I run the application, it displays nothing.
> > _
> > *Gilson Filho*
> > *Web Developerhttp://gilsondev.com*


Re: Re: [web2py] Re: web2py 1.96.4 is OUT

2011-06-09 Thread cjrh
On Thursday, 9 June 2011 16:22:10 UTC+2, Anthony wrote:
>
> But in a web2py app, you would have something like 
> /applications/Cast/modules/cast.py, and in your code you would just do 
> 'import cast'. My understanding of the problem is that in that case, the new 
> web2py importer tries to import applications.cast.modules.cast instead of 
> applications.Cast.modules.cast, which results in an import error. 
>

Yes, this is a good point.   I shall take a gander at Pierre's 
custom_import.py if I get some time later.  I didn't realise the import path 
chain was being generated by web2py.  That makes it our responsibility to 
fix. 


[web2py] Re: web2py 1.96.4 is OUT

2011-06-09 Thread Anthony
On Thursday, June 9, 2011 10:29:40 AM UTC-4, Massimo Di Pierro wrote: 
>
> It works for you because of the temporary fix (ignore capitalization). 
> What Pierre and Caleb are saying is that it should NOT work if you get 
> capitalization wrong.

 
No, I'm testing with 1.96.3, which is before the fix. And for me it does 
fail if I get the capitalization wrong. However, it does not fail for me if 
I simply capitalize the name of the application folder (I do not explicitly 
include the application folder in the import statement -- the web2py 
importer handles that, and appears to get it right, at least for me).
 
Anthony


Re: [web2py] help on a query

2011-06-09 Thread Manuele Pesenti

On 09/06/2011 12:50, Vasile Ermicioi wrote:

db(db.power_curve).select(orderby=~db.power.id,
group_by=db.power_curve.site)


no, it doesn't get the expected result

at the moment I solved filtering the query in a second time using 
another query that involves a max function:


last_pc = db.power_curve.validity.max()

sites = db(db.power_curve).select(
orderby=db.power_curve.site)

sites_selection = sites.find(lambda row: (row.site.id,
row.power_curve.start, ) in \
db(db.power_curve).select(db.power_curve.site, last_pc,
groupby=db.power_curve.site).response)


Re: Re: [web2py] Re: web2py 1.96.4 is OUT

2011-06-09 Thread Anthony
On Thursday, June 9, 2011 10:40:19 AM UTC-4, cjrh wrote: 
>
> On Thursday, 9 June 2011 16:22:10 UTC+2, Anthony wrote: 
>>
>> importer still appears to work. So, as far as I can tell, the importer 
>> works, even without the fix in trunk, though maybe I have misunderstood the 
>> problem.
>>
>
> Yes, it is confusing.  The case-insensitivity works only until a name is 
> repeated in the import chain.  When that occurs, it fails.
>
 
Do you have an app to reproduce the problem? I created an app named 
"Castalia" (note the capitalization) with a module 
/modules/selfgroup/castalia/config.py, which I think is the same structure 
and naming as Alessandro's app. In a controller action, I then did:
 
from selfgroup.castalia import config
 
and it seems to work fine, though I believe Alessandro was getting an import 
error at that point. But maybe I'm missing something.
 
Anthony


[web2py] import error debian package

2011-06-09 Thread Stavros
Has anyone who has used latest debian package been able to import
modules while keeping the application self contained?  I have the
traceback from another user's application.

First line of default.py
question_maker = local_import('question_maker')

then when you run it...

Traceback (most recent call last):
 File "/usr/lib/pymodules/python2.6/gluon/restricted.py", line 192,
in restricted
   exec ccode in environment
 File "/home/jelkner/web2py/applications/mathquiz/controllers/
default.py",
line 1, in 
   question_maker = local_import('question_maker')
 File "/usr/lib/pymodules/python2.6/gluon/compileapp.py", line 246, in

   local_import_aux(name,reload,app)
 File "/usr/lib/pymodules/python2.6/gluon/compileapp.py", line 177,
in local_import_aux
   module = __import__(name)
 File "/usr/lib/pymodules/python2.6/gluon/custom_import.py", line
280, in __call__
   fromlist, level)
 File "/usr/lib/pymodules/python2.6/gluon/custom_import.py", line 75,
in __call__
   level)
ImportError: No module named mathquiz.modules.question_maker


[web2py] Re: vars vs. kwargs

2011-06-09 Thread Massimo Di Pierro
fixed in trunk. Thanks


On Jun 9, 9:24 am, Pawel Jasinski  wrote:
> hi,
> sorry for being to cryptic.
>
> In [1]: def foo(*args,**kwargs):
>    ...:     print vars
>    ...:
>    ...:
>
> In [2]: foo()
> 
>
> In [3]: def bar(*args,**vars):
>    ...:     print vars
>    ...:
>    ...:
>
> In [4]: bar()
> {}
>
> ref:http://docs.python.org/library/functions.html#vars
> as I said, it is cosmetic. I believe it is a bad idea to give variable
> a name which matches name of the build-in function
>
> cheers,
> pawel
>
> On Thu, Jun 9, 2011 at 3:26 PM, Massimo Di Pierro
>
>
>
>
>
>
>
>  wrote:
> > I do not understand. :-(
>
> > On Jun 9, 3:21 am, Pawel Jasinski  wrote:
> >> hi,
> >> it is cosmetic, but can be a pain for someone no so familiar with
> >> python.
> >> In examples for restful api:
>
> >> def index():
> >>     def GET(*args,**vars):
> >>         patterns = [
> >>             "/persons[person]",
> >>             "/{person.name.startswith}",
> >>             "/{person.name}/:field",
> >>             "/{person.name}/pets[pet.person]",
> >>             "/{person.name}/pet[pet.person]/{pet.name}",
> >>             "/{person.name}/pet[pet.person]/{pet.name}/:field"
> >>             ]
> >>         parser = db.parse_as_rest(patterns,args,vars)
> >>         if parser.status == 200:
> >>             return dict(content=parser.response)
> >>         else:
> >>             raise HTTP(parser.status,parser.error)
> >>     def POST(table_name,**vars):
> >>         if table_name == 'person':
> >>             return db.person.validate_and_insert(**vars)
> >>         elif table_name == 'pet':
> >>             return db.pet.validate_and_insert(**vars)
> >>         else:
> >>             raise HTTP(400)
> >>     return locals()
>
> >> after copy paste everything is ok, but the problem is waiting to
> >> happen ...
> >> vars hides built-in vars function.
>
> >> cheers,
> >> pawel


Re: Re: Re: [web2py] Re: web2py 1.96.4 is OUT

2011-06-09 Thread caleb . hattingh

On , Anthony  wrote:
Do you have an app to reproduce the problem? I created an app  
named "Castalia" (note the capitalization) with a module  
/modules/selfgroup/castalia/config.py, which I think is the same  
structure and naming as Alessandro's app. In a controller action, I then  
did:



from selfgroup.castalia import config


and it seems to work fine, though I believe Alessandro was getting an  
import error at that point. But maybe I'm missing something.


I think we should ask him to make a small test app for us that demonstrates  
the problem. Else we're guessing.


[web2py] Re: import error debian package

2011-06-09 Thread Massimo Di Pierro
can you check the file is there and __init__.py is in every parent
folder?

On Jun 9, 10:01 am, Stavros  wrote:
> Has anyone who has used latest debian package been able to import
> modules while keeping the application self contained?  I have the
> traceback from another user's application.
>
> First line of default.py
> question_maker = local_import('question_maker')
>
> then when you run it...
>
> Traceback (most recent call last):
>  File "/usr/lib/pymodules/python2.6/gluon/restricted.py", line 192,
> in restricted
>    exec ccode in environment
>  File "/home/jelkner/web2py/applications/mathquiz/controllers/
> default.py",
> line 1, in 
>    question_maker = local_import('question_maker')
>  File "/usr/lib/pymodules/python2.6/gluon/compileapp.py", line 246, in
> 
>    local_import_aux(name,reload,app)
>  File "/usr/lib/pymodules/python2.6/gluon/compileapp.py", line 177,
> in local_import_aux
>    module = __import__(name)
>  File "/usr/lib/pymodules/python2.6/gluon/custom_import.py", line
> 280, in __call__
>    fromlist, level)
>  File "/usr/lib/pymodules/python2.6/gluon/custom_import.py", line 75,
> in __call__
>    level)
> ImportError: No module named mathquiz.modules.question_maker


[web2py] custom form dspval question

2011-06-09 Thread wdtatenh
Apologies didn't see this anywhere that showed a clear example of what
I'm asking about.

Have custom form - using inpval, dspval, etc. and would like to know
if there is specific formatting that allows me to set form field
properties?

this part I get:  {{=dspval.my_field_name}}

My question is using the custom.form, is there a notation that allows
me to do something like:
1. set the width e.g., style="width:200px;"
2. set a form text field to be hidden instead of visible
3. assign a field validator e.g., IS_EMAIL

Thanks in advance.


[web2py] Re: import error debian package

2011-06-09 Thread Jeff Elkner
We copy the math_quiz directory and all its contents from a source install 
of web2py, where it works, to the application directory of a user created by 
the debian package, where it gives the error above.

Three of us have confirmed this on three separate installations.  We are 
pretty confident it is an error with the way the package works.



[web2py] Question about superfish menu and roles

2011-06-09 Thread salbefe
Hello,

I would like to use the superfish menu that is on the welcome
application but showing only some links depending the role the user
has. Is that possible??

Thanks in advance


[web2py] Re: orderby first, then limitby

2011-06-09 Thread pbreit
Yes, I believe that's what's happening but I was hoping to order the set 
first and then return the sub-set.

For example, if I have:
7, 5, 2, 9, 6, 3, 4, 8

And I want the 3 lowest values: 2, 3, 4. Instead I get 2, 5, 7 (7, 5, 2 
sorted)(I think).


Re: [web2py] Re: import error debian package

2011-06-09 Thread José Luis Redrejo Rodríguez
2011/6/9 Jeff Elkner :
> We copy the math_quiz directory and all its contents from a source install
> of web2py, where it works, to the application directory of a user created by
> the debian package, where it gives the error above.
>
> Three of us have confirmed this on three separate installations.  We are
> pretty confident it is an error with the way the package works.
>
>

Could you give me a part of the code to test it in the package. I
guess it's a permission problem.

Regards.


[web2py] Re: orderby first, then limitby

2011-06-09 Thread Massimo Di Pierro
items should be sorted when groups, unless you want to sort by a
condition different than the groups. You can do that as well but you
need to give a concrete model example and data example.

On Jun 9, 11:21 am, pbreit  wrote:
> Yes, I believe that's what's happening but I was hoping to order the set
> first and then return the sub-set.
>
> For example, if I have:
> 7, 5, 2, 9, 6, 3, 4, 8
>
> And I want the 3 lowest values: 2, 3, 4. Instead I get 2, 5, 7 (7, 5, 2
> sorted)(I think).


[web2py] Re: Web2Py & RoR performances

2011-06-09 Thread Ross Peoples
This was a while ago, and I cannot find my source at the moment, but I 
recall reading a benchmark done that put RoR faster than PHP, but slower 
than Python by a large margin (without server-side caching and other 
performance tweaks). If I find the original article or maybe a more recent 
one on the subject of performance, I'll be sure to share it.

[web2py] Re: How to implement flags?

2011-06-09 Thread howesc
also keep in mind your datastore.  more fields on a SQL table can get 
unwieldy for the SQL engine. GAE prefers many fields to joins as you can't 
do joins there.  lists for flags just seems unwieldy in either environment.

bitwise operations seem super-slick and cool, but do they make the code 
harder to maintain?

cfh


[web2py] Re: Offtopic: Who's at Pycon APAC?

2011-06-09 Thread Luther Goh Lu Feng
As pointed out by Massimo, the site is built with conf2py
http://code.google.com/p/conf2py/

On Jun 9, 6:06 pm, Martín Mulone  wrote:
> Very Nice!.
>
> 2011/6/9 Luther Goh Lu Feng 
>
> > Event starts today
>
> >http://apac.pycon.org/
>
> > (built with web2py goodness too!)
>
> --
>  http://martin.tecnodoc.com.ar


[web2py] Re: Web2Py & RoR performances

2011-06-09 Thread Plumo
how is Python 3-10x faster than Ruby?

[web2py] Re: Question about superfish menu and roles

2011-06-09 Thread pbreit
Yes, you can create whatever menus you want. The welcome app provides menus 
that are described in a models file but you can describe a a different menu 
or describe a menu in a controller or module. Just follow the patterns you 
see in the welcome code:

response.my_menu=[(T('Resources'), False, None,
 [
(T('Documentation'), False, 'http://www.web2py.com/book',
[
(T('Preface'), False, 
'http://www.web2py.com/book/default/chapter/00'),
(T('Introduction'), False, 
'http://www.web2py.com/book/default/chapter/01'),
]),
  ]
   )]


And then in your view:
{{=MENU(response.my_menu, _class='sf-menu')}}


[web2py] Re: Web2Py & RoR performances

2011-06-09 Thread pbreit
This is probably not a discussion we want to start. While Python may have a 
small performance edge, it's nothing to get excited about. Likewise, the OP 
makes performance assumptions that may not be realistic. As I thought 
everyone knew, there are quite a few variables that go in to overall system 
performance. Database, caching and coding optimizations are as important or 
more than how the framework works.

That said, Massimo and the group have demonstrated a commitment to 
performance so if you have any specific recommendations or, better, code, 
I'm sure they'd be happy to consider.


[web2py] Re: database access

2011-06-09 Thread pbreit
We might more detail about what you are trying to do including some code 
samples.

[web2py] db.define_tables

2011-06-09 Thread Vineet
Hi !

Below given is a table ---

db.define_table('ac',
Field('acnm','string', IS_LENGTH(100), length=100, required=True),
Field('acgrpid', db.acgrp, notnull=True, required=True),
Field('active', 'string', IS_LENGTH(1), length=1,
requires=IS_LENGHT(1), default='Y', required=True,  notnull=True),
Field('homeunit', db.unit, notnull=True, required=True),
Field('showall', 'string',IS_LENGTH(1), length=1,
requires=IS_LENGHT(1), default='Y', required=True,
notnull=True),
migrate=False
)


--- In the Field 'active', I have written --- required=True,
notnull=True.
>From the documentation, the purpose of "required" is understood.
1) But where does "notnull" come in action? (whether in AJAX
validation or while DAL inserts or somewhere else).

2) For the Field 'active', I want to have a set of 2 values ('Y' &
'N').
In FORM, the user would be able to select a value from these 2 values
ONLY. (default is 'Y').
How do I do it?

Thanks,
Vineet


[web2py] Re: db.define_tables

2011-06-09 Thread Anthony
On Thursday, June 9, 2011 1:01:02 PM UTC-4, Vineet wrote: 
>
> Hi ! 
>
> Below given is a table --- 
>  
> db.define_table('ac', 
> Field('acnm','string', IS_LENGTH(100), length=100, required=True), 
> Field('acgrpid', db.acgrp, notnull=True, required=True), 
> Field('active', 'string', IS_LENGTH(1), length=1, 
> requires=IS_LENGHT(1), default='Y', required=True,  notnull=True), 
> Field('homeunit', db.unit, notnull=True, required=True), 
> Field('showall', 'string',IS_LENGTH(1), length=1, 
> requires=IS_LENGHT(1), default='Y', required=True, 
> notnull=True), 
> migrate=False 
> ) 
>  
>
> --- In the Field 'active', I have written --- required=True, 
> notnull=True. 
> From the documentation, the purpose of "required" is understood. 
> 1) But where does "notnull" come in action? (whether in AJAX 
> validation or while DAL inserts or somewhere else).

 
'required' is enforced by the DAL, and notnull is enforced by the database 
itself (it is equivalent to the "NOT NULL" SQL statement). Note, because 
notnull affects the actual database table, I think changing it requires 
migrations to be on.
 

>
> 2) For the Field 'active', I want to have a set of 2 values ('Y' & 
> 'N'). 
> In FORM, the user would be able to select a value from these 2 values 
> ONLY. (default is 'Y').

 
Use requires=IS_IN_SET(['Y','N']). In that case, you won't have to bother 
with IS_LENGTH.
 
Anthony
 


Re: [web2py] Re: vars vs. kwargs

2011-06-09 Thread Stifan Kristi
pardon me, what is the meaning of *args and **vars?
thank you.


[web2py] Re: Project: pydev extension for web2py in Eclipse

2011-06-09 Thread Álvaro J . Iradier
After some talking to the Pydev author, we've managed to make a patch
to a file in Pydev that calls the build_environment() and
run_models_in() functions from web2py, and adds the resulting
environment into the __builtins__. The result is you "automagically"
get a fully working web2py environment in eclipse, with
autocompletion, etc.

You can follow the development on this feature request on Pydev issue
tracker:

https://sourceforge.net/tracker/?func=detail&atid=577332&aid=3294887&group_id=85796

The procedure is quite manual yet, I hope it can be improved so it is
customizable per project.

Comments and help are welcome!


Greets.

On 29 abr, 10:51, Álvaro J. Iradier 
wrote:
> Hi,
>
> I am trying to develop an extension (a Jython script[1]) for Pydev[2] to
> improve web2py integration into Eclipse (I'm not sattisfied with the
> existing recipes).
>
> I've just started, and you can follow what's going on on the following
> thread in the Pydev-code mailing list:
>
> https://sourceforge.net/mailarchive/forum.php?thread_name=BANLkTik-Sj...
>
> If someone is interested on helping, please let me know, I don't have much
> time available to work on it.
>
> Greets.
>
> [1]http://pydev.org/manual_articles_scripting.html
> [2]http://pydev.org/
>
> --
> Álvaro J. Iradier Muro
> Departamento de Desarrollo
> alvaro.irad...@polartech.es
>
> Polar Technologies
> T +34 976 527 952
> F +34 976 466 125www.polartech.es
>
> Antes de imprimir este mensaje, por favor, compruebe que es verdaderamente
> necesario. El medioambiente es cosa de todos.
>
> AVISO LEGAL
> Este mensaje, y en su caso, cualquier fichero anexo al mismo, puede contener
> información confidencial, siendo para uso exclusivo del destinatario,
> quedando prohibida su divulgación, copia o distribución a terceros sin la
> autorización expresa del remitente. Si Vd. ha recibido este mensaje
> erróneamente, se ruega lo notifique al remitente y proceda a su borrado.
> Gracias por su colaboración.


Re: [web2py] Re: New Features in Book

2011-06-09 Thread Stifan Kristi
a, i c, pardon me, if i'm not wrong massimo said he will get the book update
on this august. so that i confirm it, hehe...


Re: [web2py] Re: Cubrid?

2011-06-09 Thread Stifan Kristi
glad to know that, thank you so much.


[web2py] Re: Web2Py & RoR performances

2011-06-09 Thread Ross Peoples
Good point. The last thing we want is another Python vs RoR vs whatever war. 
I know that I helped test performance and ran my own benchmarks when Massimo 
was working performance improvements with regards to session files back in 
March, since sessions can slow down response times. My own testing found 
that my app, which is becoming quite large now, had an average response time 
of 30 ms (without database interaction, of course).

I don't care what language or framework you use. If you can get a complex 
application (with db turned off and no performance tweaks) to give average 
response times of less than 50 ms, then it doesn't matter how the framework 
is rendering the files behind the scenes. I've never used RoR so I don't 
know if it truly is faster or slower, but even if it manages to shave a 
couple of milliseconds off the average response time compared to web2py by 
caching everything in memory, does it really matter? Your average response 
time is still well below 50 ms which is FAST! You will never see a 
difference between 30 ms and 28 ms. I doubt even Google or Facebook would 
care about a 2 ms difference. At that point, just use whatever you are most 
comfortable with.


Re: [web2py] Re: vars vs. kwargs

2011-06-09 Thread Ross Peoples
web2py makes extensive use of these. Take the A, DIV, or TABLE as examples, 
you can pass HTML attributes (e.g. _class, _id, _style) to these, but if you 
look at the code, you will notice that these things are not in the signature 
of these methods. They allow you to provide an unknown number of parameters 
to a method. For example:

def my_method(text, _class='', _style='', _id='', _onclick='')

Could easily be rewritten to:

def my_method(text, **kwargs)

Then kwargs is a dictionary with any extra parameters passed:

if '_class' in kwargs:
   output += 'class = "%s"' % kwargs['_class']

Using *args on the other hand would be if you didn't expect named parameters 
to be used, just an unknown number of unnamed paramters. Hope that helps to 
clarify.


[web2py] Re: Project: pydev extension for web2py in Eclipse

2011-06-09 Thread Ross Peoples
That would be awesome. I tried using Eclipse + PyDev once, but it just felt 
too big and complicated, especially since it didn't know anything about 
web2py and couldn't do autocomplete. If this works, I may have to reevaluate 
Eclipse + PyDev again.

[web2py] FYI Data Brewery - anyone used it?

2011-06-09 Thread mikech


http://databrewery.org/

Brewery is a Python  framework and collection of tools 
for analysing and mining data. Goal is to provide functions and tools for:

   - streaming and processing structured data from various sources, such as 
   CSV, XLS files, Google spreadsheets, relational (SQL) databases, MongoDB 
   (no-sql database),...
   - data quality auditing
   - data mining

Complementary framework to brewery is *Cubes*: framework for online 
analytical processing (OLAP)


[web2py] Re: import error debian package

2011-06-09 Thread Stavros
http://dl.dropbox.com/u/3616407/mathquiz.tar.gz

Thanks

On Jun 9, 12:30 pm, José Luis Redrejo Rodríguez 
wrote:
> 2011/6/9 Jeff Elkner :
>
> > We copy the math_quiz directory and all its contents from a source install
> > of web2py, where it works, to the application directory of a user created by
> > the debian package, where it gives the error above.
>
> > Three of us have confirmed this on three separate installations.  We are
> > pretty confident it is an error with the way the package works.
>
> Could you give me a part of the code to test it in the package. I
> guess it's a permission problem.
>
> Regards.


[web2py] Re: Web2Py & RoR performances

2011-06-09 Thread Massimo Di Pierro
for fairness jruby is faster than cpython and jython. jython is slower
then all of them.

On Jun 9, 11:53 am, pbreit  wrote:
> This is probably not a discussion we want to start. While Python may have a
> small performance edge, it's nothing to get excited about. Likewise, the OP
> makes performance assumptions that may not be realistic. As I thought
> everyone knew, there are quite a few variables that go in to overall system
> performance. Database, caching and coding optimizations are as important or
> more than how the framework works.
>
> That said, Massimo and the group have demonstrated a commitment to
> performance so if you have any specific recommendations or, better, code,
> I'm sure they'd be happy to consider.


[web2py] Re: Project: pydev extension for web2py in Eclipse

2011-06-09 Thread Massimo Di Pierro
Does this require any modification to web2py?

On Jun 9, 12:27 pm, Álvaro J. Iradier  wrote:
> After some talking to the Pydev author, we've managed to make a patch
> to a file in Pydev that calls the build_environment() and
> run_models_in() functions from web2py, and adds the resulting
> environment into the __builtins__. The result is you "automagically"
> get a fully working web2py environment in eclipse, with
> autocompletion, etc.
>
> You can follow the development on this feature request on Pydev issue
> tracker:
>
> https://sourceforge.net/tracker/?func=detail&atid=577332&aid=3294887&;...
>
> The procedure is quite manual yet, I hope it can be improved so it is
> customizable per project.
>
> Comments and help are welcome!
>
> Greets.
>
> On 29 abr, 10:51, Álvaro J. Iradier 
> wrote:
>
>
>
>
>
>
>
> > Hi,
>
> > I am trying to develop an extension (a Jython script[1]) for Pydev[2] to
> > improve web2py integration into Eclipse (I'm not sattisfied with the
> > existing recipes).
>
> > I've just started, and you can follow what's going on on the following
> > thread in the Pydev-code mailing list:
>
> >https://sourceforge.net/mailarchive/forum.php?thread_name=BANLkTik-Sj...
>
> > If someone is interested on helping, please let me know, I don't have much
> > time available to work on it.
>
> > Greets.
>
> > [1]http://pydev.org/manual_articles_scripting.html
> > [2]http://pydev.org/
>
> > --
> > Álvaro J. Iradier Muro
> > Departamento de Desarrollo
> > alvaro.irad...@polartech.es
>
> > Polar Technologies
> > T +34 976 527 952
> > F +34 976 466 125www.polartech.es
>
> > Antes de imprimir este mensaje, por favor, compruebe que es verdaderamente
> > necesario. El medioambiente es cosa de todos.
>
> > AVISO LEGAL
> > Este mensaje, y en su caso, cualquier fichero anexo al mismo, puede contener
> > información confidencial, siendo para uso exclusivo del destinatario,
> > quedando prohibida su divulgación, copia o distribución a terceros sin la
> > autorización expresa del remitente. Si Vd. ha recibido este mensaje
> > erróneamente, se ruega lo notifique al remitente y proceda a su borrado.
> > Gracias por su colaboración.


Re: [web2py] Re: Project: pydev extension for web2py in Eclipse

2011-06-09 Thread Pierre Thibault
You can use this project: http://code.google.com/p/neo-insert-imports/ to
add automatically the necessary imports for the static analyzer.

-- 


A+

-
Pierre
My blog and profile
(http://pierrethibault.posterous.com)
YouTube page 
(http://www.youtube.com/user/tubetib)
Twitter (http://twitter.com/pierreth2) 


Re: Re: Re: [web2py] Re: web2py 1.96.4 is OUT

2011-06-09 Thread Pierre Thibault
2011/6/9 

> On , Anthony  wrote:
> > Do you have an app to reproduce the problem? I created an app named
> "Castalia" (note the capitalization) with a module
> /modules/selfgroup/castalia/config.py, which I think is the same structure
> and naming as Alessandro's app. In a controller action, I then did:
> >
> > from selfgroup.castalia import config
> >
> > and it seems to work fine, though I believe Alessandro was getting an
> import error at that point. But maybe I'm missing something.
>
> I think we should ask him to make a small test app for us that demonstrates
> the problem. Else we're guessing.


Alessandro, can you send us the code having the unexpected behavior so the
Windows guys can take a look?

As I understand, you have to remove the capitalization to make it work
because otherwise even if the capitalization match, it does not import
properly. Right?

-- 


A+

-
Pierre
My blog and profile
(http://pierrethibault.posterous.com)
YouTube page 
(http://www.youtube.com/user/tubetib)
Twitter (http://twitter.com/pierreth2) 


[web2py] Auth_user ondelete

2011-06-09 Thread Thiago Carvalho D' Ávila
Hi,

I'm new to web2py, but familiar to similar frameworks. I have a system that
uses web2py builtin auth_user table. The problem is that I wanna use
ondelete='NO ACTION' in my app (it is CASCADE by default), and I don't know
how to put it in the model file. Anyone can help?

Att.
Thiago


[web2py] nginx and web2py

2011-06-09 Thread peter
I am trying to get web2py going with nginx on a remote server.

When I try running it via uswgi and nginx, using wsgihandler.py, it
works with the welcome application. However when I try another
application it gives me an error that it cannot find .../cache/
cache.shelve. This other application works okay with  'python
web2py.py' on the same server.


If I create a dummy file called .../cache/cache.shelve, it deletes
this file, and then complains it cannot find it!

I have given full permissions to both the directory and the file.

The VPS uses Centos 5.5, and I am running things on python2.6.1,
web2py version 1.96.3

any ideas?

Thanks
Peter




[web2py] Re: Auth_user ondelete

2011-06-09 Thread Massimo Di Pierro
this should do it

Field('name','reference othertable',ondelete='NO ACTION')


On Jun 9, 1:14 pm, Thiago Carvalho D' Ávila 
wrote:
> Hi,
>
> I'm new to web2py, but familiar to similar frameworks. I have a system that
> uses web2py builtin auth_user table. The problem is that I wanna use
> ondelete='NO ACTION' in my app (it is CASCADE by default), and I don't know
> how to put it in the model file. Anyone can help?
>
> Att.
> Thiago


[web2py] Re: Auth_user ondelete

2011-06-09 Thread Anthony
On Thursday, June 9, 2011 2:14:59 PM UTC-4, Thiago wrote: 
>
> I'm new to web2py, but familiar to similar frameworks. I have a system that 
> uses web2py builtin auth_user table. The problem is that I wanna use 
> ondelete='NO ACTION' in my app (it is CASCADE by default), and I don't 
> know how to put it in the model file. Anyone can help?
>
 
Are you saying you want to specify ondelete='NO ACTION' for one of the 
fields in the builtin auth_user table? It's only relevant for upload and 
reference fields, and I don't think the auth_user table includes any such 
fields.
 
Anthony


[web2py] Re: Project: pydev extension for web2py in Eclipse

2011-06-09 Thread Álvaro J . Iradier
Yes, I checked that project, but these way would require not adding
anything at the headers, and it also parses the models file. It
requires no modification in web2py, just in Pydev.

Talking to the pydev author in the pydev mailing list, he might
consider including support for web2py if we manage to get it working
fine, and we are quite there.

Greets.

On 9 jun, 20:43, Pierre Thibault  wrote:
> You can use this project:http://code.google.com/p/neo-insert-imports/to
> add automatically the necessary imports for the static analyzer.
>
> --
>
> A+
>
> -
> Pierre
> My blog and profile
> (http://pierrethibault.posterous.com)
> YouTube page 
> (http://www.youtube.com/user/tubetib)
> Twitter (http://twitter.com/pierreth2) 


[web2py] Validator: one of several fields must be non-empty

2011-06-09 Thread Jim Karsten
This validator handles a case where at least one of several fields must be 
non-blank. 

class IS_NOT_ALL_EMPTY(object): 
"""Class representing a validator requiring at least one non-empty field in 
a set. """ 
def __init__(self, others, 
error_message='Enter a value in at least one field'): 
self.others = others 
self.error_message = error_message 

def __call__(self, value): 
okay = (value, None) 
error = (value, self.error_message) 
# Return okay either the 'value', or one of self.others is not empty. 
values = [] 
values.append(value) 
values.extend(self.others) 
empties = [] 
for v in values: 
unused_v, empty = is_empty(v) 
empties.append(empty) 
# Example empties == [True, True, False] 
# If one False exists, it's valid 
if reduce(lambda x, y: x and y, empties): 
return error 
return okay 

Usage: 

db.define_table('contact', 
Field('name', 'string' 
requires=IS_NOT_ALL_EMPTY([request.vars.organization], 
error_message='Enter a name or an organization'), 
), 
Field('organization', 'string', 
requires=IS_NOT_ALL_EMPTY([request.vars.name], 
error_message='Enter a name or an organization'),
)) 

Cheers, 
Jim Karsten 

[web2py] Re: Validator: one of several fields must be non-empty

2011-06-09 Thread Anthony
Cool. Maybe add a slice for this: 
http://www.web2pyslices.com/main/default/index

On Thursday, June 9, 2011 5:13:43 PM UTC-4, Jim Karsten wrote:

> This validator handles a case where at least one of several fields must be 
> non-blank. 
>
> class IS_NOT_ALL_EMPTY(object): 
> """Class representing a validator requiring at least one non-empty field in 
> a set. """ 
> def __init__(self, others, 
> error_message='Enter a value in at least one field'): 
> self.others = others 
> self.error_message = error_message 
>
> def __call__(self, value): 
> okay = (value, None) 
> error = (value, self.error_message) 
> # Return okay either the 'value', or one of self.others is not empty. 
> values = [] 
> values.append(value) 
> values.extend(self.others) 
> empties = [] 
> for v in values: 
> unused_v, empty = is_empty(v) 
> empties.append(empty) 
> # Example empties == [True, True, False] 
> # If one False exists, it's valid 
> if reduce(lambda x, y: x and y, empties): 
> return error 
> return okay 
>
> Usage: 
>
> db.define_table('contact', 
> Field('name', 'string' 
>  requires=IS_NOT_ALL_EMPTY([request.vars.organization], 
> error_message='Enter a name or an organization'), 
> ), 
> Field('organization', 'string', 
> requires=IS_NOT_ALL_EMPTY([request.vars.name], 
> error_message='Enter a name or an organization'),
> )) 
>
> Cheers, 
> Jim Karsten 



Re: [web2py] FYI Data Brewery - anyone used it?

2011-06-09 Thread Stifan Kristi
nice info, will try and take a look, thank you.


Re: [web2py] Re: ajax form submission

2011-06-09 Thread Stifan Kristi
it works on me too, pbreit, thank you so much. when i use the simple it
works fine, but when i try to expand it (i mean using components, ajax and
jquery it's not work).

On Thu, Jun 9, 2011 at 5:11 AM, pbreit  wrote:

> It worked for me with a normal query:
>
> db(db.post.id>0).select(orderby = ~db.post.id)
>


Re: [web2py] Re: Auth_user ondelete

2011-06-09 Thread Thiago Carvalho D' Ávila
I have this auth_user table, and another table called activities. This
activities have 2 fields that are foreing keys to user (created by and
modified by). If I delete any user that created or modified one activity,
the activity is deleted.

Do I have to put NO ACTION in all fields that is foreign key to user? I
don't see how NO ACTION in the ondelete of activity solves my problem...

Sorry I'm very confused. I just got one system made by some other people
(with no documentation =( ) and I am trying to understand to maintain it...


2011/6/9 Anthony 

> On Thursday, June 9, 2011 2:14:59 PM UTC-4, Thiago wrote:
>>
>> I'm new to web2py, but familiar to similar frameworks. I have a system
>> that uses web2py builtin auth_user table. The problem is that I wanna use
>> ondelete='NO ACTION' in my app (it is CASCADE by default), and I don't
>> know how to put it in the model file. Anyone can help?
>>
>
> Are you saying you want to specify ondelete='NO ACTION' for one of the
> fields in the builtin auth_user table? It's only relevant for upload and
> reference fields, and I don't think the auth_user table includes any such
> fields.
>
> Anthony
>


Re: [web2py] Re: ajax form submission

2011-06-09 Thread pbreit
The Ajax worked OK for me. I used your exact same code except I 
switched/fixed this one line:

results = db().select(orderby = ~db.post.id)
to
results = db(db.post.id>0).select(orderby = ~db.post.id) 


[web2py] Re: FYI Data Brewery - anyone used it?

2011-06-09 Thread pbreit
Interesting.

Slightly off-topic but this company just moved into my office replacing 
DotCloud which just moved out: http://chart.io


[web2py] Re: Validator: one of several fields must be non-empty

2011-06-09 Thread pbreit
Is there an ETA on Slices2?

Re: [web2py] Re: Auth_user ondelete

2011-06-09 Thread Anthony
On Thursday, June 9, 2011 6:59:34 PM UTC-4, Thiago wrote: 
>
> I have this auth_user table, and another table called activities. This 
> activities have 2 fields that are foreing keys to user (created by and 
> modified by). If I delete any user that created or modified one activity, 
> the activity is deleted. 
>
> Do I have to put NO ACTION in all fields that is foreign key to user? I 
> don't see how NO ACTION in the ondelete of activity solves my problem...
>
> Sorry I'm very confused. I just got one system made by some other people 
> (with no documentation =( ) and I am trying to understand to maintain it...
>
 
I think you would specify ondelete='NO ACTION' in the reference fields in 
the 'activities' table.
 


  1   2   >