[web2py] http://people.csail.mit.edu/pgbovine/python/tutor.html#mode=visualize

2012-02-20 Thread António Ramos
nice tool

http://people.csail.mit.edu/pgbovine/python/tutor.html#mode=visualize


[web2py] Is there a better way to right justify an SQLTABLE column?

2012-02-20 Thread Edward Shave
Currently I am using this

db.ledger.amount.represent=lambda value: DIV(value, _style="width 100%; 
text-align:right;")




[web2py] LOAD / restful requests problem

2012-02-20 Thread Corne Dickens
Hi,

Currently it is not possible to use LOAD with ajax=False, together
with the request.restful decorator.

-> a minimal example:

controllers/default.py
@request.restful()
def index():
def GET(*args,**vars):
return dict()

return locals()

@request.restful()
def test():
def GET(*args,**vars):
return dict()

return locals()

views/default/index.html
test
{{=LOAD(c='default', f='test', ajax=False, extension="load")}}
test

views/default/test.load
loaded

Expected result:
test
loaded
test

Instead I get a ticket
@request.restful()
TypeError: 'NoneType' object is not callable



[web2py] Auth / default checks

2012-02-20 Thread Corne Dickens
Hi,


Just an idea for the web2p auth system,
why not introduce a standard group 'public' which is assigned to all
visitors (not only logged in users)

The main advantage of this would be, that you in an easy way can
change all access rights for all requests.
By (allways) using the has_permission decorator / and granting (or
deny) access to the 'public' group you can also controll what not
logged in users can see.
By not assigning any rights to a public group / and not including the
decorator in all places it would also be backward compatible with
older versions..

Looks like an easy change to me (in our setup, we override the
permission check of web2py, and allwasy add a 'public' group to the
list)..


[web2py] Re: Is there a better way to right justify an SQLTABLE column?

2012-02-20 Thread weheh
That should work (width: 100%;  /* note the ":"  is missing in your
example */), but stylistically, I'd be putting this kind of thing in
my css file. The doc explains the naming convention for SQLForm fields
(it slips my mind at the moment). Firebug is also useful for seeing
the naming convention for fields and labels created by SQLFORM.

On Feb 20, 5:52 pm, Edward Shave 
wrote:
> Currently I am using this
>
> db.ledger.amount.represent=lambda value: DIV(value, _style="width 100%;
> text-align:right;")


[web2py] Re: Is there a better way to right justify an SQLTABLE column?

2012-02-20 Thread Anthony
Seems reasonable. You could also do it purely via CSS. Suppose "amount" is 
the third column of the table and the table has id "mytable":

#mytable td:nth-child(3) {text-align: right;}

That won't work in older versions of IE, though. In that case, you can use 
jQuery:

$('.ie #mytable td:nth-child(3)').css('text-align', 'right');

That assumes you're using the conditional ".ie" class trick on the html 
element, like in the "welcome" app layout.html:



In that case, ".ie" becomes a css selector for the entire document, but 
only in IE < 9, so the jQuery will only be used in that case.

Anthony


On Monday, February 20, 2012 4:52:46 AM UTC-5, Edward Shave wrote:
>
> Currently I am using this
>
> db.ledger.amount.represent=lambda value: DIV(value, _style="width 100%; 
> text-align:right;")
>
>
>

[web2py] Re: Passing arg from view to controller.

2012-02-20 Thread Anthony

>
> $(function() { 
>   $("#no_table_locality_args").autocomplete({ 
> source: 
> "{{=URL('hubaddressbook','locality_args_autocomplete',args='javascript: 
> $(select#no_table_word).val();')}}",
>

You have to put your javascript code in the javascript portion of the 
above, not the Python portion (Python doesn't know what to do with the 
javascript -- the URL function ends up simply URL encoding it and adding it 
to the URL). Instead, probably something like:

$(function() { 
  $("#no_table_locality_args").autocomplete({ 
source: "{{=URL('hubaddressbook', 'locality_args_autocomplete')}}" + 
"/" + $(select#no_table_word).val(),

Anthony


[web2py] Testing application with Pychecker

2012-02-20 Thread Oliver
Hi.

I'm trying to run some tests on our application with Pychecker, but
I'm getting this error:
TypeError: __import__() takes at most 4 arguments (5 given)

Anyone else got this error? Is it possible to test a whole web2py
application with Pychecker?

Regards,
Oliver


[web2py] Re: The Great Web Framework Shootout

2012-02-20 Thread Massimo Di Pierro
I did submit a patch. I also submitted a comment on reddit. Those
benchmarks are misleading. For example in Django they use the ORM but
in Flask they use native sqlite, not SQLAlchemy. In Django I think
they have sessions enabled, in Flask, I think no.

On Feb 19, 11:23 pm, Bruno Rocha  wrote:
> I did not see web2py on the list...
> Em 20/02/2012 03:03, "pbreit"  escreveu:
>
>
>
>
>
>
>
> >http://blog.curiasolutions.com/the-great-web-framework-shootout/
> >https://github.com/seedifferently/the-great-web-framework-shootout


[web2py] Re: Web2py Code University and Officaial Certify Training

2012-02-20 Thread Massimo Di Pierro
:-)

On Feb 19, 11:42 pm, Ramkrishan Bhatt 
wrote:
> Hello Web2py lovers,
>     from past 1 year i am working on web2py in INDIA with zero-group.com,
> and also trained many people who's showed interest in web development. In
> education many of them looking for training approachability for there brite
> career. I liked the way Google started it's own code university through
> which many open source project get it done by student itself.
> In this model apart from the open source contributor we can work on the
> many Idea's and Project. I really inspired from the Topcoder.com crowd
> sourcing and project management. Since I am belongs to the country like
> INDIA with very large human resources.
> I have thought to implement this task for the building and filtering the
> perfect candidates on web technology. What you says friends. Please discuss
> and share your ideas.


[web2py] Re: http://people.csail.mit.edu/pgbovine/python/tutor.html#mode=visualize

2012-02-20 Thread Massimo Di Pierro
It crashes Chrome for me.

On Feb 20, 3:33 am, António Ramos  wrote:
> nice tool
>
> http://people.csail.mit.edu/pgbovine/python/tutor.html#mode=visualize


[web2py] Re: deployment

2012-02-20 Thread Wikus van de Merwe
The /var/www folder is just an example. You can put the wsgi.py in your 
home folder as well.
You can also simply use wsgihandler.py that comes with web2py. One or the 
other has to be
set as the WSGI script in the http server configuration.

To learn more on deploying web2py applications read this:
http://www.web2py.com/books/default/chapter/29/13



[web2py] Re: Is there a better way to right justify an SQLTABLE column?

2012-02-20 Thread Edward Shave
Thanks for pointing out the mistake in the width attribute, seems it's not 
needed in SQLTABLE, but was in the static mock-up.

Being new to this I couldn't see a way to get at the td tag with css. 
Although I see Anthony has shown a way in another answer


[web2py] Re: Is there a better way to right justify an SQLTABLE column?

2012-02-20 Thread Edward Shave
Many thanks for supplying the right answer, unfortunately I realise now I 
posed the wrong question.

Your right answer was new to me and I can certainly make good use of it.

The question should have been...  *Is there a better way to right justify 
numeric fields (more specifically, decimal) in a SQLTABLE?*
*
*
I don't want to have to change the css if I change to number or order of 
columns...

Thanks again...



[web2py] unable to call ajax url from external javascript.

2012-02-20 Thread Pradeesh
I am new to web2py.
form my view i am able to call web2py ajax as "
ajax("{{=URL(r=request,c='control2',f='function1')}}"['name'],'target');
". But the same command is not working from an external javascript.
How can i call a function (in another control file) using ajax from an
external JavaScript.


[web2py] Re: Is there a better way to right justify an SQLTABLE column?

2012-02-20 Thread Edward Shave
 change *the*number or order of columns... 


[web2py] Re: Is there a better way to right justify an SQLTABLE column?

2012-02-20 Thread Anthony
On Monday, February 20, 2012 10:08:26 AM UTC-5, Edward Shave wrote:
>
> Many thanks for supplying the right answer, unfortunately I realise now I 
> posed the wrong question.
>
> Your right answer was new to me and I can certainly make good use of it.
>
> The question should have been...  *Is there a better way to right justify 
> numeric fields (more specifically, decimal) in a SQLTABLE?*
> *
> *
> I don't want to have to change the css if I change to number or order of 
> columns...
>

In that case, your current method might be the simplest approach. An 
alternative might be to use the server-side DOM 
(http://web2py.com/books/default/chapter/29/5#Server-side-DOM-and-parsing) 
to loop through the SQLTABLE and add a special class to each TD for any 
column containing numeric fields (and then set the CSS for that class). 
SQLTABLE also takes a "headers" argument, which is a dictionary of 
dictionaries and can be used to apply classes to specific columns, but it 
isn't very flexible or well documented -- you can check the source code 
(it's in sqlhtml.py) and play around with it.

Anthony


[web2py] Re: unable to call ajax url from external javascript.

2012-02-20 Thread Anthony
On Monday, February 20, 2012 10:08:42 AM UTC-5, Pradeesh wrote:
>
> I am new to web2py. 
> form my view i am able to call web2py ajax as " 
> ajax("{{=URL(r=request,c='control2',f='function1')}}"['name'],'target'); 
> ". But the same command is not working from an external javascript. 
> How can i call a function (in another control file) using ajax from an 
> external JavaScript. 
>

The ajax() function is in web2py.js. When you call it from an external js 
file, has web2py.js already been loaded in the page?

Anthony 


[web2py] Re: Is there a better way to right justify an SQLTABLE column?

2012-02-20 Thread Edward Shave
Many thanks again Anthony, I will look into both your suggestions, I may be 
gone sometime. LOL.

[web2py] validating computed field

2012-02-20 Thread Alan Etkin
I want to define a table that has a compound field which concatenates
data from two different field values on form submission. In addition,
I would like to check the database on validation to make sure that the
current record is the only to have that "combinada" field value. The
unique argument restriction grants the redundancy is not allowed, but
when duplicated values are sent, the model does not catch database
integrity errors and therefore an exception is raised, at least that
is what I assume so far. How could I catch the db exception at
validation instead of having to handle an adapter related error (which
in turn will probably work only for the current database adapter)?

The prototype is as follows (using the default sqlite uri).

Model:

db.define_table("combinada", Field("combinado",
requires=IS_NOT_EMPTY(), compute=lambda row: row.primero+row.segundo,
unique=True, writable=False), Field("primero",
requires=IS_NOT_EMPTY()), Field("segundo", requires=IS_NOT_EMPTY()))

Here is the error traceback stored by web2py:

Traceback (most recent call last):
  File "/home/alan/web2py/web2py-hg/gluon/restricted.py", line 204, in
restricted
exec ccode in environment
  File "/home/alan/web2py/web2py-hg/applications/compute/controllers/
default.py", line 73, in 
  File "/home/alan/web2py/web2py-hg/gluon/globals.py", line 172, in

self._caller = lambda f: f()
  File "/home/alan/web2py/web2py-hg/applications/compute/controllers/
default.py", line 18, in index
form = crud.create(db.combinada)
  File "/home/alan/web2py/web2py-hg/gluon/tools.py", line 3168, in
create
formname=formname,
  File "/home/alan/web2py/web2py-hg/gluon/tools.py", line 3111, in
update
detect_record_change = self.settings.detect_record_change):
  File "/home/alan/web2py/web2py-hg/gluon/sqlhtml.py", line 1273, in
accepts
self.vars.id = self.table.insert(**fields)
  File "/home/alan/web2py/web2py-hg/gluon/dal.py", line 6634, in
insert
return self._db._adapter.insert(self,self._listify(fields))
  File "/home/alan/web2py/web2py-hg/gluon/dal.py", line 934, in insert
raise e
IntegrityError: column combinado is not unique


[web2py] Re: http://people.csail.mit.edu/pgbovine/python/tutor.html#mode=visualize

2012-02-20 Thread Alan Etkin
Imput:

import os
print os.getcwd()

Output:

ImportError: __import__ not found

On 20 feb, 06:33, António Ramos  wrote:
> nice tool
>
> http://people.csail.mit.edu/pgbovine/python/tutor.html#mode=visualize


[web2py] Re: validating computed field

2012-02-20 Thread Anthony
One option is to use an "onvalidation" function with your 
form: http://web2py.com/books/default/chapter/29/7#onvalidation. In your 
onvalidation function, you can re-use the field's compute function by 
calling it with form.vars as its argument:

def my_onvalidation(form):
combinada = db.combinado.combinada.compute(form.vars)
[check if combinada is already in db, and if so, add error to 
form.errors.primero and/or form.errors.segundo]

The above is a general solution. In your case, since you are just 
concatenating two fields, it is sufficient to confirm that the combination 
of the two fields is unique, which you can do by setting an appropriately 
defined IS_NOT_IN_DB validator on one of the two fields -- here is an 
example of how to do that: http://stackoverflow.com/a/8055987/440323.

Anthony

On Monday, February 20, 2012 12:44:03 PM UTC-5, Alan Etkin wrote:
>
> I want to define a table that has a compound field which concatenates 
> data from two different field values on form submission. In addition, 
> I would like to check the database on validation to make sure that the 
> current record is the only to have that "combinada" field value. The 
> unique argument restriction grants the redundancy is not allowed, but 
> when duplicated values are sent, the model does not catch database 
> integrity errors and therefore an exception is raised, at least that 
> is what I assume so far. How could I catch the db exception at 
> validation instead of having to handle an adapter related error (which 
> in turn will probably work only for the current database adapter)? 
>
> The prototype is as follows (using the default sqlite uri). 
>
> Model: 
>
> db.define_table("combinada", Field("combinado", 
> requires=IS_NOT_EMPTY(), compute=lambda row: row.primero+row.segundo, 
> unique=True, writable=False), Field("primero", 
> requires=IS_NOT_EMPTY()), Field("segundo", requires=IS_NOT_EMPTY())) 
>
> Here is the error traceback stored by web2py: 
>
> Traceback (most recent call last): 
>   File "/home/alan/web2py/web2py-hg/gluon/restricted.py", line 204, in 
> restricted 
> exec ccode in environment 
>   File "/home/alan/web2py/web2py-hg/applications/compute/controllers/ 
> default.py", line 73, in  
>   File "/home/alan/web2py/web2py-hg/gluon/globals.py", line 172, in 
>  
> self._caller = lambda f: f() 
>   File "/home/alan/web2py/web2py-hg/applications/compute/controllers/ 
> default.py", line 18, in index 
> form = crud.create(db.combinada) 
>   File "/home/alan/web2py/web2py-hg/gluon/tools.py", line 3168, in 
> create 
> formname=formname, 
>   File "/home/alan/web2py/web2py-hg/gluon/tools.py", line 3111, in 
> update 
> detect_record_change = self.settings.detect_record_change): 
>   File "/home/alan/web2py/web2py-hg/gluon/sqlhtml.py", line 1273, in 
> accepts 
> self.vars.id = self.table.insert(**fields) 
>   File "/home/alan/web2py/web2py-hg/gluon/dal.py", line 6634, in 
> insert 
> return self._db._adapter.insert(self,self._listify(fields)) 
>   File "/home/alan/web2py/web2py-hg/gluon/dal.py", line 934, in insert 
> raise e 
> IntegrityError: column combinado is not unique



[web2py] Re: http://people.csail.mit.edu/pgbovine/python/tutor.html#mode=visualize

2012-02-20 Thread Anthony

>
> Imput: 
>
> import os 
> print os.getcwd() 
>
> Output: 
>
> ImportError: __import__ not found
>

"This application supports the core Python 
2.5language, with no module imports or file 
I/O. It's meant to be used as a 
platform for creating programming tutorials, not for running or debugging 
production code."

I guess it would be nice to at least have the standard library available.
 


[web2py] Re: validating computed field

2012-02-20 Thread Alan Etkin
I looked at the code posted in stackoverflow, but it's behaving the
same as the former model, perhaps I am not implementing the example
correctly:

This is the new model:

db.define_table("combinada", Field("combinado",
requires=IS_NOT_EMPTY(), compute=lambda row: row.primero+row.segundo,
unique=True, writable=False), Field("primero"), Field("segundo",
requires=IS_NOT_EMPTY()))

db.combinada.primero.requires =
[IS_NOT_IN_DB(db(db.combinada.combinado==str(request.vars.primero)
+str(request.vars.segundo)), "combinada.combinado"), IS_NOT_EMPTY()]


When submitting a crud.create() form with repeated values, the error
is the same as the posted before (an integrity error).

Thank you.

On 20 feb, 15:08, Anthony  wrote:
> One option is to use an "onvalidation" function with your
> form:http://web2py.com/books/default/chapter/29/7#onvalidation. In your
> onvalidation function, you can re-use the field's compute function by
> calling it with form.vars as its argument:
>
> def my_onvalidation(form):
>     combinada = db.combinado.combinada.compute(form.vars)
>     [check if combinada is already in db, and if so, add error to
> form.errors.primero and/or form.errors.segundo]
>
> The above is a general solution. In your case, since you are just
> concatenating two fields, it is sufficient to confirm that the combination
> of the two fields is unique, which you can do by setting an appropriately
> defined IS_NOT_IN_DB validator on one of the two fields -- here is an
> example of how to do that:http://stackoverflow.com/a/8055987/440323.
>
> Anthony
>
>
>
>
>
>
>
> On Monday, February 20, 2012 12:44:03 PM UTC-5, Alan Etkin wrote:
>
> > I want to define a table that has a compound field which concatenates
> > data from two different field values on form submission. In addition,
> > I would like to check the database on validation to make sure that the
> > current record is the only to have that "combinada" field value. The
> > unique argument restriction grants the redundancy is not allowed, but
> > when duplicated values are sent, the model does not catch database
> > integrity errors and therefore an exception is raised, at least that
> > is what I assume so far. How could I catch the db exception at
> > validation instead of having to handle an adapter related error (which
> > in turn will probably work only for the current database adapter)?
>
> > The prototype is as follows (using the default sqlite uri).
>
> > Model:
>
> > db.define_table("combinada", Field("combinado",
> > requires=IS_NOT_EMPTY(), compute=lambda row: row.primero+row.segundo,
> > unique=True, writable=False), Field("primero",
> > requires=IS_NOT_EMPTY()), Field("segundo", requires=IS_NOT_EMPTY()))
>
> > Here is the error traceback stored by web2py:
>
> > Traceback (most recent call last):
> >   File "/home/alan/web2py/web2py-hg/gluon/restricted.py", line 204, in
> > restricted
> >     exec ccode in environment
> >   File "/home/alan/web2py/web2py-hg/applications/compute/controllers/
> > default.py", line 73, in 
> >   File "/home/alan/web2py/web2py-hg/gluon/globals.py", line 172, in
> > 
> >     self._caller = lambda f: f()
> >   File "/home/alan/web2py/web2py-hg/applications/compute/controllers/
> > default.py", line 18, in index
> >     form = crud.create(db.combinada)
> >   File "/home/alan/web2py/web2py-hg/gluon/tools.py", line 3168, in
> > create
> >     formname=formname,
> >   File "/home/alan/web2py/web2py-hg/gluon/tools.py", line 3111, in
> > update
> >     detect_record_change = self.settings.detect_record_change):
> >   File "/home/alan/web2py/web2py-hg/gluon/sqlhtml.py", line 1273, in
> > accepts
> >     self.vars.id = self.table.insert(**fields)
> >   File "/home/alan/web2py/web2py-hg/gluon/dal.py", line 6634, in
> > insert
> >     return self._db._adapter.insert(self,self._listify(fields))
> >   File "/home/alan/web2py/web2py-hg/gluon/dal.py", line 934, in insert
> >     raise e
> > IntegrityError: column combinado is not unique


[web2py] Re: http://people.csail.mit.edu/pgbovine/python/tutor.html#mode=visualize

2012-02-20 Thread Alan Etkin
My bad, and Imput should be Input :P

On 20 feb, 15:11, Anthony  wrote:
> > Imput:
>
> > import os
> > print os.getcwd()
>
> > Output:
>
> > ImportError: __import__ not found
>
> "This application supports the core Python 
> 2.5language, with no module imports or file 
> I/O. It's meant to be used as a
> platform for creating programming tutorials, not for running or debugging
> production code."
>
> I guess it would be nice to at least have the standard library available.


[web2py] Using Web2Py Shell with Google App Engine App- Does this work?

2012-02-20 Thread BrendanC
In an earlier thread someone tried to use the shell to do some interactive 
testing on a GAE app but kept getting error 'gae' not defined.
I'm also getting the same error. 

Anyone out got this working?

https://groups.google.com/forum/?fromgroups#!searchin/web2py/gae$20shell/web2py/mg5ICyEjTCg/9WN8k7pO22MJ

TIA,
BrendanC


[web2py] Re: unable to call ajax url from external javascript.

2012-02-20 Thread Alan Etkin
Maybe wrapping the code in jQuery(document).ready() the execution is
delayed enough time for the web2py functions to be read.

On 20 feb, 12:08, Pradeesh  wrote:
> I am new to web2py.
> form my view i am able to call web2py ajax as "
> ajax("{{=URL(r=request,c='control2',f='function1')}}"['name'],'target');
> ". But the same command is not working from an external javascript.
> How can i call a function (in another control file) using ajax from an
> external JavaScript.


[web2py] Re: validating computed field

2012-02-20 Thread Anthony

>
> db.combinada.primero.requires = 
> [IS_NOT_IN_DB(db(db.combinada.combinado==str(request.vars.primero) 
> +str(request.vars.segundo)), "combinada.combinado"), IS_NOT_EMPTY()] 
>

The value of request.vars.primero will be passed to the above IS_NOT_IN_DB 
validator, but it is then comparing that value against values in the 
"combinado" field -- so even when the "combinado" value is duplicated, it 
won't return an error because the value of "primero" won't match the 
duplicated value of "combinado". Instead, you should compare the value of 
request.vars.primero to values in the "primero" field, but only among the 
set of records that match the current value of request.vars.segundo -- 
that's what the example on Stack Overflow is doing. The idea is that you're 
looking for a set of records where "primero" is duplicated among a set of 
records where "segundo" is also duplicated, which implies that the 
combination of "primero" and "segundo" is duplicated.

db.combinada.primero.requires = 
[IS_NOT_IN_DB(db(db.combinada.segundo==request.vars.segundo),
"combinada.primero", error_message='The combination of primero and 
segundo must be unique'),
 IS_NOT_EMPTY()] 

Anthony



[web2py] Check if request method is post

2012-02-20 Thread Hassan Alnatour
Dear All ,

How can i check if the request method is post ?


[web2py] Re: validating computed field

2012-02-20 Thread Alan Etkin
Great! Thanks for your quick answer. I really don't understand
completely what does IS_NOT_IN_DB, I just copy/pasted the code and it
works perfectly. I'll check the documentation and the API for detailed
info.

Thanks again

On 20 feb, 17:06, Anthony  wrote:
> > db.combinada.primero.requires =
> > [IS_NOT_IN_DB(db(db.combinada.combinado==str(request.vars.primero)
> > +str(request.vars.segundo)), "combinada.combinado"), IS_NOT_EMPTY()]
>
> The value of request.vars.primero will be passed to the above IS_NOT_IN_DB
> validator, but it is then comparing that value against values in the
> "combinado" field -- so even when the "combinado" value is duplicated, it
> won't return an error because the value of "primero" won't match the
> duplicated value of "combinado". Instead, you should compare the value of
> request.vars.primero to values in the "primero" field, but only among the
> set of records that match the current value of request.vars.segundo --
> that's what the example on Stack Overflow is doing. The idea is that you're
> looking for a set of records where "primero" is duplicated among a set of
> records where "segundo" is also duplicated, which implies that the
> combination of "primero" and "segundo" is duplicated.
>
> db.combinada.primero.requires =
> [IS_NOT_IN_DB(db(db.combinada.segundo==request.vars.segundo),
>     "combinada.primero", error_message='The combination of primero and
> segundo must be unique'),
>      IS_NOT_EMPTY()]
>
> Anthony


[web2py] Re: web2py + GAE memory usage

2012-02-20 Thread howesc
it does not seem to make a difference, so it is something else...

[web2py] Re: Check if request method is post

2012-02-20 Thread Niphlod
the method is stored into request.env.request_method .
So request.env.request_method == 'POST' is what you're looking for


[web2py] Re: validating computed field

2012-02-20 Thread Anthony
On Monday, February 20, 2012 3:31:29 PM UTC-5, Alan Etkin wrote:
>
> Great! Thanks for your quick answer. I really don't understand 
> completely what does IS_NOT_IN_DB, I just copy/pasted the code and it 
> works perfectly. I'll check the documentation and the API for detailed 
> info.
>

The first argument is either a db object or a Set (i.e., a db object called 
with a query), and the second is a particular table.field to check for 
duplicate values within the specified db or Set. So, in:

IS_NOT_IN_DB(db(db.combinada.segundo==request.vars.segundo),
"combinada.primero")

it is finding the set of records identified by db(db.combinada.
segundo==request.vars.segundo), and within that set of records, it is 
checking whether the submitted value is duplicated within the 
combinada.primero field.

Anthony


[web2py] Creating Model extractor for Oracle and need some help/advice

2012-02-20 Thread Larry Schwerzler
 

I thought I had posted this about an hour ago but don't see it as a topic 
so I'll repost. Forgive if this is a duplicate. 


 I'm trying to build an Oracle version of the extract_mysql_models.py and 
extract_pgsql_models.py, these files look at a currently existing database 
and write out a web2py model definition for that database. I've got a 
legacy database with almost 800 tables some with almost 200 columns and 
there are changes with each new release of the software which is roughtly 
twice a year, so you could see my motivation for not creating the models by 
hand.


 I'm using the postgres version of the extract models script as my template 
and trying to swap out the pieces that are postgres specific with pieces 
that work with Oracle. I'm stuck on two parts, which I would greatly 
appreciate some help/advice on. 


 
   1. 
   
   The function “references” (extract_pgsql_models.py line 194 or so) is 
   confusing for me. I understand that it gets FK relationships but I'm not 
   sure which side of the relationship it gets and what it is ultimately 
   returning to the calling function. The main SQL looks like this: 
   
   rows1 = query(conn, """SELECT table_name, column_name, constraint_name, 
   update_rule, delete_rule, ordinal_position
   FROM information_schema.key_column_usage
   NATURAL JOIN information_schema.referential_constraints
   NATURAL JOIN information_schema.table_constraints
   WHERE information_schema.key_column_usage.table_name=%s
   AND information_schema.key_column_usage.column_name=%s
   AND information_schema.table_constraints.constraint_type='FOREIGN KEY' 
   ;""", table, field)
   
   What is this SQL returning? Why does the function fail if this returns 
   more then one reference? Does that mean I can't have a table that has two 
   FK references?
   2. 
   
   Secondly it is unclear to me how or if the script handles dependencies. 
   For example if I have a Unit table and in that table is a reference to a 
   location (one location many units) when the script is processing the unit 
   table will it check for (and create if needed) the location table so that 
   all dependent tables are created before a FK reference is made from a table?
   

 I'm open to other suggestions/tools. I was able to get sqlautocode to 
generate sqlalchemy models but in looking at the source it didn't seem 
straightforward to modify so that it output web2py models. 


 Any help is appreciated :)


[web2py] Re: Check if request method is post

2012-02-20 Thread Anthony
Also, if request.post_vars is not None, then it is a post request -- so you 
could do something like:

if request.post_vars:
[do something with POST request variables]

Note, request.vars contains both request.get_vars and request.post_vars.

Anthony

On Monday, February 20, 2012 3:35:23 PM UTC-5, Niphlod wrote:
>
> the method is stored into request.env.request_method .
> So request.env.request_method == 'POST' is what you're looking for
>


[web2py] Re: Check if request method is post

2012-02-20 Thread Alan Etkin
This command returns a string with the method name (uppercase)

request.env.request_method

On 20 feb, 17:26, Hassan Alnatour  wrote:
> Dear All ,
>
> How can i check if the request method is post ?


[web2py] Re: Web2py Code University and Officaial Certify Training

2012-02-20 Thread Alan Etkin
> I have thought to implement this task for the building and filtering the
> perfect candidates on web technology

Would you please clarify that line?. I can't get the central idea of
the message.


[web2py] Web2Py/Google App Engine Apps - How to get ID or key after Inserting New Rec

2012-02-20 Thread BrendanC
I want to build a mapping/xref/intersect  table that needs to be updated 
after a new record insert. For that I need the key or id of the last 
inserted record.
Is this available with the DAL/GAE? Elsewhere I have seen an issue where 
this did not work with a bulk insert.

Unfortunately, this is not covered in the docs (AFAIK).

BrendanC 


[web2py] Re: Web2Py/Google App Engine Apps - How to get ID or key after Inserting New Rec

2012-02-20 Thread Anthony
How are you inserting the record? The .insert() method returns the id of 
the inserted record, and .bulk_insert() returns a list of id's.

On Monday, February 20, 2012 4:47:45 PM UTC-5, BrendanC wrote:
>
> I want to build a mapping/xref/intersect  table that needs to be updated 
> after a new record insert. For that I need the key or id of the last 
> inserted record.
> Is this available with the DAL/GAE? Elsewhere I have seen an issue where 
> this did not work with a bulk insert.
>
> Unfortunately, this is not covered in the docs (AFAIK).
>
> BrendanC 
>


[web2py] Web2py + amfrpc3 + clean flash

2012-02-20 Thread Marek Mollin
Hey,
I have a problem. I am trying to work with clean flash or as3 if you
will.
The issue I am bumping into is null asynctoken.result.

** AS3 code:

import mx.rpc.remoting.RemoteObject;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.utils.RpcClassAliasInitializer;
import mx.rpc.AsyncToken;

RpcClassAliasInitializer.registerClassAliases();


var remote:RemoteObject = new RemoteObject("mydomain");
remote.destination = "mydomain";
remote.endpoint = "http://127.0.0.1:8000/amf/default/call/amfrpc3";;

var a:AsyncToken = remote.addNumbers(12,3);
trace(a.message);
trace(a.result);

stop();


** default.py controller:

def user(): return dict(form=auth())
def download(): return response.download(request,db)
def call(): return service()
### end requires
def index():
return dict()

@service.amfrpc3('mydomain')
def addNumbers(val1, val2):
return val1 + val2

def error():
return dict()

**
The whole thing returns null. Any ideas?
I am trying out the amfchannels...

Help would be incredible! ;]

Regards,
Marek



[web2py] Re: Using Web2Py Shell with Google App Engine App- Does this work?

2012-02-20 Thread howesc
while i never tried to make it work, the other thread suggests that the GAE 
libs are not on your path.  using the launcher install on OSX i think i 
would have to add 
"/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine"
 
to my path and then it would find the gae modules for import.

good luck!


[web2py] crontab sytax

2012-02-20 Thread web-dev-m
Hey everyone,

I'm trying to figure out how to run a background process and write a
very simple script to test it.  It's not working, and I can't seem to
find the right syntax.  The link in the web2py book is broken.  Can
anyone break it down for me or is there an updated link?

Thanks!


[web2py] Re: Web2py + amfrpc3 + clean flash

2012-02-20 Thread Marek Mollin
Also does not work with:
http://pastebin.com/Ghn2yNkV

I hope anyone can help me...

On 20 Lut, 23:01, Marek Mollin  wrote:
> Hey,
> I have a problem. I am trying to work with clean flash or as3 if you
> will.
> The issue I am bumping into is null asynctoken.result.
>
> ** AS3 code:
>
> import mx.rpc.remoting.RemoteObject;
> import mx.rpc.events.FaultEvent;
> import mx.rpc.events.ResultEvent;
> import mx.utils.RpcClassAliasInitializer;
> import mx.rpc.AsyncToken;
>
> RpcClassAliasInitializer.registerClassAliases();
>
> var remote:RemoteObject = new RemoteObject("mydomain");
> remote.destination = "mydomain";
> remote.endpoint = "http://127.0.0.1:8000/amf/default/call/amfrpc3";;
>
> var a:AsyncToken = remote.addNumbers(12,3);
> trace(a.message);
> trace(a.result);
>
> stop();
>
> ** default.py controller:
>
> def user(): return dict(form=auth())
> def download(): return response.download(request,db)
> def call(): return service()
> ### end requires
> def index():
>     return dict()
>
> @service.amfrpc3('mydomain')
> def addNumbers(val1, val2):
>     return val1 + val2
>
> def error():
>     return dict()
>
> **
> The whole thing returns null. Any ideas?
> I am trying out the amfchannels...
>
> Help would be incredible! ;]
>
> Regards,
> Marek


[web2py] Re: Web2py + amfrpc3 + clean flash

2012-02-20 Thread Marek Mollin
Does anyone have any working example in plain Actionscript 3 ?
As I try numerous attempts but cant get web2py to provide amf gateway.

On 21 Lut, 00:23, Marek Mollin  wrote:
> Also does not work with:http://pastebin.com/Ghn2yNkV
>
> I hope anyone can help me...
>
> On 20 Lut, 23:01, Marek Mollin  wrote:
>
>
>
>
>
>
>
> > Hey,
> > I have a problem. I am trying to work with clean flash or as3 if you
> > will.
> > The issue I am bumping into is null asynctoken.result.
>
> > ** AS3 code:
>
> > import mx.rpc.remoting.RemoteObject;
> > import mx.rpc.events.FaultEvent;
> > import mx.rpc.events.ResultEvent;
> > import mx.utils.RpcClassAliasInitializer;
> > import mx.rpc.AsyncToken;
>
> > RpcClassAliasInitializer.registerClassAliases();
>
> > var remote:RemoteObject = new RemoteObject("mydomain");
> > remote.destination = "mydomain";
> > remote.endpoint = "http://127.0.0.1:8000/amf/default/call/amfrpc3";;
>
> > var a:AsyncToken = remote.addNumbers(12,3);
> > trace(a.message);
> > trace(a.result);
>
> > stop();
>
> > ** default.py controller:
>
> > def user(): return dict(form=auth())
> > def download(): return response.download(request,db)
> > def call(): return service()
> > ### end requires
> > def index():
> >     return dict()
>
> > @service.amfrpc3('mydomain')
> > def addNumbers(val1, val2):
> >     return val1 + val2
>
> > def error():
> >     return dict()
>
> > **
> > The whole thing returns null. Any ideas?
> > I am trying out the amfchannels...
>
> > Help would be incredible! ;]
>
> > Regards,
> > Marek


[web2py] Re: Web2Py/Google App Engine Apps - How to get ID or key after Inserting New Rec

2012-02-20 Thread BrendanC
Just did some more testing -insert works OK, but bulk insert fails. 
FWIW I think this was previously reported as a problem. Here;s a link:

https://groups.google.com/forum/#!searchin/web2py/bulk$20insert$20mapping/web2py/k9Pa2EdHNeA/1mcHn6bCWw4J


[web2py] Re: Enable and disable links in a view.

2012-02-20 Thread Alan Etkin
The code is pretty extense, but I think that there is no need to set
conditional css and script tags. I'd put template syntax sentences in
views for alternating A with P tags (or wathever tag suits the style
needs for the site) and changing the class attribute for each page
item. That grants you that the user will never have the oportunity to
fire an http request with a link (unless you bind javascript code to
the tag click of course) if he isn't able to do so.

In code, this is what i mean:

some view:

// here all the javascript



/* wathever you want the page to look like */
a {
/* for links */
}
p {
/* for no links */
}


{{ for item in mypage: }}
  {{ if thismustbealink: }}
{{ =A("Aye, ye can click o' this", _class="clickable",
_href=URL(...)) }}
  {{ elif thismusntbealink: }}
{{ =P("Avast!, thy cannot clickest this paragraph",
_class="unclickable") }}
  {{ pass }}
{{ pass }}

On 20 feb, 02:24, Annet  wrote:
> Hi Alan,
>
> I am still struggling getting your solution mapped to my problem, I'll
> post the entire view, hoping you will provide me with some more clues
> to help me get this to work.
>
> {{extend 'initLayout.html'}}
>
> 
>   .content {margin: 24px auto 24px; width: 600px;}
>   .admin a, .admin a:visited {color: #424242;}
>   .admin a:hover {text-decoration: none;}
>   .fs12 {font-size: 12px; padding: 6px 12px 6px 12px;}
> 
>
> {{if not auth.is_logged_in():}}
>   
>     $(document).ready(function(){
>       $('#root a').click(function(e) {e.preventDefault();});
>       $('#hub a').click(function(e) {e.preventDefault();});
>       $('#vcardsite a').click(function(e) {e.preventDefault();});
>       $('#calendar a').click(function(e) {e.preventDefault();});
>     });
>   
>
>   
>     #root, #hub, #vcardsite, #calendar {opacity: 0.5;
> filter:Alpha(opacity=50);}
>   
>
> {{else:}}
>   
>     $(document).ready(function(){
>       $('#root a').click(function(e) {e.preventDefault();});
>       $('#hub a').click(function(e) {e.preventDefault();});
>       $('#vcardsite a').click(function(e) {e.preventDefault();});
>       $('#calendar a').click(function(e) {e.preventDefault();});
>     });
>     {{if rows:}}
>       {{for row in rows:}}
>         {{i=row.accountID}}
>         {{if i==1:}}
>           $('#root a').unbind('click',function(e));
>         {{elif i==2:}}
>           $('#hub a').unbind('click',function(e));
>         {{elif i==3:}}
>           $('#vcardsite a').unbind('click',function(e));
>         {{elif i==4:}}
>           $('#calendar a').unbind('click',function(e));
>         {{pass}}
>       {{pass}}
>     {{pass}}
>   
>
>   
>     #root, #hub, #vcardsite, #calendar {opacity: 0.5;
> filter:Alpha(opacity=50);}
>     {{if rows:}}
>       {{for row in rows:}}
>         {{i=row.accountID}}
>         {{if i==1:}}
>           #root {opacity: 1.0; filter:Alpha(opacity=100);}
>         {{elif i==2:}}
>           #hub {opacity: 1.0; filter:Alpha(opacity=100);}
>         {{elif i==3:}}
>           #vcardsite {opacity: 1.0; filter:Alpha(opacity=100);}
>         {{elif i==4:}}
>           #calendar {opacity: 1.0; filter:Alpha(opacity=100);}
>         {{pass}}
>       {{pass}}
>     {{pass}}
>   
>
> {{pass}}
>
> 
> 
>   
>     {{if auth.is_logged_in():}}
>       Ingelogd als {{=auth.user.first_name}}
> {{=auth.user.last_name}} |
>       Logout h5>
>     {{else:}}
>       U bent niet ingelogd |
>       Login
>     {{pass}}
>    
>  
>
> 
> 
>
>   
>     Welkom bij Leonexus admin
>     
>    
>
>   
>
>     
>       
>         
>           
>             
>             Hub
>             Uw hub beheren.
>           
>          
>        
>
>       
>         
>           
>             
>             vCard site
>             Uw vCard site beheren.
>           
>          
>        
>
>       
>         
>           
>             
>             Calendar
>             
>           
>          
>        
>
>      
>
>    
>
>   
>
>     
>       
>         
>           
>             
>             Root
>             Uw nodes beheren.
>           
>          
>        
>
>       
>
>        
>
>       
>
>        
>
>      
>
>    
>
>   
>     Let op: Voor een correcte werking van de admin applicatie moet
> uw browser cookies van deze webvoorziening accepteren.
>    
>
>   
>     {{if response.auth_menu:}}
>       
>         {{for _name,_active,_link in response.auth_menu:}}
>            style="padding-right: 6px;">{{=_name}}
>         {{pass}}
>       
>     {{pass}}
>    
>
>  
>
> Kind regards,
>
> Annet


[web2py] Re: how to modify scaffolding form for a specific model

2012-02-20 Thread Alan Etkin
I'd check if it is not developed yet (for example in web2pyslices or
here http://dev.s-cubism.com/web2py_plugins#plugin_rating_widget)

On 19 feb, 16:41, Can Candan  wrote:
> I am willing to extend the behavior of the autogenerated crud interface
> just for one table so that when the dropdown corresponding to a one-to-many
> relation is selected
> another dropdown should display values corresponding to the chosen one.
>
> In other words i need a dynamic restriction, something like this.
> db.entity.value.requires=IS_IN_DB(results of query here corresponding to
> the previous selection)
>
> What might be the easiest way to do that?


[web2py] Re: crontab sytax

2012-02-20 Thread web-dev-m
I apologize, this should have been in my original post.

For more specifics, my crontab file has only one line in it:

@reboot root python web2py.py -S test -M -N -R applications/test/
controllers/private.py

I have tried to restart the server multiple times, to no avail with
getting this process working.

the script in private.py works when i run it as root from my command
line on my server, so I don't think the problem is with the script
itself.

Any help is greatly, greatly appreciated.

Thank you in advance!


[web2py] New member and new to web2py and need some clarification about file paths.

2012-02-20 Thread RKS
Hello. Coming over from the php world and I started a new job where we
use web2py and python. I'm trying to wrap my head around how it's
handling the paths to pages I create and I can't find my answers in
the docs. Probably I'm just missing it but I can't seem to figure it
out.

I've already created the layout.html and all the page.html files
located in views/default/page.html. I added


def page():
return dict()


in default.py. Now I'm trying various methods of adding anchors into
my html and everything returns an invalid error. For example, , ,  and
nothing seems to work. I'm running it from 127.1.1.8000. I'm at home
so I don't have my specific code here.

I'm actually the designer so I'm running the web2py OSX Lion app while
the developers are running Ubuntu and I've noticed a couple of things
are different based on that. Perhaps the way they were doing it needs
to be changed for the web2py app? Already some things that work in
Linux had to be changed to work on my Mac.

Also, what is the correct method to reference css and  images
that are located in the static/images directory?

Thanks and I look forward to meeting more python developers and
getting to know web2py a bit more. I'm coming over from a background
in php, asp, and vb. I hate asp and vb and was forced into it where I
used to work and so I'm super excited to be working with python now
instead. The only good thing I took from asp was the C and that helps
with iOS so it wasn't all bad but...

I'll shut up now. Thanks for your help.


[web2py] Re: New member and new to web2py and need some clarification about file paths.

2012-02-20 Thread Massimo Di Pierro
You have two options:

click me

or

{{=A('click me',_href=URL('page'))}}

Notice it is {{=URL('page')}}, not {{URL('page')}}

Hope this helps.

On Feb 20, 8:13 pm, RKS  wrote:
> Hello. Coming over from the php world and I started a new job where we
> use web2py and python. I'm trying to wrap my head around how it's
> handling the paths to pages I create and I can't find my answers in
> the docs. Probably I'm just missing it but I can't seem to figure it
> out.
>
> I've already created the layout.html and all the page.html files
> located in views/default/page.html. I added
>
> 
> def page():
> return dict()
> 
>
> in default.py. Now I'm trying various methods of adding anchors into
> my html and everything returns an invalid error. For example,  href="/page">, ,  and
> nothing seems to work. I'm running it from 127.1.1.8000. I'm at home
> so I don't have my specific code here.
>
> I'm actually the designer so I'm running the web2py OSX Lion app while
> the developers are running Ubuntu and I've noticed a couple of things
> are different based on that. Perhaps the way they were doing it needs
> to be changed for the web2py app? Already some things that work in
> Linux had to be changed to work on my Mac.
>
> Also, what is the correct method to reference css and  images
> that are located in the static/images directory?
>
> Thanks and I look forward to meeting more python developers and
> getting to know web2py a bit more. I'm coming over from a background
> in php, asp, and vb. I hate asp and vb and was forced into it where I
> used to work and so I'm super excited to be working with python now
> instead. The only good thing I took from asp was the C and that helps
> with iOS so it wasn't all bad but...
>
> I'll shut up now. Thanks for your help.


[web2py] Re: how to modify scaffolding form for a specific model

2012-02-20 Thread Anthony
Here are some 
options: 
http://stackoverflow.com/questions/8146260/best-practice-for-populating-dropdown-based-on-other-dropdown-selection-in-web2p/8152910#8152910

Anthony

On Sunday, February 19, 2012 2:41:14 PM UTC-5, Can Candan wrote:
>
> I am willing to extend the behavior of the autogenerated crud interface 
> just for one table so that when the dropdown corresponding to a one-to-many 
> relation is selected
> another dropdown should display values corresponding to the chosen one.
>
> In other words i need a dynamic restriction, something like this.
> db.entity.value.requires=IS_IN_DB(results of query here corresponding to 
> the previous selection)
>
> What might be the easiest way to do that?
>


[web2py] Re: unable to call ajax url from external javascript.

2012-02-20 Thread Vineet
In your statement --
ajax("{{=URL(r=request,c='control2',f='function1')}}"['name'],'target');

comma is missing after URL and before ['name'].
Check whether it is a typo or otherwise.

-- Vineet

On Feb 21, 1:01 am, Alan Etkin  wrote:
> Maybe wrapping the code in jQuery(document).ready() the execution is
> delayed enough time for the web2py functions to be read.
>
> On 20 feb, 12:08, Pradeesh  wrote:
>
>
>
>
>
>
>
> > I am new to web2py.
> > form my view i am able to call web2py ajax as "
> > ajax("{{=URL(r=request,c='control2',f='function1')}}"['name'],'target');
> > ". But the same command is not working from an external javascript.
> > How can i call a function (in another control file) using ajax from an
> > external JavaScript.


[web2py] Re: unable to call ajax url from external javascript.

2012-02-20 Thread Vineet
In your statement --
ajax("{{=URL(r=request,c='control2',f='function1')}}"['name'],'target');

comma is missing after URL and before ['name'].
Check whether it is a typo or otherwise.

Secondly, double check whether the external js file is included in the
header section of layout.html

-- Vineet

On Feb 21, 1:01 am, Alan Etkin  wrote:
> Maybe wrapping the code in jQuery(document).ready() the execution is
> delayed enough time for the web2py functions to be read.
>
> On 20 feb, 12:08, Pradeesh  wrote:
>
>
>
>
>
>
>
> > I am new to web2py.
> > form my view i am able to call web2py ajax as "
> > ajax("{{=URL(r=request,c='control2',f='function1')}}"['name'],'target');
> > ". But the same command is not working from an external javascript.
> > How can i call a function (in another control file) using ajax from an
> > external JavaScript.


[web2py] Any way to make web2py SQLFORM.grid accept inserted fields?

2012-02-20 Thread whowhywhat
I need a web2py SQLFORM.grid to accept and process based on some
conditions, which need to be triggered based on some check boxes. I
have inserted these checkboxes into the form by doing something like :

In the controller -

def my_grid():
form = SQLFORM.grid()

if  len(request.args)>1 and (request.args[0]=='new' or 'edit') and
(form.create_form or form.edit_form):
my_extra_element = TR(TD(LABEL('Process x:'),
_class='w2p_fl'), INPUT(_name='Do X', default=False,
_value='on', _type='checkbox',_id='process_x'))
if form.create_form:
form.create_form[0].insert(-1,my_extra_element)
if form.edit_form:
form.edit_form[0].insert(-1,my_extra_element)
if request.post_vars: session.tmp = request.post_vars
return dict(form=form)

Adding the custom elements is straight forward and easy..
Is there some way to store and pass the value of the custom inserted
check-box or any such customized form?
I have tried many things.. but have not been successful so far.
Any help is greatly appreciated :) ..


[web2py] Validate the Checkbox

2012-02-20 Thread Sanjeet Kumar
I have the multiple check-box in one row in Controller I want to validate 
it form controller when the user submit his request without selecting any 
of the check-box than it should be shown the error message "Please select 
at least one check-box"


[web2py] Re: Validate the Checkbox

2012-02-20 Thread whowhywhat
please could post your controller code..

On Feb 21, 10:32 am, Sanjeet Kumar  wrote:
> I have the multiple check-box in one row in Controller I want to validate
> it form controller when the user submit his request without selecting any
> of the check-box than it should be shown the error message "Please select
> at least one check-box"


[web2py] BELONGS is not supported on GAE?

2012-02-20 Thread Peter G.
I'm trying to obtain a set of rows whose ID values belongs in rows'
fields of another table.

Here's the code:

# Construct a query to fetch all the mootid's from the group
mootGroup =
db(db.moot_groups.gid==groupid)._select(db.moot_groups.mootid)
# Gets moots only if the moot ID exists in the Group query
moots =
db((db.moots.url==request.get_vars.url)&(db.moots.id.belongs(mootGroup))).select(db.moots.ALL)

The error in the admin says this:
File "/base/data/home/apps/356965595645653415/gluon/dal.py", line
3367, in BELONGS
raise SyntaxError, "Not supported"
SyntaxError: Not supported

Thanks!


Re: [web2py] Re: Validate the Checkbox

2012-02-20 Thread Sanjeet Kumar
TR("Type:",(TD(INPUT(_type="checkbox",_name="a",_value="a",_size="0"),"A"))),

(TD(INPUT(_type="checkbox",_name="b",_value="b",_size="0"),"B")),

(TD(INPUT(_type="checkbox",_name="c",_value="c",_size="0"),"C"))),
TR("",INPUT(_type="submit",_value="SUBMIT" ))

On Tue, Feb 21, 2012 at 11:28 AM, whowhywhat  wrote:

> please could post your controller code..
>
> On Feb 21, 10:32 am, Sanjeet Kumar  wrote:
> > I have the multiple check-box in one row in Controller I want to validate
> > it form controller when the user submit his request without selecting any
> > of the check-box than it should be shown the error message "Please select
> > at least one check-box"
>


Re: [web2py] Re: Web2py Code University and Officaial Certify Training

2012-02-20 Thread ramkrishan bhatt
The main Idea is the following:-
In India final year of the education as per University syllabus concern ,
student need to have industrial training.
And the sack of the certificate, due to less number of perfect education
they stuck in greedy consultant. Who's giving certificate and takes money
from the student without any proper training.
I learn a lot from Google code University and Topcoder arena. Even my
learning python and java credit goes to them.
Most of the follower just learn process which does'nt match with the proper
process of project life cycle.
So i got the IDEA to build such system like topcoder arena <
www.topcoder.com/tc>. for the student and setup a education and zero
hierarchy project management system using ranking Model.
Google build many project contributed by the student in Google code
university.
Many of the Idea is spreading in the developer but due to lake of proper
training and system they could not able to build.
Since Web2py is open source project and need to expanded further by the
open source contributor.
If we start giving training on web development using web2py ,python ,and
other technology.
We could make following things.
 1. web2py university
 2. Large project contribution
 3. Optimize and Elegant Design
 4. Open project development for the market and client
 5. Job portal database.
 6. Proper documentation ,content writing, and technical writing.

In My company zero-group.com, i have many resume asking for training.But
while interview i have seen many of them not a tall aware of technology in
proper manner.
A part from that i mat with many people with their beautiful Idea to
implement.

Through Web2py interview we can achieve these goal in short time.
Please correct me if i am wrong.

Ramkrishan Bhatt
www.zero-group.com
+917597087495



Thanks and regards
Ramkrishan Bhatt
9972851368



On Tue, Feb 21, 2012 at 2:21 AM, Alan Etkin  wrote:

> > I have thought to implement this task for the building and filtering the
> > perfect candidates on web technology
>
> Would you please clarify that line?. I can't get the central idea of
> the message.


[web2py] Re: New member and new to web2py and need some clarification about file paths.

2012-02-20 Thread RKS
Thanks guys.

@Massimo

The 

[web2py] Re: BELONGS is not supported on GAE?

2012-02-20 Thread guruyaya
I think inner select belongs are not supported by GAE, but using an
array, is. Can anyone confirm what I just said (read the code, didn't
test it).


On 21 פברואר, 08:06, "Peter G."  wrote:
> I'm trying to obtain a set of rows whose ID values belongs in rows'
> fields of another table.
>
> Here's the code:
>
> # Construct a query to fetch all the mootid's from the group
> mootGroup =
> db(db.moot_groups.gid==groupid)._select(db.moot_groups.mootid)
> # Gets moots only if the moot ID exists in the Group query
> moots =
> db((db.moots.url==request.get_vars.url)&(db.moots.id.belongs(mootGroup))).s 
> elect(db.moots.ALL)
>
> The error in the admin says this:
> File "/base/data/home/apps/356965595645653415/gluon/dal.py", line
> 3367, in BELONGS
>     raise SyntaxError, "Not supported"
> SyntaxError: Not supported
>
> Thanks!


[web2py] Re: Passing arg from view to controller.

2012-02-20 Thread Annet
Hi Anthony,

Thanks for your reply.

> $(function() {
>   $("#no_table_locality_args").autocomplete({
>     source: "{{=URL('hubaddressbook', 'locality_args_autocomplete')}}" +
> "/" + $(select#no_table_word).val(),

I tried the above, which made the view's JavaScript invalid, I had to
add '' to make it valid JavaScript:

$('select#no_table_word').val()

Testing this, results in the following url:

http://127.0.0.1:8000/init/hubaddressbook/locality_args_autocomplete/?term=Ap


Adding option:selected: $('select#no_table_word
option:selected').val() as in http://api.jquery.com/val/ doesn't make
any difference. Also, according to the developer of the multiselect I
am using this should work: 
http://www.erichynds.com/jquery/jquery-ui-multiselect-widget/


When I hard code the .val() part with "Coach":

$(function() {
  $("#no_table_locality_args").autocomplete({
source: "{{=URL('hubaddressbook', 'locality_args_autocomplete')}}"
+ "/" + "Coach",
minLength: 2
  });

It all works. The url:

http://127.0.0.1:8000/init/hubaddressbook/locality_args_autocomplete/Coach?term=Ap


Could the problem have something to do with the format in which
the .val() function returns the value when using the jQuery UI
MultiSelect? In the html the value is stored in button.ui-multiselect
span



Coach



Kind regards,

Annet


[web2py] Re: Passing arg from view to controller.

2012-02-20 Thread Annet
Hi Anthony,

Thanks for your reply.

> $(function() {
>   $("#no_table_locality_args").autocomplete({
> source: "{{=URL('hubaddressbook', 'locality_args_autocomplete')}}" +
> "/" + $(select#no_table_word).val(),

I tried the above, which made the view's JavaScript invalid, I had to
add '' to make it valid JavaScript:

$('select#no_table_word').val()

Testing this, results in the following url:

.../init/hubaddressbook/locality_args_autocomplete/?term=Am

Adding option:selected: $('select#no_table_word
option:selected').val() as in http://api.jquery.com/val/ doesn't make
any difference. Also, according to the developer of the multiselect I
am using this should work: 
http://www.erichynds.com/jquery/jquery-ui-multiselect-widget/

When I hard code the .val() part with "Coach":

$(function() {
  $("#no_table_locality_args").autocomplete({
source: "{{=URL('hubaddressbook', 'locality_args_autocomplete')}}"
+ "/" + "Coach",
minLength: 2
  });

It all works. The url:

.../init/hubaddressbook/locality_args_autocomplete/Coach?term=Am

Could the problem have something to do with the format in which
the .val() function returns the value when using the jQuery UI
MultiSelect?


In the html the value is stored in button.ui-multiselect span



Coach


This: $("button.ui-multislect").val() and this: $("button.ui-
multislect span").val() results in this url:

.../init/hubaddressbook/locality_args_autocomplete/undefined?term=Am



Kind regards,

Annet


[web2py] Re: Enable and disable links in a view.

2012-02-20 Thread Annet
Hi Alan,

Thanks for your explanation. I got the idea now, and I think your
solution is easier to implement when I replace the divs containing the
links with list items.


Best regards,

Annet


[web2py] Re: Validate the Checkbox

2012-02-20 Thread whowhywhat
This should work. Although it is ugly (it gives a error message under
all the checkboxes :P ).. but does validate as you require. Please
check and let me know.

def multi_check_box():
form = FORM(TABLE(
 
TR("Type:",TD(INPUT(_type="checkbox",_name="options",_value="a",_size="0",requires
= IS_NOT_EMPTY())," A",
 
INPUT(_type="checkbox",_name="options",_value="b",_size="0")," B",
 
INPUT(_type="checkbox",_name="options",_value="c",_size="0")," C")),
TR("",INPUT(_type="submit",_value="SUBMIT" 
if form.accepts(request.vars,session):

return dict(form=form)

On Feb 21, 11:09 am, Sanjeet Kumar  wrote:
> TR("Type:",(TD(INPUT(_type="checkbox",_name="a",_value="a",_size="0"),"A"))),
>
> (TD(INPUT(_type="checkbox",_name="b",_value="b",_size="0"),"B")),
>
> (TD(INPUT(_type="checkbox",_name="c",_value="c",_size="0"),"C"))),
> TR("",INPUT(_type="submit",_value="SUBMIT" ))
>
>
>
>
>
>
>
> On Tue, Feb 21, 2012 at 11:28 AM, whowhywhat  wrote:
> > please could post your controller code..
>
> > On Feb 21, 10:32 am, Sanjeet Kumar  wrote:
> > > I have the multiple check-box in one row in Controller I want to validate
> > > it form controller when the user submit his request without selecting any
> > > of the check-box than it should be shown the error message "Please select
> > > at least one check-box"


[web2py] Re: Validate the Checkbox

2012-02-20 Thread whowhywhat
You can also just write a jquery validator for the same..

On Feb 21, 12:49 pm, whowhywhat  wrote:
> This should work. Although it is ugly (it gives a error message under
> all the checkboxes :P ).. but does validate as you require. Please
> check and let me know.
>
> def multi_check_box():
>     form = FORM(TABLE(
>
> TR("Type:",TD(INPUT(_type="checkbox",_name="options",_value="a",_size="0",requires
> = IS_NOT_EMPTY())," A",
>
> INPUT(_type="checkbox",_name="options",_value="b",_size="0")," B",
>
> INPUT(_type="checkbox",_name="options",_value="c",_size="0")," C")),
>             TR("",INPUT(_type="submit",_value="SUBMIT" 
>     if form.accepts(request.vars,session):
>
>     return dict(form=form)
>
> On Feb 21, 11:09 am, Sanjeet Kumar  wrote:
>
>
>
>
>
>
>
> > TR("Type:",(TD(INPUT(_type="checkbox",_name="a",_value="a",_size="0"),"A"))),
>
> > (TD(INPUT(_type="checkbox",_name="b",_value="b",_size="0"),"B")),
>
> > (TD(INPUT(_type="checkbox",_name="c",_value="c",_size="0"),"C"))),
> > TR("",INPUT(_type="submit",_value="SUBMIT" ))
>
> > On Tue, Feb 21, 2012 at 11:28 AM, whowhywhat  wrote:
> > > please could post your controller code..
>
> > > On Feb 21, 10:32 am, Sanjeet Kumar  wrote:
> > > > I have the multiple check-box in one row in Controller I want to 
> > > > validate
> > > > it form controller when the user submit his request without selecting 
> > > > any
> > > > of the check-box than it should be shown the error message "Please 
> > > > select
> > > > at least one check-box"