[web2py] Re: I am trying to login from Phonegap app into my web2py app, what's wrong here?

2016-08-27 Thread Steve Joe
Anyone there? Anthony?

On Friday, August 26, 2016 at 7:38:40 PM UTC+5:30, Steve Joe wrote:
>
> *db(db.auth_user.username == request.vars.username and 
> db.auth_user.password == CRYPT(request.vars.password)).select()*
>
>
> *if db(db.auth_user.username == request.vars.username and 
> db.auth_user.password == 
> CRYPT(digest_alg='md5')(request.vars.password)[0]).select():*
>
> Both of them don't work either. 
>
> On Friday, August 26, 2016 at 7:30:41 PM UTC+5:30, Niphlod wrote:
>>
>> fortunately the password doesn't get stored in plain text on web2py :D 
>> You need to apply CRYPT() before comparing. Read more about that on the 
>> book.
>>
>> On Friday, August 26, 2016 at 3:31:54 PM UTC+2, Steve Joe wrote:
>>>
>>> IN PHONEGAP:
>>>
>>> https://#someurl#.
>>> pythonanywhere.com/welcome/phonegap/login">
>>>   username:
>>>   
>>>   
>>>   Password:
>>>   
>>>   
>>>   
>>> 
>>>
>>>
>>> IN WEB2PY:
>>>
>>> def login():
>>> k="false"
>>> if db(db.auth_user.username == request.vars.username and 
>>> db.auth_user.password == request.vars.password).select():
>>> k="true"
>>> return locals()
>>>
>>> and in view I can see:
>>>
>>>  false 
>>> which means I got k as false.
>>>
>>> The username and pasword are correct according to my database but I 
>>> can't login. What should I do?
>>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: DAL size limit for query?

2016-08-27 Thread Marcello Console
thank you for your answer and sorry for the delay, i had been some days away.

at this time the code that fails is:
tabella = request.args[0]
response.headers['Content-Type']='text/x-csv'
response.headers['Content-Disposition']='attachment;filename="report.csv" '
dati = legacy_db().select(legacy_db[tabella].ALL)
s = cStringIO.StringIO()
dati.export_to_csv_file(s)


