[web2py] Re: Check to see if a field is in another table in a computed field

2016-02-12 Thread Greg White
At our facility we order a lot of unique items but also have an inventory 
of some items. I am trying to add some logic that when ordering an item, 
there is a check to see if the ordered item name is in the inventory 
(inventory.name). Then person ordering is made aware that a similar item is 
in inventory and maybe we need to pull that item out of inventory versus 
ordering that part if it is indeed the correct part, size, color etc... 

On Thursday, February 11, 2016 at 5:52:23 PM UTC-7, Anthony wrote:
>
> What are you trying to do? Do you want to store this information in the 
> POrequest table, or do you want to prevent inserts if the item is not in 
> the db.inventory table? If the latter, IS_IN_DB will certainly work, but 
> note that validators only get run if you are using SQLFORM or if you call 
> .validate_and_insert().
>
> Anthony
>
> On Thursday, February 11, 2016 at 6:02:16 PM UTC-5, Greg White wrote:
>>
>> I should have mentioned that I tried IS_IN_DB first off and it didn't work
>>
>> On Wednesday, February 10, 2016 at 4:25:48 PM UTC-7, Dave S wrote:
>>>
>>>
>>>
>>> On Wednesday, February 10, 2016 at 2:01:52 PM UTC-8, Greg White wrote:

 Want a computed field to show whether or not a field value exists in 
 another table

>>>
>>>
>>> I'm not sure that is the right approach.  I think that the standard 
>>> validator IS_IN_DB() is what you want, instead.
>>>
>>> >> http://web2py.com/books/default/chapter/29/07/forms-and-validators#Database-validators
>>> >
>>> (IS_IN_DB is the second validator in that section)
>>>
>>> The example shown appears to be similar to what I think you're trying to 
>>> do.
>>>
>>> /dps
>>>
>>>
 started with this...

 db.define_table(
 'inventory',
 Field('name'),
 Field('qty', label='Quantity'),
 Field('MatSize',label='Material Size'),
 format = '%(name)s') 

 db.define_table(
 'POrequest',
 Field('name', 'reference requestor', label='Requestor'),
 Field('JobNum', 'reference jobs', label='Job #'),
 Field('description', 'text', notnull=True),
 Field('InInventory', compute=lambda r: r['description'] IN r[
 db.inventory.name]),  <<< this row right here is what I need help with
 format = '%(name)s')

 trying to verify row by row in a computed field if 
 db.POrequest.description is in any row of db.inventory.name

 help please.

>>>

-- 
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: GRID export broken for CSV but not for JSON

2016-02-12 Thread Anthony
This can probably be improved, but the problem is that your grid does not 
include all the fields needed by the "represent" function (i.e., it is 
missing the "id" field). You could (a) re-write the represent so it doesn't 
fail when the "id" field is missing, (b) use one of the "hidden column" 
downloads instead, or (c) in the controller, check whether the request is 
for an export (i.e, '_export_type' in request.vars), and include the "id" 
field in that case.

Unfortunately, these solutions mean you either won't have the "represented" 
value in the CSV file (which you may not want anyway, as it is an HTML 
anchor tag in this case), or you will have extra fields that you otherwise 
might want excluded (in this case, the "id" field).

Note, you can also use the "exportclasses" argument to provide your own 
custom export class, and use something like option (c) above, but write the 
export class so it excludes any columns you want to hide.

Anthony

On Friday, February 12, 2016 at 5:01:40 PM UTC-5, olivier hubert wrote:
>
>
> I implemented a clone of Notifier application from Massimo.
> If I try to export data from the grid via the grid bottom button I receive 
> an error if I use export to CSV, HTML & TSV but not with JSON or XML.
>
> *default.py*
> @auth.requires_login()
> def tasks():
> db.task.created_on.readable = True
> db.task.created_by.readable = True
> db.task.title.represent = lambda title, row:A(title, _href=URL(
> 'view_task', args=row.id))
> query = (db.task.assigned_to==me)|(db.task.created_by==me)
> grid = SQLFORM.grid(query,
> orderby=~db.task.modified_on,
> create=False,
> details=False,
> editable=False,
> deletable=lambda row: (row.created_by==me),
> fields=[
> db.task.status,
> db.task.title,
> db.task.created_on,
> db.task.deadline,
> db.task.created_by,
> db.task.assigned_to
> ])
> return locals()
>
> *Traceback*
>
>  Traceback (most recent call last):
>  File "/home/sysadmin/Téléchargements/web2py/gluon/restricted.py", line 
> 227, in restricted
>  exec ccode in environment
>  File 
> "/home/sysadmin/Téléchargements/web2py/applications/tasklist/controllers/default.py"
>  
> 
> , line 134, in 
>  File "/home/sysadmin/Téléchargements/web2py/gluon/globals.py", line 412, 
> in 
>  self._caller = lambda f: f()
>  File "/home/sysadmin/Téléchargements/web2py/gluon/tools.py", line 4236, 
> in f
>  return action(*a, **b)
>  File 
> "/home/sysadmin/Téléchargements/web2py/applications/tasklist/controllers/default.py"
>  
> 
> , line 31, in tasks
>  db.task.assigned_to
>  File "/home/sysadmin/Téléchargements/web2py/gluon/sqlhtml.py", line 2440, 
> in grid
>  raise HTTP(200, oExp.export(), **response.headers)
>  File "/home/sysadmin/Téléchargements/web2py/gluon/sqlhtml.py", line 3468, 
> in export
>  self.rows.export_to_csv_file(s, represent=True)
>  File "/home/sysadmin/.local/lib/python2.7/site-packages/pydal/objects.py"
> , line 2412, in export_to_csv_file
>  value = field.represent(value, record)
>  File 
> "/home/sysadmin/Téléchargements/web2py/applications/tasklist/controllers/default.py"
>  
> 
> , line 17, in 
>  db.task.title.represent = lambda title, row:A(title, _href=URL(
> 'view_task', args=row.id))
>  File "/home/sysadmin/.local/lib/python2.7/site-packages/pydal/objects.py"
> , line 90, in __getattr__
>  raise AttributeError
> AttributeError
>
>
> The error come from the bellow code line from the file default.py
> db.task.title.represent = lambda title, row:A(title, _href=URL('view_task'
> , args=row.id))
>
> If I remove the previous row the export function work for all format but I 
> lose the cliquable link on the task title.
>
> I checked with the Notifier application available on GitHub 
> https://github.com/mdipierro/web2py-appliances/tree/master/Notifier and I 
> see the same problem.
>
> If you can help me it's very appreciate.
>
> Kind regards
> Olivier
>
>
>
>

-- 
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: GRID export broken for CSV but not for JSON

2016-02-12 Thread Anthony
Which version of web2py?

On Friday, February 12, 2016 at 5:01:40 PM UTC-5, olivier hubert wrote:
>
>
> I implemented a clone of Notifier application from Massimo.
> If I try to export data from the grid via the grid bottom button I receive 
> an error if I use export to CSV, HTML & TSV but not with JSON or XML.
>
> *default.py*
> @auth.requires_login()
> def tasks():
> db.task.created_on.readable = True
> db.task.created_by.readable = True
> db.task.title.represent = lambda title, row:A(title, _href=URL(
> 'view_task', args=row.id))
> query = (db.task.assigned_to==me)|(db.task.created_by==me)
> grid = SQLFORM.grid(query,
> orderby=~db.task.modified_on,
> create=False,
> details=False,
> editable=False,
> deletable=lambda row: (row.created_by==me),
> fields=[
> db.task.status,
> db.task.title,
> db.task.created_on,
> db.task.deadline,
> db.task.created_by,
> db.task.assigned_to
> ])
> return locals()
>
> *Traceback*
>
>  Traceback (most recent call last):
>  File "/home/sysadmin/Téléchargements/web2py/gluon/restricted.py", line 
> 227, in restricted
>  exec ccode in environment
>  File 
> "/home/sysadmin/Téléchargements/web2py/applications/tasklist/controllers/default.py"
>  
> 
> , line 134, in 
>  File "/home/sysadmin/Téléchargements/web2py/gluon/globals.py", line 412, 
> in 
>  self._caller = lambda f: f()
>  File "/home/sysadmin/Téléchargements/web2py/gluon/tools.py", line 4236, 
> in f
>  return action(*a, **b)
>  File 
> "/home/sysadmin/Téléchargements/web2py/applications/tasklist/controllers/default.py"
>  
> 
> , line 31, in tasks
>  db.task.assigned_to
>  File "/home/sysadmin/Téléchargements/web2py/gluon/sqlhtml.py", line 2440, 
> in grid
>  raise HTTP(200, oExp.export(), **response.headers)
>  File "/home/sysadmin/Téléchargements/web2py/gluon/sqlhtml.py", line 3468, 
> in export
>  self.rows.export_to_csv_file(s, represent=True)
>  File "/home/sysadmin/.local/lib/python2.7/site-packages/pydal/objects.py"
> , line 2412, in export_to_csv_file
>  value = field.represent(value, record)
>  File 
> "/home/sysadmin/Téléchargements/web2py/applications/tasklist/controllers/default.py"
>  
> 
> , line 17, in 
>  db.task.title.represent = lambda title, row:A(title, _href=URL(
> 'view_task', args=row.id))
>  File "/home/sysadmin/.local/lib/python2.7/site-packages/pydal/objects.py"
> , line 90, in __getattr__
>  raise AttributeError
> AttributeError
>
>
> The error come from the bellow code line from the file default.py
> db.task.title.represent = lambda title, row:A(title, _href=URL('view_task'
> , args=row.id))
>
> If I remove the previous row the export function work for all format but I 
> lose the cliquable link on the task title.
>
> I checked with the Notifier application available on GitHub 
> https://github.com/mdipierro/web2py-appliances/tree/master/Notifier and I 
> see the same problem.
>
> If you can help me it's very appreciate.
>
> Kind regards
> Olivier
>
>
>
>

-- 
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: web2py csv files

2016-02-12 Thread Anthony
You don't need the id field. The best approach might be to add a few dummy 
records to the table and export to CSV -- then look at the structure of 
that file.

Anthony

On Friday, February 12, 2016 at 5:01:41 PM UTC-5, Felipe dos Santos 
Ferreira wrote:
>
> Hi guys,
>
> I am new to web2py. Recently I was trying to import some data from a csv 
> file to my sqlite database through the web2py admin area.
>
> The problem was I had to create several different csv files untilll I've 
> found one which I could import properly.
>
> All the others files i've had tried returned error (index out of range) or 
> fill up the tables with null values in every single field.
>
> I would like to know if someone has a csv file as an example to post for 
> me or tell me the proper way to create this file. 
>
> Do I have to use the 'id' field? Do I have to use double quotes, single 
> quotes, no quotes? Please, be kind to me, I am a newbie haha
>
> :D
>

-- 
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: Script timed out before returning headers: wsgihandler.py - web2py v2.8.2

2016-02-12 Thread Jim S
Chad

I've seen this problem with nginx and it is due to the nginx and/or uwsgi 
timeout values being set too low.  Do apache/mod_wsgi have similar parms 
you could adjust?

-Jim

On Friday, February 12, 2016 at 4:01:40 PM UTC-6, cseb...@wisc.edu wrote:
>
>
> Today our alert system notified us that the websites were not accessible. 
> I looked into the apache logs during the time of the website outage and I 
> observed a bunch of these errors:
>
>
> [Fri Feb 12 00:58:05 2016] [error] [client 195.159.183.42] Script timed 
> out before returning headers: wsgihandler.py, referer: 
> https://www.google.no
>
> I see that this google group does have a thread opened previously about 
> this error, and it looks like the user made the switch from apache to 
> nginx, which is something I do not want to do. I've turned on logging in 
> the wsgihandler.py and looked in httpserver.log, and all I observe in there 
> is that it was no longer processing "GET" requests. When the apache service 
> was restarted, it started processing GET requests. Is there any way to get 
> more verbose information from this process? I've tried increasing the 
> number of processes from 1 to 3 for the WSGI daemon in the apache config 
> but I am still getting this problem. It has happened twice now in the past 
> month. 
>
> Any insight would be helpful!
>
> Chad
>

-- 
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: what is equivalent query related to this in web2py

2016-02-12 Thread Massimo Di Pierro
That code is vulnerable to SQL injection. Anybody can login without a 
password with that code.



On Friday, 12 February 2016 04:21:50 UTC-6, prashant joshi wrote:
>
> *This is in java*
>
> String user = req.getParameter("userName");
> String pass = req.getParameter("userPassword");
>
> pw.print("");
>
> if (user.equals("select * from login where userId="+user+"and password"+pass) 
> )
> pw.println("Login Success...!");
> else
> pw.println("Login Failed...!");
>
>

-- 
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] web2py csv files

2016-02-12 Thread Felipe dos Santos Ferreira
Hi guys,

I am new to web2py. Recently I was trying to import some data from a csv 
file to my sqlite database through the web2py admin area.

The problem was I had to create several different csv files untilll I've 
found one which I could import properly.

All the others files i've had tried returned error (index out of range) or 
fill up the tables with null values in every single field.

I would like to know if someone has a csv file as an example to post for me 
or tell me the proper way to create this file. 

Do I have to use the 'id' field? Do I have to use double quotes, single 
quotes, no quotes? Please, be kind to me, I am a newbie haha

:D

-- 
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] reading from external db

2016-02-12 Thread yarecki wr
I'm quite new to Python and web2py hence when I started a little project 
for displaying some stats on a website I quickly got to points where I just 
got stack. I'll describe one hopefully someone would help with and provide 
some explanations. Basically it work but for the moment mostly manual which 
isn't that great. I define my table

db.define_table('table_1',
   Field('name',length=20,label='Name')...
   ...
   format='%(Name)s'
)
### then in Controler

def stats():
   db.table_1.id.readable = False
   db.table_1.stat1.represent = lambda value, row: stat(value)...
   ...
   return dict(stattable=SQLFORM.grid(db.table_1, 
This gives me a nice web page where I can display all my stats and modify 
them as needed.

Then the need came to automate it somehow so I created a simple mySQL db 
where I feed my stats. New to databases so that was another challenge but I 
found a YT the basics of mySQL in 30 minutes :) Now I'd like to get the 
data from the external db to replace the values in w2p internal db where a 
row with the same name exists and add new rows where it doesn't.

import mySQLdb
def stat_db():
statdb = MySQLdb.connect(host=
cur = statdb.cursor()   ### I goggled this bit :)

### here are my internal db fields
fields = db(db.table_1.id>0).select(db.tabela_1.name, distinct=True, 
orderby=db.table_1.name)  
### and the external db rows
cur.execute("select * from statdb")
rows= cur.fetchall()

So I suppose this gets all the rows from my external db but no idea how I 
would look for the right row in the internal db to replace the values. The 
common field in both db's is the 'name'. 

-- 
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: markmin.js

2016-02-12 Thread Massimo Di Pierro
Yes.

On Thursday, 11 February 2016 09:02:42 UTC-6, Niphlod wrote:
>
> hardly 99%  it's another markmin version entirely :°°°D
>
> On Thursday, February 11, 2016 at 3:48:49 PM UTC+1, Massimo Di Pierro 
> wrote:
>>
>> For basic thinks like **bold**, ''italic'', ``code``, it is the same. But 
>> the python version does not support embedded html. The JS version does not 
>> support tables and nested lists. The python version uses the format [[label 
>> http:// image]] while the JS version uses the format image:http:// 
>> (same for video and audio and frames). The JS version does not support 
>> ``...``:class_name.
>>
>> I like the JS version because it is cleaner and faster and if something 
>> is nor supported one can use html.
>>
>>
>>
>> On Thursday, 11 February 2016 03:26:11 UTC-6, Niphlod wrote:
>>>
>>> what is not 100% compatible ? if we want to push this, we should promote 
>>> it instead of relying on python code
>>>
>>> On Thursday, February 11, 2016 at 4:55:19 AM UTC+1, Massimo Di Pierro 
>>> wrote:

 and the link:

 https://github.com/mdipierro/markmin.js

 On Wednesday, 10 February 2016 21:55:06 UTC-6, Massimo Di Pierro wrote:
>
> I have a new version of markmin.js I recommend this over the python 
> implementation. It is better to render on the client because oembed does 
> not require setting up server side caching. The JS version allows 
> sanitized 
> HTML. Also the heavy lifting is moved to the client. It is not 100% 
> compatible but very close. 
>


-- 
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: web2py Italy

2016-02-12 Thread Massimo Di Pierro
Ma certo!


On Thursday, 11 February 2016 08:42:15 UTC-6, Francesco Ronzitti wrote:
>
> Sarebbe bello fossimo nella lista...
> http://www.web2py.com/examples/default/usergroups
>
> Un saluto a tutti i Devel Ita
>
> Il giorno mercoledì 18 dicembre 2013 20:57:17 UTC+1, Gael Princivalle ha 
> scritto:
>>
>> Comunque direi che per ovvi motivi il web2py-users rimane lo strumento 
>> principale per porre domande. A noi users italiani di fare comunità e di 
>> mettere in web2py-it quello che ci sembra congruo per darci uno strumento 
>> complementare.
>>
>>
>>

-- 
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] Script timed out before returning headers: wsgihandler.py - web2py v2.8.2

2016-02-12 Thread csebranek

Today our alert system notified us that the websites were not accessible. I 
looked into the apache logs during the time of the website outage and I 
observed a bunch of these errors:


[Fri Feb 12 00:58:05 2016] [error] [client 195.159.183.42] Script timed out 
before returning headers: wsgihandler.py, referer: https://www.google.no

I see that this google group does have a thread opened previously about 
this error, and it looks like the user made the switch from apache to 
nginx, which is something I do not want to do. I've turned on logging in 
the wsgihandler.py and looked in httpserver.log, and all I observe in there 
is that it was no longer processing "GET" requests. When the apache service 
was restarted, it started processing GET requests. Is there any way to get 
more verbose information from this process? I've tried increasing the 
number of processes from 1 to 3 for the WSGI daemon in the apache config 
but I am still getting this problem. It has happened twice now in the past 
month. 

Any insight would be helpful!

Chad

-- 
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] GRID export broken for CSV but not for JSON

2016-02-12 Thread olivier hubert

I implemented a clone of Notifier application from Massimo.
If I try to export data from the grid via the grid bottom button I receive 
an error if I use export to CSV, HTML & TSV but not with JSON or XML.

*default.py*
@auth.requires_login()
def tasks():
db.task.created_on.readable = True
db.task.created_by.readable = True
db.task.title.represent = lambda title, row:A(title, _href=URL(
'view_task', args=row.id))
query = (db.task.assigned_to==me)|(db.task.created_by==me)
grid = SQLFORM.grid(query,
orderby=~db.task.modified_on,
create=False,
details=False,
editable=False,
deletable=lambda row: (row.created_by==me),
fields=[
db.task.status,
db.task.title,
db.task.created_on,
db.task.deadline,
db.task.created_by,
db.task.assigned_to
])
return locals()

*Traceback*

 Traceback (most recent call last):
 File "/home/sysadmin/Téléchargements/web2py/gluon/restricted.py", line 227, 
in restricted
 exec ccode in environment
 File 
"/home/sysadmin/Téléchargements/web2py/applications/tasklist/controllers/default.py"
 
, 
line 134, in 
 File "/home/sysadmin/Téléchargements/web2py/gluon/globals.py", line 412, in 

 self._caller = lambda f: f()
 File "/home/sysadmin/Téléchargements/web2py/gluon/tools.py", line 4236, in 
f
 return action(*a, **b)
 File 
"/home/sysadmin/Téléchargements/web2py/applications/tasklist/controllers/default.py"
 
, 
line 31, in tasks
 db.task.assigned_to
 File "/home/sysadmin/Téléchargements/web2py/gluon/sqlhtml.py", line 2440, 
in grid
 raise HTTP(200, oExp.export(), **response.headers)
 File "/home/sysadmin/Téléchargements/web2py/gluon/sqlhtml.py", line 3468, 
in export
 self.rows.export_to_csv_file(s, represent=True)
 File "/home/sysadmin/.local/lib/python2.7/site-packages/pydal/objects.py", 
line 2412, in export_to_csv_file
 value = field.represent(value, record)
 File 
"/home/sysadmin/Téléchargements/web2py/applications/tasklist/controllers/default.py"
 
, 
line 17, in 
 db.task.title.represent = lambda title, row:A(title, _href=URL('view_task', 
args=row.id))
 File "/home/sysadmin/.local/lib/python2.7/site-packages/pydal/objects.py", 
line 90, in __getattr__
 raise AttributeError
AttributeError


The error come from the bellow code line from the file default.py
db.task.title.represent = lambda title, row:A(title, _href=URL('view_task', 
args=row.id))

If I remove the previous row the export function work for all format but I 
lose the cliquable link on the task title.

I checked with the Notifier application available on GitHub 
https://github.com/mdipierro/web2py-appliances/tree/master/Notifier and I 
see the same problem.

If you can help me it's very appreciate.

Kind regards
Olivier



-- 
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] Seeking guidance with linked tables and smart grids

2016-02-12 Thread drew Roberts
As I learning exercise I have set up a little volunteer database.

You can recreate by doing the following:

1. Create a new simple application called smartgridex

2. At the bottom of db.py paste the following:

db.define_table('volunteer',
  Field('firstname', requires=[IS_NOT_EMPTY()]),
  Field('lastname', requires=[IS_NOT_EMPTY()]),
  Field('street'),
  Field('city'),
  Field('state'),
  Field('zip'),
  Field('phone'),
  format='%(firstname)s'
  )

db.define_table('availability',
  Field('avail_name', requires=[IS_NOT_EMPTY(), IS_ALPHANUMERIC()]),
  Field('volid', 'reference volunteer', requires=IS_IN_DB(db, 
'volunteer.id', '%(firstname)s')),
  Field('day', 'date', requires=[IS_NOT_EMPTY()]),
  Field('start_time', 'time'),
  Field('end_time', 'time')
  )
db.availability.volid.represent = lambda id, r: str(id) + ' | ' + 
db.volunteer[id].firstname

db.define_table('skill',
  Field('skill_description', requires=[IS_NOT_EMPTY()])
  )

db.define_table('skills_known',
  Field('volid', 'reference volunteer', requires=IS_IN_DB(db, 
'volunteer.id', '%(firstname)s')),
  Field('skillid', 'reference skill', requires=IS_IN_DB(db, 'skill.id', 
'%(skill_description)s')),
  Field('notes', 'text')
  )
db.skills_known.volid.represent = lambda id, r: str(id) + ' | ' + 
db.volunteer[id].firstname
db.skills_known.skillid.represent = lambda id, r: str(id) + ' | ' + 
db.skill[id].skill_description

db.define_table('job',
  Field('volid', 'reference volunteer', requires=IS_IN_DB(db, 
'volunteer.id', '%(firstname)s')),
  Field('job_date', 'date', requires=[IS_NOT_EMPTY()]),
  Field('start_time', 'time'),
  Field('estimated_duration', requires=[IS_NOT_EMPTY()]),
  Field('supervisor', requires=[IS_NOT_EMPTY()]),
  Field('job_description', requires=[IS_NOT_EMPTY()]),
  Field('end_time', 'time'),
  Field('worked_flag', 'boolean')
  )

3. at the bottom of default.py paste the following:

def all_volunteers():
grid = SQLFORM.smartgrid(db.volunteer,linked_tables=['availability', 
'skills_known', 'job'])
return locals()


def all_availabilities():
grid = SQLFORM.grid(db.availability)
return locals()

def all_skills():
grid = SQLFORM.smartgrid(db.skill,linked_tables=['skills_known'])
return locals()


def all_skills_known():
grid = SQLFORM.grid(db.skills_known)
return locals()

def all_jobs():
grid = SQLFORM.grid(db.job)
return locals()

4. Replace default/index.html with the following:

{{left_sidebar_enabled,right_sidebar_enabled=False,True}}
{{extend 'layout.html'}}

{{=T('What Now?')}}

  {{=A('Show All Volunteers', _href="all_volunteers")}}
  {{=A('Show All Availabilities', _href="all_availabilities")}}
  {{=A('Show All Skills', _href="all_skills")}}
  {{=A('Show All Skills Known', _href="all_skills_known")}}
  {{=A('Show All Jobs', _href="all_jobs")}}



It all kind of works but it has issues and I feel certain that there must 
be a better way.

1. The query option does not show the linked to columns, only the native 
columns. See the Show All Skills Known option number 4.

2. I am having to play these sorts of games:

db.skills_known.volid.represent = lambda id, r: str(id) + ' | ' + 
db.volunteer[id].firstname

because I cannot do a query and search on the displayed info but only on 
the underlying "id"

3. Is there a better way to do the table defines for this sort of thing?

all the best,

drew

-- 
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: Displalay a form in light box or pop up window in view

2016-02-12 Thread billmackalister
I got to tell you...this is way more fun than Django. In django all I am 
worried using that is the framework and url redirect. Here,  the least 
thing to worry about is framework and I can focus more on the development 
and logic! Add such a helpful community. Thank you for all your help!

On Friday, February 12, 2016 at 4:36:56 PM UTC-5, billmac...@gmail.com 
wrote:
>
> Look at that!
>
> request.args(0)
> '1'
>
> Thank you Val. This is great. 
>
> On Friday, February 12, 2016 at 4:25:18 PM UTC-5, billmac...@gmail.com 
> wrote:
>>
>> My bad. I forgot the my_util.py
>>
>> On Friday, February 12, 2016 at 4:10:00 PM UTC-5, Val K wrote:
>>>
>>> it's easy:
>>> 1. Place modal_wrapper() function in  your_web2py_app/modUles  named 
>>> 'my_util.py' (just for example) - you have to import html-helpers in it:  
>>>
>>> from gluon.html import *
>>>
>>>  2. In view place:
>>> ...
>>> {{=BUTTON( 'Apply',_type="button",_class = "btn 
>>> btn-default",_onclick="$('#*cont_id*').modal('show')")}} 
>>>
>>> {{from my_util import *}}
>>>
>>> {{=modal_wrapper(   LOAD(f='*modal_content**.load*', *args=id,*   ajax=
>>> True, ajax_trap=True  )  , _id='*cont_id*', header='Header', 
>>> footer='footer')  }} 
>>>
>>> 3. Remove all about modal from main_page() 
>>>
>>>
>>>
>>>  писал(а) в своём письме Fri, 12 Feb 2016 
>>> 23:40:08 +0300:
>>>
>>> What I mean by passing argument from the view to the controller is this 
>>> (let us consider in my view):
>>>
>>>
>>> (1) >>  href="{{=URL('my_controler_def',args=id)}}">Apply
>>>
>>> (2) Apply
>>>
>>>
>>> In the above (1) is calling that URL with an argument id. (2) is a 
>>> button, when I click on that, it goes to the controller function 
>>> my_controler_def, and in my_controler_def I will have that "id" argument 
>>> passed on.
>>>
>>> I was hoping to do the same with the model. That with a button I can 
>>> pass an argument from my view to the controller modal_content 
>>>
>>>
>>>
>>> On Friday, February 12, 2016 at 3:29:47 PM UTC-5, Val K wrote:


 OK,  but what do you mean under "pass that argument from my view" ?
 view is processed and rendered to html page at server side,   JS runs 
 only  on the client side.
 so, if you can pass arg from veiw (i.e. arg is defined on server side), 
 also  you can pass it in main_page():

 def main_page():

 main_pg=DIV()
 
 m_cont = LOAD(f='*modal_content**.load*', *args=[1],*   ajax=True, 
 ajax_trap=True  )  # - must works, I'm sure while modal_content() runs  
 "int(request.args(0)) 
 == 1"  will be true
...




  писал(а) в своём письме Fri, 12 Feb 2016 
 23:04:08 +0300:

 What I have done with your code is change the contoller to be:


 def main_page():
 main_pg=DIV('hello world')
 m_cont = LOAD(f='modal_content.load', ajax=True, ajax_trap=True  )  
 dialog = modal_wrapper(m_cont, _id='cont_id', header='Header', 
 footer='footer')
 #show_modal_btn = BUTTON( 'Show modal',_type="button",_class = "btn 
 btn-default",_onclick=""" $('#cont_id').modal('show')   """)
 #don't forget to add dialog and show_modal_btn to main page
 #main_pg.append(show_modal_btn)   # or main_pg.append( 
 DIV(show_modal_btn)  ) or something else
 main_pg.append(dialog)
 return dict(main_pg = main_pg)


 And in my view I have (I am making an example here):

 {{extend 'layout.html'}}
 {{=main_pg}}

 {{=BUTTON( 'Apply',_type="button",_class = "btn 
 btn-default",_onclick="$('#cont_id').modal('show')")}}

 Works fine. Because I see the button and I click and see the pop up. 
 Great. Only issue is, I need to update the table with my argument. For 
 example:

 def modal_content():
 db.mytable.id.default = request.args(0) #Just an example.
 form = SQLFORM(db.mytable) # or even form = SQLFORM.grid(...)
 return dict(form=form)


 So, I need to pass that argument from my view to the controller of the 
 form. Only thing I have at my disposal is the button. 



 On Friday, February 12, 2016 at 2:25:36 PM UTC-5, Val K wrote:
>
>
> I mean passing args/vars in main_page(): 
>
> def main_page():
>
> main_pg=DIV()
> 
> m_cont = LOAD(f='*modal_content**.load*', *args=[  args>],  vars={ }*,   ajax=True, ajax_trap=True  ) 
>  
>...
>
>
>
> But may be you want to pass something from client side, i.e. args  are 
> defined by some user action.
> What exactly do you want to do?
>
>
>
>
>
> On Friday, February 12, 2016 at 10:00:22 PM UTC+3, 
> billmac...@gmail.com wrote:
>>
>> In the book it says load in the view. Nothing in the controller.  I 
>> was just wondering if we can add a button in the view and call the ajax 
>> from the view with the argume

Re: [web2py] Re: Displalay a form in light box or pop up window in view

2016-02-12 Thread billmackalister
Look at that!

request.args(0)
'1'

Thank you Val. This is great. 

On Friday, February 12, 2016 at 4:25:18 PM UTC-5, billmac...@gmail.com 
wrote:
>
> My bad. I forgot the my_util.py
>
> On Friday, February 12, 2016 at 4:10:00 PM UTC-5, Val K wrote:
>>
>> it's easy:
>> 1. Place modal_wrapper() function in  your_web2py_app/modUles  named 
>> 'my_util.py' (just for example) - you have to import html-helpers in it:  
>>
>> from gluon.html import *
>>
>>  2. In view place:
>> ...
>> {{=BUTTON( 'Apply',_type="button",_class = "btn 
>> btn-default",_onclick="$('#*cont_id*').modal('show')")}} 
>>
>> {{from my_util import *}}
>>
>> {{=modal_wrapper(   LOAD(f='*modal_content**.load*', *args=id,*   ajax=
>> True, ajax_trap=True  )  , _id='*cont_id*', header='Header', 
>> footer='footer')  }} 
>>
>> 3. Remove all about modal from main_page() 
>>
>>
>>
>>  писал(а) в своём письме Fri, 12 Feb 2016 23:40:08 
>> +0300:
>>
>> What I mean by passing argument from the view to the controller is this 
>> (let us consider in my view):
>>
>>
>> (1) >  href="{{=URL('my_controler_def',args=id)}}">Apply
>>
>> (2) Apply
>>
>>
>> In the above (1) is calling that URL with an argument id. (2) is a 
>> button, when I click on that, it goes to the controller function 
>> my_controler_def, and in my_controler_def I will have that "id" argument 
>> passed on.
>>
>> I was hoping to do the same with the model. That with a button I can pass 
>> an argument from my view to the controller modal_content 
>>
>>
>>
>> On Friday, February 12, 2016 at 3:29:47 PM UTC-5, Val K wrote:
>>>
>>>
>>> OK,  but what do you mean under "pass that argument from my view" ?
>>> view is processed and rendered to html page at server side,   JS runs 
>>> only  on the client side.
>>> so, if you can pass arg from veiw (i.e. arg is defined on server side), 
>>> also  you can pass it in main_page():
>>>
>>> def main_page():
>>>
>>> main_pg=DIV()
>>> 
>>> m_cont = LOAD(f='*modal_content**.load*', *args=[1],*   ajax=True, 
>>> ajax_trap=True  )  # - must works, I'm sure while modal_content() runs  
>>> "int(request.args(0)) 
>>> == 1"  will be true
>>>...
>>>
>>>
>>>
>>>
>>>  писал(а) в своём письме Fri, 12 Feb 2016 
>>> 23:04:08 +0300:
>>>
>>> What I have done with your code is change the contoller to be:
>>>
>>>
>>> def main_page():
>>> main_pg=DIV('hello world')
>>> m_cont = LOAD(f='modal_content.load', ajax=True, ajax_trap=True  )  
>>> dialog = modal_wrapper(m_cont, _id='cont_id', header='Header', 
>>> footer='footer')
>>> #show_modal_btn = BUTTON( 'Show modal',_type="button",_class = "btn 
>>> btn-default",_onclick=""" $('#cont_id').modal('show')   """)
>>> #don't forget to add dialog and show_modal_btn to main page
>>> #main_pg.append(show_modal_btn)   # or main_pg.append( 
>>> DIV(show_modal_btn)  ) or something else
>>> main_pg.append(dialog)
>>> return dict(main_pg = main_pg)
>>>
>>>
>>> And in my view I have (I am making an example here):
>>>
>>> {{extend 'layout.html'}}
>>> {{=main_pg}}
>>>
>>> {{=BUTTON( 'Apply',_type="button",_class = "btn 
>>> btn-default",_onclick="$('#cont_id').modal('show')")}}
>>>
>>> Works fine. Because I see the button and I click and see the pop up. 
>>> Great. Only issue is, I need to update the table with my argument. For 
>>> example:
>>>
>>> def modal_content():
>>> db.mytable.id.default = request.args(0) #Just an example.
>>> form = SQLFORM(db.mytable) # or even form = SQLFORM.grid(...)
>>> return dict(form=form)
>>>
>>>
>>> So, I need to pass that argument from my view to the controller of the 
>>> form. Only thing I have at my disposal is the button. 
>>>
>>>
>>>
>>> On Friday, February 12, 2016 at 2:25:36 PM UTC-5, Val K wrote:


 I mean passing args/vars in main_page(): 

 def main_page():

 main_pg=DIV()
 
 m_cont = LOAD(f='*modal_content**.load*', *args=[ >>> args>],  vars={ }*,   ajax=True, ajax_trap=True  )  
...



 But may be you want to pass something from client side, i.e. args  are 
 defined by some user action.
 What exactly do you want to do?





 On Friday, February 12, 2016 at 10:00:22 PM UTC+3, billmac...@gmail.com 
 wrote:
>
> In the book it says load in the view. Nothing in the controller.  I 
> was just wondering if we can add a button in the view and call the ajax 
> from the view with the argument. If we need to call the LOAD from the 
> view, 
> its
>
> {{=LOAD('default','manage_things',ajax=True)}}
>
> Then it fails for m_count. 
>
>
> On Friday, February 12, 2016 at 12:20:10 AM UTC-5, Val K wrote:
>>
>> LOAD() works like URL(), so,  to pass args/vars to modal_content you 
>> could write
>> m_cont = LOAD(f='*modal_content**.load*', *args=[ ],  vars={ }*,   
>> ajax=True, ajax_trap=True  )  # see LOAD in web2py book
>>
>> in modal_content controller there is 

Re: [web2py] Re: Displalay a form in light box or pop up window in view

2016-02-12 Thread billmackalister


y", line 12, in modal_wrapper
close_cross = BUTTON(SPAN(XML('×'), 
**{'_aria-hidden':"true"}),_type="button",  
_class="close",data={'dismiss':"modal"},**{'_aria-label':"Close"})
NameError: global name 'BUTTON' is not defined


How do I get the BUTTON to work in my_util?


O n Friday, February 12, 2016 at 4:25:18 PM UTC-5, billmac...@gmail.com 
wrote:
>
> My bad. I forgot the my_util.py
>
> On Friday, February 12, 2016 at 4:10:00 PM UTC-5, Val K wrote:
>>
>> it's easy:
>> 1. Place modal_wrapper() function in  your_web2py_app/modUles  named 
>> 'my_util.py' (just for example) - you have to import html-helpers in it:  
>>
>> from gluon.html import *
>>
>>  2. In view place:
>> ...
>> {{=BUTTON( 'Apply',_type="button",_class = "btn 
>> btn-default",_onclick="$('#*cont_id*').modal('show')")}} 
>>
>> {{from my_util import *}}
>>
>> {{=modal_wrapper(   LOAD(f='*modal_content**.load*', *args=id,*   ajax=
>> True, ajax_trap=True  )  , _id='*cont_id*', header='Header', 
>> footer='footer')  }} 
>>
>> 3. Remove all about modal from main_page() 
>>
>>
>>
>>  писал(а) в своём письме Fri, 12 Feb 2016 23:40:08 
>> +0300:
>>
>> What I mean by passing argument from the view to the controller is this 
>> (let us consider in my view):
>>
>>
>> (1) >  href="{{=URL('my_controler_def',args=id)}}">Apply
>>
>> (2) Apply
>>
>>
>> In the above (1) is calling that URL with an argument id. (2) is a 
>> button, when I click on that, it goes to the controller function 
>> my_controler_def, and in my_controler_def I will have that "id" argument 
>> passed on.
>>
>> I was hoping to do the same with the model. That with a button I can pass 
>> an argument from my view to the controller modal_content 
>>
>>
>>
>> On Friday, February 12, 2016 at 3:29:47 PM UTC-5, Val K wrote:
>>>
>>>
>>> OK,  but what do you mean under "pass that argument from my view" ?
>>> view is processed and rendered to html page at server side,   JS runs 
>>> only  on the client side.
>>> so, if you can pass arg from veiw (i.e. arg is defined on server side), 
>>> also  you can pass it in main_page():
>>>
>>> def main_page():
>>>
>>> main_pg=DIV()
>>> 
>>> m_cont = LOAD(f='*modal_content**.load*', *args=[1],*   ajax=True, 
>>> ajax_trap=True  )  # - must works, I'm sure while modal_content() runs  
>>> "int(request.args(0)) 
>>> == 1"  will be true
>>>...
>>>
>>>
>>>
>>>
>>>  писал(а) в своём письме Fri, 12 Feb 2016 
>>> 23:04:08 +0300:
>>>
>>> What I have done with your code is change the contoller to be:
>>>
>>>
>>> def main_page():
>>> main_pg=DIV('hello world')
>>> m_cont = LOAD(f='modal_content.load', ajax=True, ajax_trap=True  )  
>>> dialog = modal_wrapper(m_cont, _id='cont_id', header='Header', 
>>> footer='footer')
>>> #show_modal_btn = BUTTON( 'Show modal',_type="button",_class = "btn 
>>> btn-default",_onclick=""" $('#cont_id').modal('show')   """)
>>> #don't forget to add dialog and show_modal_btn to main page
>>> #main_pg.append(show_modal_btn)   # or main_pg.append( 
>>> DIV(show_modal_btn)  ) or something else
>>> main_pg.append(dialog)
>>> return dict(main_pg = main_pg)
>>>
>>>
>>> And in my view I have (I am making an example here):
>>>
>>> {{extend 'layout.html'}}
>>> {{=main_pg}}
>>>
>>> {{=BUTTON( 'Apply',_type="button",_class = "btn 
>>> btn-default",_onclick="$('#cont_id').modal('show')")}}
>>>
>>> Works fine. Because I see the button and I click and see the pop up. 
>>> Great. Only issue is, I need to update the table with my argument. For 
>>> example:
>>>
>>> def modal_content():
>>> db.mytable.id.default = request.args(0) #Just an example.
>>> form = SQLFORM(db.mytable) # or even form = SQLFORM.grid(...)
>>> return dict(form=form)
>>>
>>>
>>> So, I need to pass that argument from my view to the controller of the 
>>> form. Only thing I have at my disposal is the button. 
>>>
>>>
>>>
>>> On Friday, February 12, 2016 at 2:25:36 PM UTC-5, Val K wrote:


 I mean passing args/vars in main_page(): 

 def main_page():

 main_pg=DIV()
 
 m_cont = LOAD(f='*modal_content**.load*', *args=[ >>> args>],  vars={ }*,   ajax=True, ajax_trap=True  )  
...



 But may be you want to pass something from client side, i.e. args  are 
 defined by some user action.
 What exactly do you want to do?





 On Friday, February 12, 2016 at 10:00:22 PM UTC+3, billmac...@gmail.com 
 wrote:
>
> In the book it says load in the view. Nothing in the controller.  I 
> was just wondering if we can add a button in the view and call the ajax 
> from the view with the argument. If we need to call the LOAD from the 
> view, 
> its
>
> {{=LOAD('default','manage_things',ajax=True)}}
>
> Then it fails for m_count. 
>
>
> On Friday, February 12, 2016 at 12:20:10 AM UTC-5, Val K wrote:
>>
>> LOAD() works like URL(), so,  to pass args/vars to modal_content 

Re: [web2py] Re: Displalay a form in light box or pop up window in view

2016-02-12 Thread billmackalister
My bad. I forgot the my_util.py

On Friday, February 12, 2016 at 4:10:00 PM UTC-5, Val K wrote:
>
> it's easy:
> 1. Place modal_wrapper() function in  your_web2py_app/modUles  named 
> 'my_util.py' (just for example) - you have to import html-helpers in it:  
>
> from gluon.html import *
>
>  2. In view place:
> ...
> {{=BUTTON( 'Apply',_type="button",_class = "btn btn-default",_onclick="$('#
> *cont_id*').modal('show')")}} 
>
> {{from my_util import *}}
>
> {{=modal_wrapper(   LOAD(f='*modal_content**.load*', *args=id,*   ajax=
> True, ajax_trap=True  )  , _id='*cont_id*', header='Header', 
> footer='footer')  }} 
>
> 3. Remove all about modal from main_page() 
>
>
>
> > писал(а) в своём письме Fri, 12 Feb 
> 2016 23:40:08 +0300:
>
> What I mean by passing argument from the view to the controller is this 
> (let us consider in my view):
>
>
> (1)   href="{{=URL('my_controler_def',args=id)}}">Apply
>
> (2) Apply
>
>
> In the above (1) is calling that URL with an argument id. (2) is a button, 
> when I click on that, it goes to the controller function my_controler_def, 
> and in my_controler_def I will have that "id" argument passed on.
>
> I was hoping to do the same with the model. That with a button I can pass 
> an argument from my view to the controller modal_content 
>
>
>
> On Friday, February 12, 2016 at 3:29:47 PM UTC-5, Val K wrote:
>>
>>
>> OK,  but what do you mean under "pass that argument from my view" ?
>> view is processed and rendered to html page at server side,   JS runs 
>> only  on the client side.
>> so, if you can pass arg from veiw (i.e. arg is defined on server side), 
>> also  you can pass it in main_page():
>>
>> def main_page():
>>
>> main_pg=DIV()
>> 
>> m_cont = LOAD(f='*modal_content**.load*', *args=[1],*   ajax=True, 
>> ajax_trap=True  )  # - must works, I'm sure while modal_content() runs  
>> "int(request.args(0)) 
>> == 1"  will be true
>>...
>>
>>
>>
>>
>>  писал(а) в своём письме Fri, 12 Feb 2016 23:04:08 
>> +0300:
>>
>> What I have done with your code is change the contoller to be:
>>
>>
>> def main_page():
>> main_pg=DIV('hello world')
>> m_cont = LOAD(f='modal_content.load', ajax=True, ajax_trap=True  )  
>> dialog = modal_wrapper(m_cont, _id='cont_id', header='Header', 
>> footer='footer')
>> #show_modal_btn = BUTTON( 'Show modal',_type="button",_class = "btn 
>> btn-default",_onclick=""" $('#cont_id').modal('show')   """)
>> #don't forget to add dialog and show_modal_btn to main page
>> #main_pg.append(show_modal_btn)   # or main_pg.append( 
>> DIV(show_modal_btn)  ) or something else
>> main_pg.append(dialog)
>> return dict(main_pg = main_pg)
>>
>>
>> And in my view I have (I am making an example here):
>>
>> {{extend 'layout.html'}}
>> {{=main_pg}}
>>
>> {{=BUTTON( 'Apply',_type="button",_class = "btn 
>> btn-default",_onclick="$('#cont_id').modal('show')")}}
>>
>> Works fine. Because I see the button and I click and see the pop up. 
>> Great. Only issue is, I need to update the table with my argument. For 
>> example:
>>
>> def modal_content():
>> db.mytable.id.default = request.args(0) #Just an example.
>> form = SQLFORM(db.mytable) # or even form = SQLFORM.grid(...)
>> return dict(form=form)
>>
>>
>> So, I need to pass that argument from my view to the controller of the 
>> form. Only thing I have at my disposal is the button. 
>>
>>
>>
>> On Friday, February 12, 2016 at 2:25:36 PM UTC-5, Val K wrote:
>>>
>>>
>>> I mean passing args/vars in main_page(): 
>>>
>>> def main_page():
>>>
>>> main_pg=DIV()
>>> 
>>> m_cont = LOAD(f='*modal_content**.load*', *args=[ >> args>],  vars={ }*,   ajax=True, ajax_trap=True  )  
>>>...
>>>
>>>
>>>
>>> But may be you want to pass something from client side, i.e. args  are 
>>> defined by some user action.
>>> What exactly do you want to do?
>>>
>>>
>>>
>>>
>>>
>>> On Friday, February 12, 2016 at 10:00:22 PM UTC+3, billmac...@gmail.com 
>>> wrote:

 In the book it says load in the view. Nothing in the controller.  I was 
 just wondering if we can add a button in the view and call the ajax from 
 the view with the argument. If we need to call the LOAD from the view, its

 {{=LOAD('default','manage_things',ajax=True)}}

 Then it fails for m_count. 


 On Friday, February 12, 2016 at 12:20:10 AM UTC-5, Val K wrote:
>
> LOAD() works like URL(), so,  to pass args/vars to modal_content you 
> could write
> m_cont = LOAD(f='*modal_content**.load*', *args=[ ],  vars={ }*,   
> ajax=True, ajax_trap=True  )  # see LOAD in web2py book
>
> in modal_content controller there is nothing new, everything is as 
> usual  
> def modal_content():
>arg_0 = request.args(0)
>a = request.vars.a
>
>   
>
> On Friday, February 12, 2016 at 1:16:35 AM UTC+3, billmac...@gmail.com 
> wrote:
>>
>> Thank you! Val  and the app works great.
>>
>> One quest

Re: [web2py] Re: Displalay a form in light box or pop up window in view

2016-02-12 Thread billmackalister
You got it to work? Because I get this:

default/main_page.html", line 83, in 
NameError: name 'modal_wrapper' is not defined


*Controller is now:*

def main_page():
main_pg=DIV('hello world')
#m_cont = LOAD(f='modal_content.load', ajax=True, ajax_trap=True  )  
#dialog = modal_wrapper(m_cont, _id='cont_id', header='Header', 
footer='footer')
show_modal_btn = BUTTON( 'Show modal',_type="button",_class = "btn 
btn-default",_onclick=""" $('#cont_id').modal('show')   """)
#don't forget to add dialog and show_modal_btn to main page
main_pg.append(show_modal_btn)   # or main_pg.append( DIV(show_modal_btn)  
) or something else
#main_pg.append(dialog)
return dict(main_pg = main_pg)



View is:

{{extend 'layout.html'}}
{{from gluon.html import *}}

{{=main_pg}}
{{id = 1}}
{{=modal_wrapper(LOAD(f='modal_content.load', args=id,   ajax=True, 
ajax_trap=True  )  , _id='cont_id', header='Header', footer='footer')  }}




On Friday, February 12, 2016 at 4:10:00 PM UTC-5, Val K wrote:
>
> it's easy:
> 1. Place modal_wrapper() function in  your_web2py_app/modUles  named 
> 'my_util.py' (just for example) - you have to import html-helpers in it:  
>
> from gluon.html import *
>
>  2. In view place:
> ...
> {{=BUTTON( 'Apply',_type="button",_class = "btn btn-default",_onclick="$('#
> *cont_id*').modal('show')")}} 
>
> {{from my_util import *}}
>
> {{=modal_wrapper(   LOAD(f='*modal_content**.load*', *args=id,*   ajax=
> True, ajax_trap=True  )  , _id='*cont_id*', header='Header', 
> footer='footer')  }} 
>
> 3. Remove all about modal from main_page() 
>
>
>
> > писал(а) в своём письме Fri, 12 Feb 
> 2016 23:40:08 +0300:
>
> What I mean by passing argument from the view to the controller is this 
> (let us consider in my view):
>
>
> (1)   href="{{=URL('my_controler_def',args=id)}}">Apply
>
> (2) Apply
>
>
> In the above (1) is calling that URL with an argument id. (2) is a button, 
> when I click on that, it goes to the controller function my_controler_def, 
> and in my_controler_def I will have that "id" argument passed on.
>
> I was hoping to do the same with the model. That with a button I can pass 
> an argument from my view to the controller modal_content 
>
>
>
> On Friday, February 12, 2016 at 3:29:47 PM UTC-5, Val K wrote:
>>
>>
>> OK,  but what do you mean under "pass that argument from my view" ?
>> view is processed and rendered to html page at server side,   JS runs 
>> only  on the client side.
>> so, if you can pass arg from veiw (i.e. arg is defined on server side), 
>> also  you can pass it in main_page():
>>
>> def main_page():
>>
>> main_pg=DIV()
>> 
>> m_cont = LOAD(f='*modal_content**.load*', *args=[1],*   ajax=True, 
>> ajax_trap=True  )  # - must works, I'm sure while modal_content() runs  
>> "int(request.args(0)) 
>> == 1"  will be true
>>...
>>
>>
>>
>>
>>  писал(а) в своём письме Fri, 12 Feb 2016 23:04:08 
>> +0300:
>>
>> What I have done with your code is change the contoller to be:
>>
>>
>> def main_page():
>> main_pg=DIV('hello world')
>> m_cont = LOAD(f='modal_content.load', ajax=True, ajax_trap=True  )  
>> dialog = modal_wrapper(m_cont, _id='cont_id', header='Header', 
>> footer='footer')
>> #show_modal_btn = BUTTON( 'Show modal',_type="button",_class = "btn 
>> btn-default",_onclick=""" $('#cont_id').modal('show')   """)
>> #don't forget to add dialog and show_modal_btn to main page
>> #main_pg.append(show_modal_btn)   # or main_pg.append( 
>> DIV(show_modal_btn)  ) or something else
>> main_pg.append(dialog)
>> return dict(main_pg = main_pg)
>>
>>
>> And in my view I have (I am making an example here):
>>
>> {{extend 'layout.html'}}
>> {{=main_pg}}
>>
>> {{=BUTTON( 'Apply',_type="button",_class = "btn 
>> btn-default",_onclick="$('#cont_id').modal('show')")}}
>>
>> Works fine. Because I see the button and I click and see the pop up. 
>> Great. Only issue is, I need to update the table with my argument. For 
>> example:
>>
>> def modal_content():
>> db.mytable.id.default = request.args(0) #Just an example.
>> form = SQLFORM(db.mytable) # or even form = SQLFORM.grid(...)
>> return dict(form=form)
>>
>>
>> So, I need to pass that argument from my view to the controller of the 
>> form. Only thing I have at my disposal is the button. 
>>
>>
>>
>> On Friday, February 12, 2016 at 2:25:36 PM UTC-5, Val K wrote:
>>>
>>>
>>> I mean passing args/vars in main_page(): 
>>>
>>> def main_page():
>>>
>>> main_pg=DIV()
>>> 
>>> m_cont = LOAD(f='*modal_content**.load*', *args=[ >> args>],  vars={ }*,   ajax=True, ajax_trap=True  )  
>>>...
>>>
>>>
>>>
>>> But may be you want to pass something from client side, i.e. args  are 
>>> defined by some user action.
>>> What exactly do you want to do?
>>>
>>>
>>>
>>>
>>>
>>> On Friday, February 12, 2016 at 10:00:22 PM UTC+3, billmac...@gmail.com 
>>> wrote:

 In the book it says load in the view. Nothing in the controller.  I was 
 just wonderi

[web2py] Re: Email not working

2016-02-12 Thread Dave S


On Friday, February 12, 2016 at 12:17:57 PM UTC-8, Tom Russell wrote:
>
> Yea I am not trying to blame web2py but it just seems I am not having any 
> luck getting an email to send. I am using a smtp interface on the other 
> side.
>
> I am just at a loss as to what the issue is and how to solve it.
>
> Thanks,
>
> Tom
>

FWIW, on my AWS Linux instance, I send email with server "localhost" and 
user "None" (I'm hoping that only works from local posts), using either 
auth's mailer or smtplib directly.  From reading this group for a while, 
the most common problem seems to be getting user/password right, especially 
with GMail and 2-factor authentication.

/dps



> On Friday, February 12, 2016 at 2:40:43 PM UTC-5, Niphlod wrote:
>>
>> web2py uses smtplib. as long as on the other side there's an 
>> smtp-compatible interface, there's no reason to blame web2py :P
>>
>> On Friday, February 12, 2016 at 8:38:38 PM UTC+1, Tom Russell wrote:
>>>
>>> I have since my last time trying to get email sending working with the 
>>> built in registration process moved to Amazon AWS SES mail services which I 
>>> know works well with other people. I have put in all the required info in 
>>> db.py needed but still cannot send an email. I have tried gmail, a few 
>>> other services and nothing so far seems to work.
>>>
>>> Has anyone tried an actual mail service that works, preferably free or 
>>> close to it. I am beginning to think that web2py has an issue doing this 
>>> task.
>>>
>>> I really need to get past this hurtle for a product launch soon.
>>>
>>> Thanks,
>>>
>>> Tom
>>>
>>

-- 
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: Displalay a form in light box or pop up window in view

2016-02-12 Thread Валерий Кучеров

it's easy:
1. Place modal_wrapper() function in  your_web2py_app/modUles  named  
'my_util.py' (just for example) - you have to import html-helpers in it:

from gluon.html import *
 2. In view place:
...
{{=BUTTON( 'Apply',_type="button",_class = "btn  
btn-default",_onclick="$('#cont_id').modal('show')")}}


{{from my_util import *}}

{{=modal_wrapper(   LOAD(f='modal_content.load', args=id,   ajax=True,  
ajax_trap=True  )  , _id='cont_id', header='Header', footer='footer')  }}



3. Remove all about modal from main_page()



 писал(а) в своём письме Fri, 12 Feb 2016  
23:40:08 +0300:


What I mean by passing argument from the view to the controller is this  
(let us consider in my view):



(1) href="{{=URL('my_controler_def',args=id)}}">Apply


(2) Apply



In the above (1) is calling that URL with an argument id. (2) is a  
button, when I click on that, it goes to the controller function  
my_controler_def, and in my_controler_def I will have that "id" argument  
passed on.


I was hoping to do the same with the model. That with a button I can  
pass an argument from my view to the controller modal_content



On Friday, February 12, 2016 at 3:29:47 PM UTC-5, Val K wrote:


OK,  but what do you mean under "pass that argument from my view" ?
view is processed and rendered to html page at server side,   JS runs  
only  on the client side.
so, if you can pass arg from veiw (i.e. arg is defined on server side),  
also  you can pass it in main_page():


def main_page():


   main_pg=DIV()
 m_cont = LOAD(f='modal_content.load', args=[1],   ajax=True,  
ajax_trap=True  )  # - must works, I'm sure while modal_content() runs   
"int(request.args(0)) == 1"  will be true

  ...




 писал(а) в своём письме Fri, 12 Feb 2016  
23:04:08 +0300:



What I have done with your code is change the contoller to be:


def main_page():
   main_pg=DIV('hello world')
   m_cont = LOAD(f='modal_content.load', ajax=True, ajax_trap=True  )  
   dialog = modal_wrapper(m_cont, _id='cont_id', header='Header',  
footer='footer')
   #show_modal_btn = BUTTON( 'Show modal',_type="button",_class = "btn  
btn-default",_onclick=""" $('#cont_id').modal('show')   """)

   #don't forget to add dialog and show_modal_btn to main page
   #main_pg.append(show_modal_btn)   # or main_pg.append(  
DIV(show_modal_btn)  ) or something else

   main_pg.append(dialog)
   return dict(main_pg = main_pg)


And in my view I have (I am making an example here):

{{extend 'layout.html'}}
{{=main_pg}}

{{=BUTTON( 'Apply',_type="button",_class = "btn  
btn-default",_onclick="$('#cont_id').modal('show')")}}


Works fine. Because I see the button and I click and see the pop up.  
Great. Only issue is, I need to update the table with my argument. For  
example:


def modal_content():
   db.mytable.id.default = request.args(0) #Just an example.
   form = SQLFORM(db.mytable) # or even form = SQLFORM.grid(...)
   return dict(form=form)


So, I need to pass that argument from my view to the controller of the  
form. Only thing I have at my disposal is the button.



On Friday, February 12, 2016 at 2:25:36 PM UTC-5, Val K wrote:



I mean passing args/vars in main_page():
def main_page():


   main_pg=DIV()
 m_cont = LOAD(f='modal_content.load', args=[ args>],  vars={ },   ajax=True, ajax_trap=True  )  
  ...




But may be you want to pass something from client side, i.e. args   
are defined by some user action.

What exactly do you want to do?





On Friday, February 12, 2016 at 10:00:22 PM UTC+3,  
billmac...@gmail.com wrote:
In the book it says load in the view. Nothing in the controller.  I  
was just wondering if we can add a button in the view and call the  
ajax from the view with the argument. If we need to call the LOAD  
from the view, its


{{=LOAD('default','manage_things',ajax=True)}}

Then it fails for m_count.

On Friday, February 12, 2016 at 12:20:10 AM UTC-5, Val K wrote:
LOAD() works like URL(), so,  to pass args/vars to modal_content  
you could write
m_cont = LOAD(f='modal_content.load', args=[ ],  vars={ },
ajax=True, ajax_trap=True  )  # see LOAD in web2py book


in modal_content controller there is nothing new, everything  
is as usual

def modal_content():

  arg_0 = request.args(0)
  a = request.vars.a

  
On Friday, February 12, 2016 at 1:16:35 AM UTC+3,  
billmac...@gmail.com wrote:

Thank you! Val  and the app works great.

One question:

Instead of controller, I have the button displayed in the view as:

{{=BUTTON( 'Apply',_type="button",_class = "btn  
btn-default",_style="background-color:green;background-image:none",_onclick="""  
$('#cont_id').modal('show')   """ )}}


It works, however, I need to pass an argument to my controller  
"modal_content". How do I  pass a request.args(0) from my view to  
the controller in above? Just like I would do
onclick='window.open("{{=URL("modal_content",args=something.id)}}",  
"mywindow");'>Apply



Since I don't see the URL or callback to the javascript. Thanks in  
advance.



On Thurs

[web2py] Re: Displalay a form in light box or pop up window in view

2016-02-12 Thread Dave S
On Friday, February 12, 2016 at 12:04:08 PM UTC-8, billmac...@gmail.com 
wrote:
>
> Works fine. Because I see the button and I click and see the pop up. 
> Great. Only issue is, I need to update the table with my argument. For 
> example:
>
> [...]
>
> So, I need to pass that argument from my view to the controller of the 
> form. Only thing I have at my disposal is the button. 
>

 Are you replacing a line in a  element?

2 approaches to try are:

-- make sure that line is in the DIV the LOAD() is going to rewrite
-- LOAD into a hidden DIV, and use javascript to copy the element into the 
displayed DIV.

I have never tried the 2nd one, and I'm not js-savvy enough to more that 
wave my hands and say you find the element in the DOM and rewrite it.

The 1st is more like the normal use of LOAD(), except that you aren't 
putting the results into an empty container.

/dps

-- 
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: Displalay a form in light box or pop up window in view

2016-02-12 Thread billmackalister
What I mean by passing argument from the view to the controller is this 
(let us consider in my view):


(1) Apply

(2) Apply


In the above (1) is calling that URL with an argument id. (2) is a button, 
when I click on that, it goes to the controller function my_controler_def, 
and in my_controler_def I will have that "id" argument passed on.

I was hoping to do the same with the model. That with a button I can pass 
an argument from my view to the controller modal_content 



On Friday, February 12, 2016 at 3:29:47 PM UTC-5, Val K wrote:
>
>
> OK,  but what do you mean under "pass that argument from my view" ?
> view is processed and rendered to html page at server side,   JS runs only 
>  on the client side.
> so, if you can pass arg from veiw (i.e. arg is defined on server side), 
> also  you can pass it in main_page():
>
> def main_page():
>
> main_pg=DIV()
> 
> m_cont = LOAD(f='*modal_content**.load*', *args=[1],*   ajax=True, 
> ajax_trap=True  )  # - must works, I'm sure while modal_content() runs  
> "int(request.args(0)) 
> == 1"  will be true
>...
>
>
>
>
> > писал(а) в своём письме Fri, 12 Feb 
> 2016 23:04:08 +0300:
>
> What I have done with your code is change the contoller to be:
>
>
> def main_page():
> main_pg=DIV('hello world')
> m_cont = LOAD(f='modal_content.load', ajax=True, ajax_trap=True  )  
> dialog = modal_wrapper(m_cont, _id='cont_id', header='Header', 
> footer='footer')
> #show_modal_btn = BUTTON( 'Show modal',_type="button",_class = "btn 
> btn-default",_onclick=""" $('#cont_id').modal('show')   """)
> #don't forget to add dialog and show_modal_btn to main page
> #main_pg.append(show_modal_btn)   # or main_pg.append( 
> DIV(show_modal_btn)  ) or something else
> main_pg.append(dialog)
> return dict(main_pg = main_pg)
>
>
> And in my view I have (I am making an example here):
>
> {{extend 'layout.html'}}
> {{=main_pg}}
>
> {{=BUTTON( 'Apply',_type="button",_class = "btn 
> btn-default",_onclick="$('#cont_id').modal('show')")}}
>
> Works fine. Because I see the button and I click and see the pop up. 
> Great. Only issue is, I need to update the table with my argument. For 
> example:
>
> def modal_content():
> db.mytable.id.default = request.args(0) #Just an example.
> form = SQLFORM(db.mytable) # or even form = SQLFORM.grid(...)
> return dict(form=form)
>
>
> So, I need to pass that argument from my view to the controller of the 
> form. Only thing I have at my disposal is the button. 
>
>
>
> On Friday, February 12, 2016 at 2:25:36 PM UTC-5, Val K wrote:
>>
>>
>> I mean passing args/vars in main_page(): 
>>
>> def main_page():
>>
>> main_pg=DIV()
>> 
>> m_cont = LOAD(f='*modal_content**.load*', *args=[ > args>],  vars={ }*,   ajax=True, ajax_trap=True  )  
>>...
>>
>>
>>
>> But may be you want to pass something from client side, i.e. args  are 
>> defined by some user action.
>> What exactly do you want to do?
>>
>>
>>
>>
>>
>> On Friday, February 12, 2016 at 10:00:22 PM UTC+3, billmac...@gmail.com 
>> wrote:
>>>
>>> In the book it says load in the view. Nothing in the controller.  I was 
>>> just wondering if we can add a button in the view and call the ajax from 
>>> the view with the argument. If we need to call the LOAD from the view, its
>>>
>>> {{=LOAD('default','manage_things',ajax=True)}}
>>>
>>> Then it fails for m_count. 
>>>
>>>
>>> On Friday, February 12, 2016 at 12:20:10 AM UTC-5, Val K wrote:

 LOAD() works like URL(), so,  to pass args/vars to modal_content you 
 could write
 m_cont = LOAD(f='*modal_content**.load*', *args=[ ],  vars={ }*,   
 ajax=True, ajax_trap=True  )  # see LOAD in web2py book

 in modal_content controller there is nothing new, everything is as 
 usual  
 def modal_content():
arg_0 = request.args(0)
a = request.vars.a

   

 On Friday, February 12, 2016 at 1:16:35 AM UTC+3, billmac...@gmail.com 
 wrote:
>
> Thank you! Val  and the app works great.
>
> One question:
>
> Instead of controller, I have the button displayed in the view as:
>
> {{=BUTTON( 'Apply',_type="button",_class = "btn 
> btn-default",_style="background-color:green;background-image:none",_onclick="""
>  
> $('#cont_id').modal('show')   """ )}}
>
> It works, however, I need to pass an argument to my controller 
> "modal_content". How do I  pass a request.args(0) from my view to the 
> controller in above? Just like I would do 
>
>  Apply
>
>
> Since I don't see the URL or callback to the javascript. Thanks in 
> advance.
>
>
> On Thursday, February 11, 2016 at 4:27:22 PM UTC-5, Val K wrote:
>>
>> Hi!
>> Here is my solution.  I have modal_wrapper function. In controller 
>> file, I have two controllers -  main_page and modal_content: 
>>
>>
>>
>> def *main_page*():
>>
>> main_pg=DIV()
>>  

Re: [web2py] Re: Displalay a form in light box or pop up window in view

2016-02-12 Thread Валерий Кучеров


OK,  but what do you mean under "pass that argument from my view" ?
view is processed and rendered to html page at server side,   JS runs  
only  on the client side.
so, if you can pass arg from veiw (i.e. arg is defined on server side),  
also  you can pass it in main_page():


def main_page():

main_pg=DIV()

m_cont = LOAD(f='modal_content.load', args=[1],   ajax=True,  
ajax_trap=True  )  # - must works, I'm sure while modal_content() runs   
"int(request.args(0)) == 1"  will be true

   ...





 писал(а) в своём письме Fri, 12 Feb 2016  
23:04:08 +0300:



What I have done with your code is change the contoller to be:


def main_page():
   main_pg=DIV('hello world')
   m_cont = LOAD(f='modal_content.load', ajax=True, ajax_trap=True  )  
   dialog = modal_wrapper(m_cont, _id='cont_id', header='Header',  
footer='footer')
   #show_modal_btn = BUTTON( 'Show modal',_type="button",_class = "btn  
btn-default",_onclick=""" $('#cont_id').modal('show')   """)

   #don't forget to add dialog and show_modal_btn to main page
   #main_pg.append(show_modal_btn)   # or main_pg.append(  
DIV(show_modal_btn)  ) or something else

   main_pg.append(dialog)
   return dict(main_pg = main_pg)


And in my view I have (I am making an example here):

{{extend 'layout.html'}}
{{=main_pg}}

{{=BUTTON( 'Apply',_type="button",_class = "btn  
btn-default",_onclick="$('#cont_id').modal('show')")}}


Works fine. Because I see the button and I click and see the pop up.  
Great. Only issue is, I need to update the table with my argument. For  
example:


def modal_content():
   db.mytable.id.default = request.args(0) #Just an example.
   form = SQLFORM(db.mytable) # or even form = SQLFORM.grid(...)
   return dict(form=form)


So, I need to pass that argument from my view to the controller of the  
form. Only thing I have at my disposal is the button.



On Friday, February 12, 2016 at 2:25:36 PM UTC-5, Val K wrote:



I mean passing args/vars in main_page():
def main_page():


   main_pg=DIV()
 m_cont = LOAD(f='modal_content.load', args=[ args>],  vars={ },   ajax=True, ajax_trap=True  )  
  ...




But may be you want to pass something from client side, i.e. args  are  
defined by some user action.

What exactly do you want to do?





On Friday, February 12, 2016 at 10:00:22 PM UTC+3, billmac...@gmail.com  
wrote:
In the book it says load in the view. Nothing in the controller.  I  
was just wondering if we can add a button in the view and call the  
ajax from the view with the argument. If we need to call the LOAD from  
the view, its


{{=LOAD('default','manage_things',ajax=True)}}

Then it fails for m_count.

On Friday, February 12, 2016 at 12:20:10 AM UTC-5, Val K wrote:
LOAD() works like URL(), so,  to pass args/vars to modal_content you  
could write
m_cont = LOAD(f='modal_content.load', args=[ ],  vars={ },
ajax=True, ajax_trap=True  )  # see LOAD in web2py book


in modal_content controller there is nothing new, everything is  
as usual

def modal_content():

  arg_0 = request.args(0)
  a = request.vars.a

  
On Friday, February 12, 2016 at 1:16:35 AM UTC+3,  
billmac...@gmail.com wrote:

Thank you! Val  and the app works great.

One question:

Instead of controller, I have the button displayed in the view as:

{{=BUTTON( 'Apply',_type="button",_class = "btn  
btn-default",_style="background-color:green;background-image:none",_onclick="""  
$('#cont_id').modal('show')   """ )}}


It works, however, I need to pass an argument to my controller  
"modal_content". How do I  pass a request.args(0) from my view to  
the controller in above? Just like I would do
onclick='window.open("{{=URL("modal_content",args=something.id)}}",  
"mywindow");'>Apply



Since I don't see the URL or callback to the javascript. Thanks in  
advance.



On Thursday, February 11, 2016 at 4:27:22 PM UTC-5, Val K wrote:

Hi!
Here is my solution.  I have modal_wrapper function. In controller  
file, I have two controllers -  main_page and modal_content:




def main_page():


   main_pg=DIV()
 m_cont = LOAD(f='modal_content.load', ajax=True,  
ajax_trap=True  )
   dialog = modal_wrapper(m_cont, _id='cont_id',  
header='Header', footer='footer')

 show_modal_btn = BUTTON( 'Show modal',
  _type="button",
  _class = "btn  
btn-default",
  _onclick="""  
$('#cont_id').modal('show')   """)



   #don't forget to add dialog and show_modal_btn to main page
   main_pg.append(show_modal_btn)   # or main_pg.append(  
DIV(show_modal_btn)  ) or something else

   main_pg.append(dialog)

  return dict(main_pg = main_pg)





# keep in mind just one thing:
#   this controller is exposed by *.load, so it must return a dict  
of ONE element#   to return more than one element - wrap all in one  
DIV:

#   ret = DIV()
#   ret.append( ... )#   ret.append( form ) #  ret.append( ... )
#  

[web2py] Re: Email not working

2016-02-12 Thread Tom Russell
Yea I am not trying to blame web2py but it just seems I am not having any 
luck getting an email to send. I am using a smtp interface on the other 
side.

I am just at a loss as to what the issue is and how to solve it.

Thanks,

Tom

On Friday, February 12, 2016 at 2:40:43 PM UTC-5, Niphlod wrote:
>
> web2py uses smtplib. as long as on the other side there's an 
> smtp-compatible interface, there's no reason to blame web2py :P
>
> On Friday, February 12, 2016 at 8:38:38 PM UTC+1, Tom Russell wrote:
>>
>> I have since my last time trying to get email sending working with the 
>> built in registration process moved to Amazon AWS SES mail services which I 
>> know works well with other people. I have put in all the required info in 
>> db.py needed but still cannot send an email. I have tried gmail, a few 
>> other services and nothing so far seems to work.
>>
>> Has anyone tried an actual mail service that works, preferably free or 
>> close to it. I am beginning to think that web2py has an issue doing this 
>> task.
>>
>> I really need to get past this hurtle for a product launch soon.
>>
>> Thanks,
>>
>> Tom
>>
>

-- 
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: Displalay a form in light box or pop up window in view

2016-02-12 Thread billmackalister
What I have done with your code is change the contoller to be:


def main_page():
main_pg=DIV('hello world')
m_cont = LOAD(f='modal_content.load', ajax=True, ajax_trap=True  )  
dialog = modal_wrapper(m_cont, _id='cont_id', header='Header', 
footer='footer')
#show_modal_btn = BUTTON( 'Show modal',_type="button",_class = "btn 
btn-default",_onclick=""" $('#cont_id').modal('show')   """)
#don't forget to add dialog and show_modal_btn to main page
#main_pg.append(show_modal_btn)   # or main_pg.append( 
DIV(show_modal_btn)  ) or something else
main_pg.append(dialog)
return dict(main_pg = main_pg)


And in my view I have (I am making an example here):

{{extend 'layout.html'}}
{{=main_pg}}

{{=BUTTON( 'Apply',_type="button",_class = "btn 
btn-default",_onclick="$('#cont_id').modal('show')")}}

Works fine. Because I see the button and I click and see the pop up. Great. 
Only issue is, I need to update the table with my argument. For example:

def modal_content():
db.mytable.id.default = request.args(0) #Just an example.
form = SQLFORM(db.mytable) # or even form = SQLFORM.grid(...)
return dict(form=form)


So, I need to pass that argument from my view to the controller of the 
form. Only thing I have at my disposal is the button. 



On Friday, February 12, 2016 at 2:25:36 PM UTC-5, Val K wrote:
>
>
> I mean passing args/vars in main_page(): 
>
> def main_page():
>
> main_pg=DIV()
> 
> m_cont = LOAD(f='*modal_content**.load*', *args=[  args>],  vars={ }*,   ajax=True, ajax_trap=True  )  
>...
>
>
>
> But may be you want to pass something from client side, i.e. args  are 
> defined by some user action.
> What exactly do you want to do?
>
>
>
>
>
> On Friday, February 12, 2016 at 10:00:22 PM UTC+3, billmac...@gmail.com 
> wrote:
>>
>> In the book it says load in the view. Nothing in the controller.  I was 
>> just wondering if we can add a button in the view and call the ajax from 
>> the view with the argument. If we need to call the LOAD from the view, its
>>
>> {{=LOAD('default','manage_things',ajax=True)}}
>>
>> Then it fails for m_count. 
>>
>>
>> On Friday, February 12, 2016 at 12:20:10 AM UTC-5, Val K wrote:
>>>
>>> LOAD() works like URL(), so,  to pass args/vars to modal_content you 
>>> could write
>>> m_cont = LOAD(f='*modal_content**.load*', *args=[ ],  vars={ }*,   
>>> ajax=True, ajax_trap=True  )  # see LOAD in web2py book
>>>
>>> in modal_content controller there is nothing new, everything is as usual 
>>>  
>>> def modal_content():
>>>arg_0 = request.args(0)
>>>a = request.vars.a
>>>
>>>   
>>>
>>> On Friday, February 12, 2016 at 1:16:35 AM UTC+3, billmac...@gmail.com 
>>> wrote:

 Thank you! Val  and the app works great.

 One question:

 Instead of controller, I have the button displayed in the view as:

 {{=BUTTON( 'Apply',_type="button",_class = "btn 
 btn-default",_style="background-color:green;background-image:none",_onclick="""
  
 $('#cont_id').modal('show')   """ )}}

 It works, however, I need to pass an argument to my controller 
 "modal_content". How do I  pass a request.args(0) from my view to the 
 controller in above? Just like I would do 

  Apply


 Since I don't see the URL or callback to the javascript. Thanks in 
 advance.


 On Thursday, February 11, 2016 at 4:27:22 PM UTC-5, Val K wrote:
>
> Hi!
> Here is my solution.  I have modal_wrapper function. In controller 
> file, I have two controllers -  main_page and modal_content: 
>
>
>
> def *main_page*():
>
> main_pg=DIV()
> 
> m_cont = LOAD(f='*modal_content**.load*', ajax=True, 
> ajax_trap=True  )  
>
> dialog = modal_wrapper(m_cont, _id='*cont_id*', header='Header', 
> footer='footer')
> 
> show_modal_btn = BUTTON( 'Show modal',
>_type="button",
>_class = "btn 
> btn-default",
>_onclick=""" 
> $('#*cont_id*').modal('show')   """)
>
> #don't forget to add dialog and show_modal_btn to main page
> main_pg.append(show_modal_btn)   # or main_pg.append( 
> DIV(show_modal_btn) 
>  ) or something else
> main_pg.append(dialog)
>
>return dict(main_pg = main_pg)
>
>
>
>
> # keep in mind just one thing:
> #   this controller is exposed by *.load, so it must return a dict of 
> ONE element 
> #   to return more than one element - wrap all in one DIV:
> #   ret = DIV()
> #   ret.append( ... ) 
> #   ret.append( form )  
> #  ret.append( ... )
> #  return dict(ret = ret) 
>
> def *modal_content*():
> 
> form = SQLFORM(...) # or even form = SQLFORM.grid(...)
>

Re: [web2py] Re: form.accepts fails with 'links' browser

2016-02-12 Thread Anthony
On Thursday, February 11, 2016 at 11:39:49 PM UTC-5, /dev/sdc3 wrote:
>
>
> OK.  Is it useful for me to submit a patch?
>

Maybe. We would want to confirm that the div is hidden and takes up no 
space in all (non-text-based) browsers, probably going back to at least IE 
7 or 8.
 

> Browser, BTW, is text-mode links: latest version, but doesn't see 
> a lot of development.
>

Sorry, I missed that. I assume you mean Lynx, though. I guess we really 
haven't been worried about catering to Lynx users.

Anthony

-- 
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: Email not working

2016-02-12 Thread Niphlod
web2py uses smtplib. as long as on the other side there's an 
smtp-compatible interface, there's no reason to blame web2py :P

On Friday, February 12, 2016 at 8:38:38 PM UTC+1, Tom Russell wrote:
>
> I have since my last time trying to get email sending working with the 
> built in registration process moved to Amazon AWS SES mail services which I 
> know works well with other people. I have put in all the required info in 
> db.py needed but still cannot send an email. I have tried gmail, a few 
> other services and nothing so far seems to work.
>
> Has anyone tried an actual mail service that works, preferably free or 
> close to it. I am beginning to think that web2py has an issue doing this 
> task.
>
> I really need to get past this hurtle for a product launch soon.
>
> Thanks,
>
> Tom
>

-- 
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] Email not working

2016-02-12 Thread Tom Russell
I have since my last time trying to get email sending working with the 
built in registration process moved to Amazon AWS SES mail services which I 
know works well with other people. I have put in all the required info in 
db.py needed but still cannot send an email. I have tried gmail, a few 
other services and nothing so far seems to work.

Has anyone tried an actual mail service that works, preferably free or 
close to it. I am beginning to think that web2py has an issue doing this 
task.

I really need to get past this hurtle for a product launch soon.

Thanks,

Tom

-- 
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: Displalay a form in light box or pop up window in view

2016-02-12 Thread Val K

I mean passing args/vars in main_page(): 

def main_page():

main_pg=DIV()

m_cont = LOAD(f='*modal_content**.load*', *args=[ ], 
 vars={ }*,   ajax=True, ajax_trap=True  )  
   ...



But may be you want to pass something from client side, i.e. args  are 
defined by some user action.
What exactly do you want to do?





On Friday, February 12, 2016 at 10:00:22 PM UTC+3, billmac...@gmail.com 
wrote:
>
> In the book it says load in the view. Nothing in the controller.  I was 
> just wondering if we can add a button in the view and call the ajax from 
> the view with the argument. If we need to call the LOAD from the view, its
>
> {{=LOAD('default','manage_things',ajax=True)}}
>
> Then it fails for m_count. 
>
>
> On Friday, February 12, 2016 at 12:20:10 AM UTC-5, Val K wrote:
>>
>> LOAD() works like URL(), so,  to pass args/vars to modal_content you 
>> could write
>> m_cont = LOAD(f='*modal_content**.load*', *args=[ ],  vars={ }*,   
>> ajax=True, ajax_trap=True  )  # see LOAD in web2py book
>>
>> in modal_content controller there is nothing new, everything is as usual  
>> def modal_content():
>>arg_0 = request.args(0)
>>a = request.vars.a
>>
>>   
>>
>> On Friday, February 12, 2016 at 1:16:35 AM UTC+3, billmac...@gmail.com 
>> wrote:
>>>
>>> Thank you! Val  and the app works great.
>>>
>>> One question:
>>>
>>> Instead of controller, I have the button displayed in the view as:
>>>
>>> {{=BUTTON( 'Apply',_type="button",_class = "btn 
>>> btn-default",_style="background-color:green;background-image:none",_onclick="""
>>>  
>>> $('#cont_id').modal('show')   """ )}}
>>>
>>> It works, however, I need to pass an argument to my controller 
>>> "modal_content". How do I  pass a request.args(0) from my view to the 
>>> controller in above? Just like I would do 
>>>
>>>  Apply
>>>
>>>
>>> Since I don't see the URL or callback to the javascript. Thanks in 
>>> advance.
>>>
>>>
>>> On Thursday, February 11, 2016 at 4:27:22 PM UTC-5, Val K wrote:

 Hi!
 Here is my solution.  I have modal_wrapper function. In controller 
 file, I have two controllers -  main_page and modal_content: 



 def *main_page*():

 main_pg=DIV()
 
 m_cont = LOAD(f='*modal_content**.load*', ajax=True, 
 ajax_trap=True  )  

 dialog = modal_wrapper(m_cont, _id='*cont_id*', header='Header', 
 footer='footer')
 
 show_modal_btn = BUTTON( 'Show modal',
_type="button",
_class = "btn 
 btn-default",
_onclick=""" 
 $('#*cont_id*').modal('show')   """)

 #don't forget to add dialog and show_modal_btn to main page
 main_pg.append(show_modal_btn)   # or main_pg.append( 
 DIV(show_modal_btn) 
  ) or something else
 main_pg.append(dialog)

return dict(main_pg = main_pg)




 # keep in mind just one thing:
 #   this controller is exposed by *.load, so it must return a dict of 
 ONE element 
 #   to return more than one element - wrap all in one DIV:
 #   ret = DIV()
 #   ret.append( ... ) 
 #   ret.append( form )  
 #  ret.append( ... )
 #  return dict(ret = ret) 

 def *modal_content*():
 
 form = SQLFORM(...) # or even form = SQLFORM.grid(...)

 return dict(form=form)



 # means bootstrap 3
 def* modal_wrapper*(content, _id, header='', footer=''):

 main_wrap = DIV('',  _class="modal fade",  _role="dialog", _id=_id, 
 _tabindex="-1" )
 title_id = _id + '_title'
 main_wrap['_aria-labelledby']=title_id

 dialog_div=DIV('', _class="modal-dialog" , _role="document")
 content_div=DIV('', _class="modal-content")
 header_div = DIV( _class="modal-header")

 close_cross = BUTTON(
 SPAN(XML('×'), **{'_aria-hidden':"true"}),
 _type="button",  _class="close",
  data={'dismiss':"modal"},
  **{'_aria-label':"Close"}
  )
 title_h4 = H4( header,  _class="modal-title",  _id = title_id)
 body_div = DIV( content, _class="modal-body")


 close_btn = BUTTON('Close',  _type="button", _class="btn 
 btn-default", data={'dismiss':"modal"})
 footer_div =  DIV( footer, close_btn, _class="modal-footer")

 # gluon all
 main_wrap[0] = dialog_div
 dialog_div[0] = content_div

 header_div.append(close_cross)
 header_div.append(title_h4)

 [content_div.append(c) for c in (header_div, body_div, footer_div)]
 return main_wrap








 On Thursday, February 11, 2016 at 8:

[web2py] Re: File picker

2016-02-12 Thread Val K
http://www.web2py.com/books/default/chapter/29/14/other-recipes#Publishing-a-folder

On Tuesday, February 9, 2016 at 5:35:41 AM UTC+3, Heinrich Piard wrote:
>
> Hi all,
>
> does anyone have an example of a web button which allows me to browse 
> through the local file system on the web server to pick a file?
>

-- 
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: Displalay a form in light box or pop up window in view

2016-02-12 Thread billmackalister
In the book it says load in the view. Nothing in the controller.  I was 
just wondering if we can add a button in the view and call the ajax from 
the view with the argument. If we need to call the LOAD from the view, its

{{=LOAD('default','manage_things',ajax=True)}}

Then it fails for m_count. 


On Friday, February 12, 2016 at 12:20:10 AM UTC-5, Val K wrote:
>
> LOAD() works like URL(), so,  to pass args/vars to modal_content you could 
> write
> m_cont = LOAD(f='*modal_content**.load*', *args=[ ],  vars={ }*,   
> ajax=True, ajax_trap=True  )  # see LOAD in web2py book
>
> in modal_content controller there is nothing new, everything is as usual  
> def modal_content():
>arg_0 = request.args(0)
>a = request.vars.a
>
>   
>
> On Friday, February 12, 2016 at 1:16:35 AM UTC+3, billmac...@gmail.com 
> wrote:
>>
>> Thank you! Val  and the app works great.
>>
>> One question:
>>
>> Instead of controller, I have the button displayed in the view as:
>>
>> {{=BUTTON( 'Apply',_type="button",_class = "btn 
>> btn-default",_style="background-color:green;background-image:none",_onclick="""
>>  
>> $('#cont_id').modal('show')   """ )}}
>>
>> It works, however, I need to pass an argument to my controller 
>> "modal_content". How do I  pass a request.args(0) from my view to the 
>> controller in above? Just like I would do 
>>
>>  > onclick='window.open("{{=URL("*modal_content*",args=something.id)}}", 
>> "mywindow");'>Apply
>>
>>
>> Since I don't see the URL or callback to the javascript. Thanks in 
>> advance.
>>
>>
>> On Thursday, February 11, 2016 at 4:27:22 PM UTC-5, Val K wrote:
>>>
>>> Hi!
>>> Here is my solution.  I have modal_wrapper function. In controller file, 
>>> I have two controllers -  main_page and modal_content: 
>>>
>>>
>>>
>>> def *main_page*():
>>>
>>> main_pg=DIV()
>>> 
>>> m_cont = LOAD(f='*modal_content**.load*', ajax=True, ajax_trap=True 
>>>  )  
>>>
>>> dialog = modal_wrapper(m_cont, _id='*cont_id*', header='Header', 
>>> footer='footer')
>>> 
>>> show_modal_btn = BUTTON( 'Show modal',
>>>_type="button",
>>>_class = "btn 
>>> btn-default",
>>>_onclick=""" $('#
>>> *cont_id*').modal('show')   """)
>>>
>>> #don't forget to add dialog and show_modal_btn to main page
>>> main_pg.append(show_modal_btn)   # or main_pg.append( 
>>> DIV(show_modal_btn) 
>>>  ) or something else
>>> main_pg.append(dialog)
>>>
>>>return dict(main_pg = main_pg)
>>>
>>>
>>>
>>>
>>> # keep in mind just one thing:
>>> #   this controller is exposed by *.load, so it must return a dict of 
>>> ONE element 
>>> #   to return more than one element - wrap all in one DIV:
>>> #   ret = DIV()
>>> #   ret.append( ... ) 
>>> #   ret.append( form )  
>>> #  ret.append( ... )
>>> #  return dict(ret = ret) 
>>>
>>> def *modal_content*():
>>> 
>>> form = SQLFORM(...) # or even form = SQLFORM.grid(...)
>>>
>>> return dict(form=form)
>>>
>>>
>>>
>>> # means bootstrap 3
>>> def* modal_wrapper*(content, _id, header='', footer=''):
>>>
>>> main_wrap = DIV('',  _class="modal fade",  _role="dialog", _id=_id, 
>>> _tabindex="-1" )
>>> title_id = _id + '_title'
>>> main_wrap['_aria-labelledby']=title_id
>>>
>>> dialog_div=DIV('', _class="modal-dialog" , _role="document")
>>> content_div=DIV('', _class="modal-content")
>>> header_div = DIV( _class="modal-header")
>>>
>>> close_cross = BUTTON(
>>> SPAN(XML('×'), **{'_aria-hidden':"true"}),
>>> _type="button",  _class="close",
>>>  data={'dismiss':"modal"},
>>>  **{'_aria-label':"Close"}
>>>  )
>>> title_h4 = H4( header,  _class="modal-title",  _id = title_id)
>>> body_div = DIV( content, _class="modal-body")
>>>
>>>
>>> close_btn = BUTTON('Close',  _type="button", _class="btn 
>>> btn-default", data={'dismiss':"modal"})
>>> footer_div =  DIV( footer, close_btn, _class="modal-footer")
>>>
>>> # gluon all
>>> main_wrap[0] = dialog_div
>>> dialog_div[0] = content_div
>>>
>>> header_div.append(close_cross)
>>> header_div.append(title_h4)
>>>
>>> [content_div.append(c) for c in (header_div, body_div, footer_div)]
>>> return main_wrap
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> On Thursday, February 11, 2016 at 8:07:32 PM UTC+3, billmac...@gmail.com 
>>> wrote:

 Thank you for your answer Massimo. When I implemented this. 

 Apply To This Post

 It shows me a button and then I get redirected to another page. I just 
 wanted a pop up window open up with a form to submit that user can move 
 around without being redirected to another page.





 On Wednesday, February 10, 2016 at 10:51:11 PM UTC-5, Massimo Di Pierro 
 wrote:
>>

Re: [web2py] Re: ubuntu web2py

2016-02-12 Thread Jim Steil
Thanks for the clarification!

I'm looking at the script and working on a mod that will install the
systemd init script as well.  I'm not real good with shell scripting but
will try to get it done.

-Jim

On Fri, Feb 12, 2016 at 10:45 AM, Mirek Zvolský  wrote:

> Yes! Exactly.
> You use web2py script from web2py repository (2016, Feb) - this is good
> idea.
> I have used web2py script from web2py stable (2015, Dec) - this is bad
> idea (missing ini file).
>
>
>
>
>
> Dne pátek 12. února 2016 15:25:52 UTC+1 Jim S napsal(a):
>>
>> I'm confused by which script you're running for installation.  When I
>> install web2py on ubuntu I go through the following steps.
>>
>> 1.  Install Ubuntu
>> 2.  sudo apt-get install git
>> 3.  in my home directory ->  git clone
>> https://github.com/web2py/web2py.git
>> 4.  cd web2py/scripts
>> 5.  sudo chmod +x setup-web2py-nginx-uwsgi-ubuntu.sh
>> 6.  ./setup-web2py-nginx-uwsgi-ubuntu.sh
>> 7.  create the emperor.uwsgi.service file (from earlier in this thread)
>> in /etc/systemd/system
>>
>> There is probably a more precise way of doing it, but this is what I've
>> been using.
>>
>> -Jim
>>
>>
>> On Friday, February 12, 2016 at 2:11:26 AM UTC-6, Mirek Zvolský wrote:
>>>
>>> Yes. Thanks.
>>>
>>> But I have used the script from current stable version
>>> 2.13.4-stable+timestamp.2015.12.26.04.59.39 and that is bad idea.
>>> With up-to-date script from web2py respository it probably completly
>>> works without problems.
>>> But if you use the older version of setup-web2py-nginx-uwsgi-ubuntu.sh then
>>> you can repair it so, that you find content for /etc/uwsgi/web2py.ini in
>>> same up-to-date script in web2py repository and manually create the .ini
>>> file.
>>>
>>> And I should say, I have added your code listed here above for
>>> /etc/systemd/system/emperor.uwsgi.service
>>> I am not sure if this is already in the latest version of script or not
>>> (just run the script and then see...)
>>>
>>> After that you can control both
>>> service nginx status/start/stop
>>> service emperor.uwsgi status/start/stop
>>> and all works well.
>>> At least at Debian 8 Jessie.
>>>
>>> Note: the description in web2py.com/book is however to old and cannot
>>> be used for systemd.
>>>
>>>
>>>
>>>
>>>
>>> Dne čtvrtek 11. února 2016 20:12:19 UTC+1 Jim S napsal(a):

 It gets created in the web2py/nginx/ubuntu install script.

 -Jim

 On Thu, Feb 11, 2016 at 11:45 AM, Mirek Zvolský 
 wrote:

> I am trying do the same on Debian 8 Jessie and have a question:
> From where do you have /etc/uwsgi/web2py.ini
> I have no such file. From that reason your point (5) will fail for me.
>
>
>
>
> Dne středa 10. února 2016 14:46:37 UTC+1 Jim S napsal(a):
>>
>> I got this working!
>>
>> Here is what I did.
>>
>> 1. Run the normal web2py installation script for nginx/ubuntu
>> 2. sudo nano edit /etc/systemd/system/emperor.uwsgi.service
>>
>> Add these lines
>> [Unit]
>> Description = uWSGI Emperor
>> After = syslog.target
>>
>>
>> [Service]
>> ExecStart = /usr/local/bin/uwsgi --ini /etc/uwsgi/web2py.ini
>> RuntimeDirectory = uwsgi
>> Restart = always
>> KillSignal = SIGQUIT
>> Type = notify
>> StandardError = syslog
>> NotifyAccess = all
>>
>>
>> [Install]
>> WantedBy = multi-user.target
>>
>> 3. Exit and save the file
>> 4. systemctl enable emperor.uwsgi.service
>> 5. systemctl start emperor.uwsgi.service
>>
>> You should now be able to browse to http://localhost or
>> https://localhost
>>
>> On restart of the system, this service will automatically start.
>>
>> Let me know if you have questions.
>>
>> -Jim
>>
>> Thanks niphlod for the pointers and encouragement...
>>
> --
> 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/ZM9IIEjtHSI/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+un...@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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/ZM9IIEjtHSI/unsubscribe.
> To unsubscribe from this group and all its topics, send an

Re: [web2py] Re: ubuntu web2py

2016-02-12 Thread Mirek Zvolský
Yes! Exactly.
You use web2py script from web2py repository (2016, Feb) - this is good 
idea.
I have used web2py script from web2py stable (2015, Dec) - this is bad idea 
(missing ini file).





Dne pátek 12. února 2016 15:25:52 UTC+1 Jim S napsal(a):
>
> I'm confused by which script you're running for installation.  When I 
> install web2py on ubuntu I go through the following steps.
>
> 1.  Install Ubuntu
> 2.  sudo apt-get install git
> 3.  in my home directory ->  git clone 
> https://github.com/web2py/web2py.git
> 4.  cd web2py/scripts
> 5.  sudo chmod +x setup-web2py-nginx-uwsgi-ubuntu.sh
> 6.  ./setup-web2py-nginx-uwsgi-ubuntu.sh
> 7.  create the emperor.uwsgi.service file (from earlier in this thread) in 
> /etc/systemd/system
>
> There is probably a more precise way of doing it, but this is what I've 
> been using.
>
> -Jim
>
>
> On Friday, February 12, 2016 at 2:11:26 AM UTC-6, Mirek Zvolský wrote:
>>
>> Yes. Thanks.
>>
>> But I have used the script from current stable version 
>> 2.13.4-stable+timestamp.2015.12.26.04.59.39 and that is bad idea.
>> With up-to-date script from web2py respository it probably completly 
>> works without problems.
>> But if you use the older version of setup-web2py-nginx-uwsgi-ubuntu.sh then 
>> you can repair it so, that you find content for /etc/uwsgi/web2py.ini in 
>> same up-to-date script in web2py repository and manually create the .ini 
>> file.
>>
>> And I should say, I have added your code listed here above for 
>> /etc/systemd/system/emperor.uwsgi.service
>> I am not sure if this is already in the latest version of script or not 
>> (just run the script and then see...)
>>
>> After that you can control both
>> service nginx status/start/stop
>> service emperor.uwsgi status/start/stop
>> and all works well.
>> At least at Debian 8 Jessie.
>>
>> Note: the description in web2py.com/book is however to old and cannot be 
>> used for systemd.
>>
>>
>>
>>
>>
>> Dne čtvrtek 11. února 2016 20:12:19 UTC+1 Jim S napsal(a):
>>>
>>> It gets created in the web2py/nginx/ubuntu install script.
>>>
>>> -Jim
>>>
>>> On Thu, Feb 11, 2016 at 11:45 AM, Mirek Zvolský  
>>> wrote:
>>>
 I am trying do the same on Debian 8 Jessie and have a question:
 From where do you have /etc/uwsgi/web2py.ini
 I have no such file. From that reason your point (5) will fail for me.




 Dne středa 10. února 2016 14:46:37 UTC+1 Jim S napsal(a):
>
> I got this working!
>
> Here is what I did.
>
> 1. Run the normal web2py installation script for nginx/ubuntu
> 2. sudo nano edit /etc/systemd/system/emperor.uwsgi.service
>
> Add these lines
> [Unit]
> Description = uWSGI Emperor
> After = syslog.target
>
>
> [Service]
> ExecStart = /usr/local/bin/uwsgi --ini /etc/uwsgi/web2py.ini
> RuntimeDirectory = uwsgi
> Restart = always
> KillSignal = SIGQUIT
> Type = notify
> StandardError = syslog
> NotifyAccess = all
>
>
> [Install]
> WantedBy = multi-user.target
>
> 3. Exit and save the file
> 4. systemctl enable emperor.uwsgi.service
> 5. systemctl start emperor.uwsgi.service
>
> You should now be able to browse to http://localhost or 
> https://localhost
>
> On restart of the system, this service will automatically start.
>
> Let me know if you have questions.
>
> -Jim
>
> Thanks niphlod for the pointers and encouragement...
>
 -- 
 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/ZM9IIEjtHSI/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to 
 web2py+un...@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: alternative autocomplete widget

2016-02-12 Thread Richard Vézina
This is mostly it :

# Code in controller
@cache('json_feed', time_expire=60)
def json_feed():
rows = db().select(db.table_name_all.ALL)
options = []
for i, row in enumerate(rows):
options.append({'option': row.field_name, 'id': row.id})
from gluon.contrib import simplejson
return simplejson.dumps({'options': options})


def typeahead_widget(field, value, json_feed=json_feed(), **kwargs):
input_args = {'_data-provide': 'typeahead', '_autocomplete': 'off'}
input_args.update(**kwargs)
return CAT(
INPUT(
_type='text',
_class='string input-xlarge',
_id='txt_%s_%s' % (field._tablename, field.name),
_value=value,
**input_args
),
SELECT(
_id='%s_%s' % (field._tablename, field.name),
_name='%s' % (field.name),
_style='display: none;',
_multiple='multiple',
requires=field.requires
),
DIV(
OL(
_id='ol_%s_%s' % (field._tablename, field.name),
_class='typeahead_multiselect'
),
_class='typeahead_multiselect'
),
SCRIPT("""
$(document).ready(function(){
var json_feed = $.parseJSON('%(json_feed)s');
var mapped = {};
var searchFieldNames = _.debounce(function(query, process) {
var labels = []

$.each(json_feed.options, function (i, item) {
mapped[item.option] = item.id
labels.push(item.option)
});
process(labels);
}, 100);
// _.debounce() depend on underscore.js
//make_ol_sortable(); // jquery-sortable seems to be bugged and
leave option with value undefined
$('#%(txtSearch)s').typeahead({
minLength: 0,
items: 30,
source: function(query, process) {
searchFieldNames (query, process);
},
updater: function(item) {
$('#%(olSearch)s li span:contains("' + item +
'")').parent().remove();
$('#%(olSearch)s').append('' + item + 'x');

//$('#%(olSearch)s').sortable().bind('sortupdate',function(){
//redo_select();
//});
redo_select();
checkOlEmpty();
}
});

checkOlEmpty();

});
function redo_select() {
$('select[id="%(selSearch)s"]').empty();
$('#%(olSearch)s li').each(function(){
$('#%(selSearch)s').append('' + $('li[id="' +
$(this).attr('id') + '"] span.typeahead_multiselect_option_label').text() +
'');
});
}

function checkOlEmpty() {
$('ol.typeahead_multiselect').hide();
$('ol.typeahead_multiselect').has('li').show();
};

function make_ol_sortable(){
var adjustment;
$('#%(olSearch)s').sortable({
  group: 'simple_with_animation',
  pullPlaceholder: false,
  // animation on drop
  onDrop: function  (item, targetContainer, _super) {
var clonedItem = $('').css({height: 0})
item.before(clonedItem)
clonedItem.animate({'height': item.height()})

item.animate(clonedItem.position(), function  () {
  clonedItem.detach()
  _super(item)
})
//redo_select(); // This not working for now there is
option with undefined value that remain once the dragged option is released
that seems a bug
  },

  // set item relative to cursor position
  onDragStart: function ($item, container, _super) {
var offset = $item.offset(),
pointer = container.rootGroup.pointer

adjustment = {
  left: pointer.left - offset.left,
  top: pointer.top - offset.top
}

_super($item, container)
  },
  onDrag: function ($item, position) {
$item.css({
  left: position.left - adjustment.left,
  top: position.top - adjustment.top
})
  }
});
}

""" % {'txtSearch': 'txt_%s_%s' % (field._tablename, field.name),
   'selSearch': '%s_%s' % (field._tablename, field.name),
   'olSearch': 'ol_%s_%s' % (field._tablename, field.name),
   'json_feed': XML(json_feed),
   })
)

I am not a JS kingpin, so it may contain dumb things... Basically I create

Re: [web2py] Re: ubuntu web2py

2016-02-12 Thread Jim S
I'm confused by which script you're running for installation.  When I 
install web2py on ubuntu I go through the following steps.

1.  Install Ubuntu
2.  sudo apt-get install git
3.  in my home directory ->  git clone https://github.com/web2py/web2py.git
4.  cd web2py/scripts
5.  sudo chmod +x setup-web2py-nginx-uwsgi-ubuntu.sh
6.  ./setup-web2py-nginx-uwsgi-ubuntu.sh
7.  create the emperor.uwsgi.service file (from earlier in this thread) in 
/etc/systemd/system

There is probably a more precise way of doing it, but this is what I've 
been using.

-Jim


On Friday, February 12, 2016 at 2:11:26 AM UTC-6, Mirek Zvolský wrote:
>
> Yes. Thanks.
>
> But I have used the script from current stable version 
> 2.13.4-stable+timestamp.2015.12.26.04.59.39 and that is bad idea.
> With up-to-date script from web2py respository it probably completly works 
> without problems.
> But if you use the older version of setup-web2py-nginx-uwsgi-ubuntu.sh then 
> you can repair it so, that you find content for /etc/uwsgi/web2py.ini in 
> same up-to-date script in web2py repository and manually create the .ini 
> file.
>
> And I should say, I have added your code listed here above for 
> /etc/systemd/system/emperor.uwsgi.service
> I am not sure if this is already in the latest version of script or not 
> (just run the script and then see...)
>
> After that you can control both
> service nginx status/start/stop
> service emperor.uwsgi status/start/stop
> and all works well.
> At least at Debian 8 Jessie.
>
> Note: the description in web2py.com/book is however to old and cannot be 
> used for systemd.
>
>
>
>
>
> Dne čtvrtek 11. února 2016 20:12:19 UTC+1 Jim S napsal(a):
>>
>> It gets created in the web2py/nginx/ubuntu install script.
>>
>> -Jim
>>
>> On Thu, Feb 11, 2016 at 11:45 AM, Mirek Zvolský  wrote:
>>
>>> I am trying do the same on Debian 8 Jessie and have a question:
>>> From where do you have /etc/uwsgi/web2py.ini
>>> I have no such file. From that reason your point (5) will fail for me.
>>>
>>>
>>>
>>>
>>> Dne středa 10. února 2016 14:46:37 UTC+1 Jim S napsal(a):

 I got this working!

 Here is what I did.

 1. Run the normal web2py installation script for nginx/ubuntu
 2. sudo nano edit /etc/systemd/system/emperor.uwsgi.service

 Add these lines
 [Unit]
 Description = uWSGI Emperor
 After = syslog.target


 [Service]
 ExecStart = /usr/local/bin/uwsgi --ini /etc/uwsgi/web2py.ini
 RuntimeDirectory = uwsgi
 Restart = always
 KillSignal = SIGQUIT
 Type = notify
 StandardError = syslog
 NotifyAccess = all


 [Install]
 WantedBy = multi-user.target

 3. Exit and save the file
 4. systemctl enable emperor.uwsgi.service
 5. systemctl start emperor.uwsgi.service

 You should now be able to browse to http://localhost or 
 https://localhost

 On restart of the system, this service will automatically start.

 Let me know if you have questions.

 -Jim

 Thanks niphlod for the pointers and encouragement...

>>> -- 
>>> 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/ZM9IIEjtHSI/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to 
>>> web2py+un...@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: Web2py-appreport

2016-02-12 Thread LightDot
I've been using it in production for years, generating quite a few pdfs 
daily. If I remember correctly, I made only minor modifications for my 
needs.

Can't help with your issue though.

Regards

On Friday, February 12, 2016 at 1:05:22 PM UTC+1, Anthony Smith wrote:
>
> Hi,
> I gather this plugin is not correct and doesn't work without lots of work.
>
> cheers 
> Anthony 
>
> On Tuesday, 9 February 2016 21:08:46 UTC+11, Anthony Smith wrote:
>>
>> Hi Massimo,
>>
>> Thanks for you help you can download form here 
>> https://github.com/lucasdavila/web2py-appreport/wiki
>>
>> Thanks for looking into this 
>>
>> On Tuesday, 9 February 2016 13:37:01 UTC+11, Massimo Di Pierro wrote:
>>>
>>>  do not know. Can you post this plugin? I have never seen it. Perhaps 
>>> assumes a library that is not installed.
>>>
>>> On Monday, 8 February 2016 02:24:38 UTC-6, Anthony Smith wrote:

 Hi Massimo, 

 Tried that and now getting this error 

 1.
 2.
 3.
 4.
 5.
 6.
 7.
 8.
 9.
 10.
 11.
 12.
 13.

 Traceback (most recent call last):
   File "/home/tony/web2py/gluon/restricted.py", line 227, in restricted
 exec ccode in environment
   File "/home/tony/web2py/applications/reports/models/plugin_appreport.py" 
 ,
  line 25, in 
 import plugin_appreport as plugin_appreport_module
   File "/home/tony/web2py/gluon/custom_import.py", line 85, in 
 custom_importer
 modules_prefix, globals, locals, [itemname], level)
   File "applications/reports/modules/plugin_appreport/__init__.py", line 
 2, in 
 import report_web2py
   File "/home/tony/web2py/gluon/custom_import.py", line 89, in 
 custom_importer
 raise ImportError, 'Cannot import module %s' % str(e)
 ImportError: Cannot import module 
 'applications.reports.modules.report_web2py'


 On Sunday, 7 February 2016 16:43:47 UTC+11, Massimo Di Pierro wrote:
>
> import modules.plugin_appreport as plugin_appreport_module
>
> should be
>
>
> import plugin_appreport as plugin_appreport_module
>
>
> On Saturday, 6 February 2016 00:38:24 UTC-6, Anthony Smith wrote:
>>
>> Hi All, 
>>
>> I was following the tutorial from 
>> https://github.com/lucasdavila/web2py-appreport/wiki/Docs-and-examples, 
>> Helper for simple reports and get the follow error when I try to open 
>> the 
>> app 
>>
>> Any ideas would be great 
>>
>>  Cannot import module 
>> 'applications.reports.modules.modules'Version 
>> web2py™ Version 2.13.4-stable+timestamp.2015.12.26.04.59.39 
>> Python Python 2.7.6: /usr/bin/python (prefix: /usr) Traceback 
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>> 7.
>> 8.
>> 9.
>>
>> Traceback (most recent call last):
>>   File "/home/tony/web2py/gluon/restricted.py", line 227, in restricted
>> exec ccode in environment
>>   File 
>> "/home/tony/web2py/applications/reports/models/plugin_appreport.py" 
>> ,
>>  line 25, in 
>> import modules.plugin_appreport as plugin_appreport_module
>>   File "/home/tony/web2py/gluon/custom_import.py", line 89, in 
>> custom_importer
>> raise ImportError, 'Cannot import module %s' % str(e)
>> ImportError: Cannot import module 'applications.reports.modules.modules'
>>
>>

-- 
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: alternative autocomplete widget

2016-02-12 Thread tim . nyborg
I've been thinking about doing this exact thing for a while, so I'll be 
eagerly watching your plugin

On Thursday, 11 February 2016 16:18:28 UTC, Carlos Cesar Caballero wrote:
>
> Hi, right now I am working in a plugin with an autocomplete widget using 
> typeahead.js: 
>
> https://github.com/daxslab/web2py-typeahead 
>
> Any clues, suggestions, recomendations etc... will be very welcomed. 
>
> Greetings. 
>
> -- 
> Este mensaje le ha llegado mediante el servicio de correo electronico que 
> ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema 
> Nacional de Salud. La persona que envia este correo asume el compromiso de 
> usar el servicio a tales fines y cumplir con las regulaciones establecidas 
>
> Infomed: http://www.sld.cu/ 
>
>

-- 
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: Web2py-appreport

2016-02-12 Thread Anthony Smith
Hi,
I gather this plugin is not correct and doesn't work without lots of work.

cheers 
Anthony 

On Tuesday, 9 February 2016 21:08:46 UTC+11, Anthony Smith wrote:
>
> Hi Massimo,
>
> Thanks for you help you can download form here 
> https://github.com/lucasdavila/web2py-appreport/wiki
>
> Thanks for looking into this 
>
> On Tuesday, 9 February 2016 13:37:01 UTC+11, Massimo Di Pierro wrote:
>>
>>  do not know. Can you post this plugin? I have never seen it. Perhaps 
>> assumes a library that is not installed.
>>
>> On Monday, 8 February 2016 02:24:38 UTC-6, Anthony Smith wrote:
>>>
>>> Hi Massimo, 
>>>
>>> Tried that and now getting this error 
>>>
>>> 1.
>>> 2.
>>> 3.
>>> 4.
>>> 5.
>>> 6.
>>> 7.
>>> 8.
>>> 9.
>>> 10.
>>> 11.
>>> 12.
>>> 13.
>>>
>>> Traceback (most recent call last):
>>>   File "/home/tony/web2py/gluon/restricted.py", line 227, in restricted
>>> exec ccode in environment
>>>   File "/home/tony/web2py/applications/reports/models/plugin_appreport.py" 
>>> ,
>>>  line 25, in 
>>> import plugin_appreport as plugin_appreport_module
>>>   File "/home/tony/web2py/gluon/custom_import.py", line 85, in 
>>> custom_importer
>>> modules_prefix, globals, locals, [itemname], level)
>>>   File "applications/reports/modules/plugin_appreport/__init__.py", line 2, 
>>> in 
>>> import report_web2py
>>>   File "/home/tony/web2py/gluon/custom_import.py", line 89, in 
>>> custom_importer
>>> raise ImportError, 'Cannot import module %s' % str(e)
>>> ImportError: Cannot import module 
>>> 'applications.reports.modules.report_web2py'
>>>
>>>
>>> On Sunday, 7 February 2016 16:43:47 UTC+11, Massimo Di Pierro wrote:

 import modules.plugin_appreport as plugin_appreport_module

 should be


 import plugin_appreport as plugin_appreport_module


 On Saturday, 6 February 2016 00:38:24 UTC-6, Anthony Smith wrote:
>
> Hi All, 
>
> I was following the tutorial from 
> https://github.com/lucasdavila/web2py-appreport/wiki/Docs-and-examples, 
> Helper for simple reports and get the follow error when I try to open the 
> app 
>
> Any ideas would be great 
>
>  Cannot import module 
> 'applications.reports.modules.modules'Version 
> web2py™ Version 2.13.4-stable+timestamp.2015.12.26.04.59.39 
> Python Python 2.7.6: /usr/bin/python (prefix: /usr) Traceback 
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
>
> Traceback (most recent call last):
>   File "/home/tony/web2py/gluon/restricted.py", line 227, in restricted
> exec ccode in environment
>   File 
> "/home/tony/web2py/applications/reports/models/plugin_appreport.py" 
> ,
>  line 25, in 
> import modules.plugin_appreport as plugin_appreport_module
>   File "/home/tony/web2py/gluon/custom_import.py", line 89, in 
> custom_importer
> raise ImportError, 'Cannot import module %s' % str(e)
> ImportError: Cannot import module 'applications.reports.modules.modules'
>
>

-- 
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: Problems with Upload files

2016-02-12 Thread Val K
Upload field has custom_store param-see 
https://www.google.ru/url?q=https://groups.google.com/forum/m/%23!topic/web2py/8X-QlbtyxEQ&sa=U&ved=0ahUKEwiL2r_DlvLKAhWBOSwKHYgSDIwQFggNMAA&sig2=WkaSH-wCNyJiXG0Su3f8uA&usg=AFQjCNEu9h6olQktR8ir7Lk7KgBi1y8aoA

-- 
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: Rows not releasing all the memory back

2016-02-12 Thread Alfonso Serra
you still have alert_rows in memory.
it would be
for row in alert_rows.exclude ...
pass
del alert_rows
gc.collect()

On Friday, 12 February 2016 05:45:49 UTC, Jitun John wrote:
>
> I am using to remove rows...
>
> for row in alerts_rows.exclude(lambda row: row.id > 0):
> pass
>
>
> On Friday, February 12, 2016 at 5:49:38 AM UTC+5:30, Alfonso Serra wrote:
>>
>> You can try "del rows" to remove the reference from memory before 
>> collecting 
>> del a single row raises a TypeError but del rows doesnt. It may help.
>>
>>

-- 
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] what is equivalent query related to this in web2py

2016-02-12 Thread Nico de Groot
Welcome to web2py!
In web2py login is handled by the framework. You don't have to write code to 
create and handle a form and check the login. Please check the book 
http://web2py.com/books/default/chapter/29/09/access-control

Nico de Groot

-- 
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] what is equivalent query related to this in web2py

2016-02-12 Thread prashant joshi


*This is in java*

String user = req.getParameter("userName");
String pass = req.getParameter("userPassword");

pw.print("");

if (user.equals("select * from login where userId="+user+"and password"+pass) )
pw.println("Login Success...!");
else
pw.println("Login Failed...!");

-- 
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: Info: Good hosting service (virtual server)

2016-02-12 Thread Mirek Zvolský
Here you can see response of my nginx-uwsgi-web2py
http://81.2.244.50
hope later there will be something different as /welcome

-- 
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] Info: Good hosting service (virtual server)