so i should use iterselect when defining dati, but when i try something like:
"""
for row in legacy_db(legacy_db.COD2.id > 0).iterselect():
   : rtn = row
   :
""
i get :
""
---
AttributeErrorTraceback (most recent call last)
/home/www-data/web2py/applications/PROVE/models/menu.py in ()
> 1 for row in legacy_db(legacy_db.COD2.id > 0).iterselect():
  2 rtn = row
  3

AttributeError: 'Set' object has no attribute 'iterselect'

""
moreover, i should 'append' the row to a pydal.objects.Rows
as to say
dati += row
but how can i do this?

Thank you a lot again


2016-08-04 9:52 GMT+02:00, c...@cemeren.com :
> You may try using iterselect() instead of select() if the issue is memory
> related.
>
> The link to the book is below.
>
> http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer?search=Using-an-iterator-based-select-for-lower-memory-use#Using-an-iterator-based-select-for-lower-memory-use
>
> On Thursday, August 4, 2016 at 10:35:13 AM UTC+3, goome wrote:
>>
>> 2016-08-04 1:08 GMT+02:00, Dave S >:
>> >
>> >
>> > On Wednesday, August 3, 2016 at 2:33:35 PM UTC-7, goome wrote:
>> >>
>> >> when trying in the shell, the shell itself got killed :
>> >> >> In [4]: legacy_db(query).select()
>> >> >>
>> >> >> Killed
>> >> >> root@rb:/home/www-data/web2py#
>> >>
>> >>
>> > Is that using web2py in a bash/python shell  (i.,e., -M -S myapp) ?
>> yes, this one
>>
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/nqUnVx62GE0/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: I am trying to login from Phonegap app into my web2py app, what's wrong here?

2016-08-27 Thread Kiran Subbaraman
The book can help you: 
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Logical-operators

You need to use the right operator in your query
You can also use the web2py debugger to figure out how your code works 
and values returned, at runtime.



Kiran Subbaraman
http://subbaraman.wordpress.com/about/

On Sat, 27-08-2016 2:50 PM, Steve Joe wrote:

Anyone there? Anthony?

On Friday, August 26, 2016 at 7:38:40 PM UTC+5:30, Steve Joe wrote:

*db(db.auth_user.username == request.vars.username and
db.auth_user.password == CRYPT(request.vars.password)).select()*
*
*
*if db(db.auth_user.username == request.vars.username and
db.auth_user.password ==
CRYPT(digest_alg='md5')(request.vars.password)[0]).select():
*

Both of them don't work either.

On Friday, August 26, 2016 at 7:30:41 PM UTC+5:30, Niphlod wrote:

fortunately the password doesn't get stored in plain text on
web2py :D You need to apply CRYPT() before comparing. Read
more about that on the book.

On Friday, August 26, 2016 at 3:31:54 PM UTC+2, Steve Joe wrote:

IN PHONEGAP:

https://#someurl#.pythonanywhere.com/welcome/phonegap/login
">
username:


Password:






IN WEB2PY:

def login():
k="false"
if db(db.auth_user.username == request.vars.username
and db.auth_user.password == request.vars.password).select():
k="true"
return locals()

and in view I can see:

 false
which means I got k as false.

The username and pasword are correct according to my
database but I can't login. What should I do?

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google 
Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to web2py+unsubscr...@googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.


--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups "web2py-users" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: var to follow user around

2016-08-27 Thread Anthony
Yes, that is the exact purpose of the session.

On Friday, August 26, 2016 at 5:02:50 PM UTC-4, Alex Glaros wrote:
>
> user selects one of several organization IDs to work with.  Instead of 
> putting the ID in a dict that has to get passed around to every controller 
> he goes to, is it safe/ok, to just keep the value in a session var?
>
> thanks
>
> Alex Glaros
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Djano channels

2016-08-27 Thread Ron Chatterjee
Have anyone had a chance to test out websocket_messaging.py 

? 

It works out of box as long the websocket is running in the back but kind 
of confusing to see it only works on localhost:. Wondering if anyway to 
redirect all the messages based on url: app/room?  Seems only last messages 
are viewable in a pop up. Would be nice to have more workable examples like 
a chat room demo or one to one demo.  



On Sunday, March 27, 2016 at 11:24:55 AM UTC-4, Massimo Di Pierro wrote:
>
> The fact is webrtc is pure JS. It is from client to client. Wether you use 
> Flask or Django or web2py or PHP or ASP to serve pages is irrelevant.
>
> Massimo
>
> On Sunday, 27 March 2016 10:05:06 UTC-5, Ron Chatterjee wrote:
>>
>> https://m.youtube.com/watch?v=uBV_KKGzNqQ
>>
>> Found that link that talks about it. But it uses flask. So for chatting 
>> use channels n realtime streaming n audio use webrtc. Learn something new 
>> everyday!  Thank you massimo. 
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Delete confirmation

2016-08-27 Thread Winter Kryz
Hello everybody,

I have a Datatable filled with registers from a database and for each row I 
have a 'delete' button, what I'm trying to do is display a modal 
(bootstrap) delete confirmation (yes/no) but I don't know how to pass the 
id of that particular register so I can delete from the database.

this is the database 
db.define_table('Carrera',
Field('descripcion','string', label='Descripción', requires 
= IS_NOT_EMPTY(error_message="Introduzca una descripción")),
Field('titulo', 'string', label='Título', requires = 
IS_NOT_EMPTY(error_message="Introduzca el nombre del título")),
Field('duracion', 'integer', label='Duración', requires = 
IS_NOT_EMPTY(error_message="Introduzca la duración (años) de la carrera")),
Field('unidadAcademica','reference UnidadAcademica', 
label='Unidad académica', requires = 
IS_IN_DB(db,db.UnidadAcademica.id,'%(descripcion)s', 
error_message="Seleccione una unidad académica") ),
Field('niveltitulacion','reference NivelTitulacion', 
label='Nivel titulación', requires = 
IS_IN_DB(db,db.NivelTitulacion.id,'%(descripcion)s', 
error_message="Seleccione un nivel de titulación") ),
format= ' %(descripcion)s'
   )

this is the modal
div id="myModal" class="modal fade">
  

  
   Confirmación 
  
  
   
   Si desea eliminar este registro, confirme su elección 
seleccionando 'Eliminar'
   o seleccione 'Cancelar' para regresar a la pagina de trabajo.
  
  
  
Cancel
Delete
  

  


this is the script that displays the modal
function myFunction() {
$('#myModal').modal('show');
return false;
};

What I need is to get the id of the register that I want to delete.

I hope someone can help me

Thanks :)

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.