2016-02-12 Thread Mirek Zvolský
forpsi.com provides
- Webhosting Easy with Python/SQLite 0.8 EUR/month + 1.2 EUR Postgres (I 
have not tested this one)
- virtual server Cloud Smart VPS Small (1G RAM, 20G SDD disk, 50G 
additional FTP, Debian or CentOS) 1.0 EUR/month.

And of course higher level (and more expensive) hosting programs (include 
Windows/MSSQL if somebody need more experimental technology).
However I am not sure if services are accessible for customers outside of 
UK,GE,IT,CZ.

I use the virtual server with Debian 8 Jessie.
Somewhere on their pages (CZ version) I have found that if you send a 
motivation message, you will get 9 EUR voucher,
so I have (I hope) starting 9 months for free.
However price problem can be the ssl certificate for https (except of the 
self signed certificate).

To install nginx-uwsgi-web2py on the plain virtual machine you can use 
scripts/setup-web2py-nginx-uwsgi-ubuntu.sh
but don't use the old one from stable version, but the newer from 
github.com/web2py/web2py.
In problems see this:
https://groups.google.com/forum/#!topic/web2py/ZM9IIEjtHSI

-- 
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: ubuntu web2py

2016-02-12 Thread Mirek Zvolský
Yes. Thanks.

But I have used the script from current stable version 
2.13.4-stable+timestamp.2015.12.26.04.59.39 and that is bad idea.
With up-to-date script from web2py respository it probably completly works 
without problems.
But if you use the older version of setup-web2py-nginx-uwsgi-ubuntu.sh then 
you can repair it so, that you find content for /etc/uwsgi/web2py.ini in 
same up-to-date script in web2py repository and manually create the .ini 
file.

And I should say, I have added your code listed here above for 
/etc/systemd/system/emperor.uwsgi.service
I am not sure if this is already in the latest version of script or not 
(just run the script and then see...)

After that you can control both
service nginx status/start/stop
service emperor.uwsgi status/start/stop
and all works well.
At least at Debian 8 Jessie.

Note: the description in web2py.com/book is however to old and cannot be 
used for systemd.





Dne čtvrtek 11. února 2016 20:12:19 UTC+1 Jim S napsal(a):
>
> It gets created in the web2py/nginx/ubuntu install script.
>
> -Jim
>
> On Thu, Feb 11, 2016 at 11:45 AM, Mirek Zvolský  > wrote:
>
>> I am trying do the same on Debian 8 Jessie and have a question:
>> From where do you have /etc/uwsgi/web2py.ini
>> I have no such file. From that reason your point (5) will fail for me.
>>
>>
>>
>>
>> Dne středa 10. února 2016 14:46:37 UTC+1 Jim S napsal(a):
>>>
>>> I got this working!
>>>
>>> Here is what I did.
>>>
>>> 1. Run the normal web2py installation script for nginx/ubuntu
>>> 2. sudo nano edit /etc/systemd/system/emperor.uwsgi.service
>>>
>>> Add these lines
>>> [Unit]
>>> Description = uWSGI Emperor
>>> After = syslog.target
>>>
>>>
>>> [Service]
>>> ExecStart = /usr/local/bin/uwsgi --ini /etc/uwsgi/web2py.ini
>>> RuntimeDirectory = uwsgi
>>> Restart = always
>>> KillSignal = SIGQUIT
>>> Type = notify
>>> StandardError = syslog
>>> NotifyAccess = all
>>>
>>>
>>> [Install]
>>> WantedBy = multi-user.target
>>>
>>> 3. Exit and save the file
>>> 4. systemctl enable emperor.uwsgi.service
>>> 5. systemctl start emperor.uwsgi.service
>>>
>>> You should now be able to browse to http://localhost or 
>>> https://localhost
>>>
>>> On restart of the system, this service will automatically start.
>>>
>>> Let me know if you have questions.
>>>
>>> -Jim
>>>
>>> Thanks niphlod for the pointers and encouragement...
>>>
>> -- 
>> 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/ZM9IIEjtHSI/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> web2py+un...@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.