[web2py] Re: How to insert data in data base by xml file

2015-07-07 Thread Carla Raquel
This is how I dealt with my xml files:

doc = xml.dom.minidom.parse(...my_xml.xml)// Here you parse the xml file


for node in doc.getElementsByTagName(recipe)://Here you read in a cycle the 
tags which contain  numerous attributes each

t=node.getAttribute(name)//Each attribute is stored as a string in a 
variable that you can add to the db
d=node.getAttribute(creator)


try:
db.Recipe.update_or_insert(Name=t,Creator=d)//each time you cycle through 
each node you are adding the name and creator to the db if both aren't already 
there
except:
pass


Hope it helped.

quarta-feira, 1 de Julho de 2015 às 15:01:19 UTC+1, Sai Harsh Tondomker 
escreveu:


 My project is to make simple quizzing site.

 I have made data base in web2py.

 with Question, options and Correct answer.

 The data will be xml file. From XML file I need to take data and store in 
 data base 

 Please help me to solve the problem.

 Waiting for your response.

 Best Regards
 T.Sai Harsh 


-- 
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 application running very slow on rocket server in production mode

2015-07-07 Thread Leonel Câmara
Well rocket is slow. Use IIS and fastcgi.

-- 
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] JSON and url vars

2015-07-07 Thread Carla Raquel
I'm passing a few variables from the controller(including one of them a 
list) to the view and I have a link that is built using those 
variables.Below is the controller function:

def indexResumo():
meses = 
{'Janeiro':1,'Fevereiro':2,'Março':3,'Abril':4,'Maio':5,'Junho':6,'Julho':7,'Agosto':8,'Setembro':9,'Outubro':10,'Novembro':11,'Dezembro':12}
newlist=[]
year =request.now.year
name = session.auth.user.first_name + ' ' + session.auth.user.last_name
month = (list(meses.keys())[list(meses.values()).index(request.now.month - 
1)])
query = (db.auth_user.Supervisor == session.auth.user.id)
colaboradores = 
db(query).select(db.auth_user.first_name,db.auth_user.last_name)
for x in colaboradores:
newlist.append(x.first_name + ' ' + x.last_name)

return locals()


And here is part of the view indexResumo that matters:

a 
href={{=URL('default','resumoMensalTMN',vars={'nome':name,'mes':month,'ano':year,'colaboradores':newlist})}}

a 
href={{=URL('default','resumoMensalLocal',vars={'nome':name,'mes':month,'ano':year,'colaboradores':newlist})}}


When the above link loads, I have a javascript function that reads each of 
the variables passed:

getUrlVars()[name_of_the_var];


My question is,what would be better: reading the variables this way, or 
move the code in the function indexResumo to both functions 
resumoMensalTMN and resumoMensalLocal,have no variables sent in the 
url, and read those via json on my view? I hope I made any sense here.

-- 
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] Display SQLFORM.Grid inside view of another SQLFORM.grid.

2015-07-07 Thread Prasad Muley
Hi,

  I have a SQLFORM.grid which displays information about employee 
table. Every employee may have multiple addresses. 
So I have to display multiple address in another grid (address grid) inside 
edit form of the employee grid.


*models/db.py*

db.define_table('employee',
Field('fname', 'string', label=T(First Name), 
required=True),
Field('lname', 'string', label=T(Last Name), 
required=True),
Field('email', requires=IS_EMAIL()),
format='%(email)s')

db.define_table('address',
Field('employee', db.employee),
Field('Address', 'text'))

*controllers/default.py*

def _validate_emp_records(form):
error_exist = False
if not form.vars.fname:
form.errors.fname = T(Enter First Name)
error_exist = True

if not form.vars.lname:
form.errors.lname = T('Enter last name')
error_exist = True

return not error_exist


@auth.requires_login()
def index():

example action using the internationalization operator T and flash
rendered by views/default/index.html or views/generic.html

if you need a simple wiki simply replace the two lines below with:
return auth.wiki()

query = (db.employee.id  0)
emp_grid = SQLFORM.grid(query, showbuttontext=False, csv=False,
deletable=False)
address_grid = None

if request.args(0) == 'edit':
form = emp_grid.update_form
emp_id = request.args(2)
address_query = (db.address.employee == emp_id)
# show all address in edit form of employee
address_grid = SQLFORM.grid(address_query, deletable=False,
showbuttontext=False, csv=False)

if form.process(onvalidation=_validate_emp_records).accepted:
session.flash = T('Updated %s' % form.vars.id)
redirect(URL('default', 'index'))
elif form.errors:
response.flash = T(form has errors)

if request.args(0) == 'view':
form = emp_grid.view_form

if request.args(0) == 'new':
form = emp_grid.create_form

return dict(emp_grid=emp_grid, address_grid=address_grid)


*views/default/index.html*


{{extend 'layout.html'}}

{{=emp_grid}}

{{ if address_grid: }}
 {{ =address_grid}}
{{ pass }}


Here, 
 It shows two edit forms whenever I click on edit icon. [See 
attachment edit_records.png]

Is it possible to display SQLFORM.grid inside view of another SQLFORM.grid?


-- 
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: format field from m:1 table

2015-07-07 Thread Richard Vézina
For the requires part, see Anthony answer here :
https://groups.google.com/d/msg/web2py/QBTYaytNypU/DW2HpnT-xK0J

Representation is easier :
represent lambda id, row: '{0} {1} {2}'.format(row.produc_name,
db.company(id).name, db.region(db.company(id).id).name) if id else T('N/A')

I am not sure Steve code works, thanks to report if it works I am curious...

Richard

On Mon, Jul 6, 2015 at 8:02 PM, 黄祥 steve.van.chris...@gmail.com wrote:

 please try (not tested)

 db.define_table('company',
 Field('name'),
 Field('region', 'reference region'),
 format = lambda r: '%s - %s' % (r.name, r.region.name) )

 best regards,
 stifan

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


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


[web2py] Re: DAL min on 2 date columns

2015-07-07 Thread Dave S


On Tuesday, July 7, 2015 at 8:15:08 AM UTC-7, pjryan126 wrote:

 Why not make it Field('date_updated', 'datetime', default=request.now, 
 update=request.now) and then search on date_updated only?


Jumping in, let me say that I like this.  For rows that haven't been 
updated since they were created, this will give those fields the same value.

I can see, however, that someone might also want to know what their oldest 
row is, even if it updated recently.  Probably best done be searching only 
date_created.

/dps

 


 On Tuesday, July 7, 2015 at 9:04:21 AM UTC-4, lyn2py wrote:

 Hi,

 If I have 2 columns, date_created, date_updated

 db.define_table('table', 
 Field('date_created', 'datetime',default=request.now),
 Field('date_updated', 'datetime',update=request.now),
 )

 and I want to do a DAL query to get the datetime that is the furthest 
 from now (i.e. the db entry is the oldest) on both the date_created and 
 date_updated. I know how to do it if it's just one column by following the 
 example here (
 http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#sum--avg--min--max-and-len),
  
 but how should I do this if two columns are involved?




-- 
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: Web2py application running very slow on rocket server in production mode

2015-07-07 Thread Richard Vézina
Rocket is for development... Apache, Nginx IIS (microsoft web server), etc.
are production web servers...

You may have a look in web2py scripts folder there is basic
stage/production facilitating script that may help you set up you
production environment... Let says at start more a stage environment...

Richard

On Tue, Jul 7, 2015 at 3:04 PM, Ramashish Gaurav ramashis...@gmail.com
wrote:

 Hello Leonel!

 Thanks for your interest. Can you explain a bit more about IIS and
 fastcgi How to use it ? Is it an alternative to Apache or Rocket or is
 it just for running  testing phase of the app?

 On Tuesday, July 7, 2015 at 10:41:46 PM UTC+5:30, Leonel Câmara wrote:

 Well rocket is slow. Use IIS and fastcgi.

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


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


[web2py] Re: Web2py application running very slow on rocket server in production mode

2015-07-07 Thread Ramashish Gaurav
Hello Leonel!

Thanks for your interest. Can you explain a bit more about IIS and 
fastcgi How to use it ? Is it an alternative to Apache or Rocket or is 
it just for running  testing phase of the app? 

On Tuesday, July 7, 2015 at 10:41:46 PM UTC+5:30, Leonel Câmara wrote:

 Well rocket is slow. Use IIS and fastcgi.


-- 
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 application running very slow on rocket server in production mode

2015-07-07 Thread Ramashish Gaurav
Hello all,

I deployed a web2py application on a local intranet Windows 2012 server 
with 8 GB of RAM, 8 Core processor. I am running the application on Rocket 
Server. Now the application runs very slow in production mode. I compiled 
the app, and the speed improved, but still it is very slow. 

How this problem should be addressed? 

I googled a bit and got to know that it has something to do with GIL which 
is on cpython running on single core (so 7 of my cores is still unused I 
guess). So do I need to deploy the app on apache server, as was suggested ? 
If so, then please someone provide me a relevant link specifying the steps 
to do so. 

The app is in testing phase itself, so I wanted to deploy it as soon as 
possible (thus chose Rocket Server). 

Thanks for reading it. Will appreciate your 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] Re: DAL min on 2 date columns

2015-07-07 Thread 黄祥
not sure i fully understand what you want to achieve, but i guess you can 
use logical operator for that and combine it with DAL min.
ref:
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Logical-operators

best regards,
stifan

-- 
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: prettydate ago is not translated

2015-07-07 Thread icodk
Thanks for your help.
My editor (web2py web interface, Notepad++,Visual Studio) should be able to 
find 'ago' in any sentence combination. It also found '%d weeks ago' as I 
wrote below so I can't see any reason why it should not find  %d hours ago 
unless it is not there. May be I am looking in the wrong file-but 
everything else works fine(I mean the other translations).


On Monday, July 6, 2015 at 8:10:39 AM UTC+2, xmarx wrote:

 you must look up the %d weeks ago, %d hours ago, %d months ago phrases. 
 not just ago. because i think item that be translated is T(%d days 
 ago). not T(ago). i don't know its detail.

  In addition I can only find '%d weeks ago': '%d uge siden', in my 
 language file.


 this translate  used to be work. didn't it?

 2015-07-05 1:49 GMT+03:00 icodk i...@alpiron.com javascript::

 There are two issues here, the first is that 'ago' it is NOT in my 
 language file and if you look in  gluon/tools.py you will see that 
 suffix = ' ago ' and NOT  suffix = T(' ago') . Anyway this is in my 
  gluon/tools.py file.
 OK I replaced  it with:  suffix = T(' ago') .which should be part of the 
 web2py in the first place or I am missing something.

 The second issue is that even if I replaced it as above I still can't 
 find 'ago' in my language file. In addition I can only find '%d weeks 
 ago': '%d uge siden', in my language file. Nothing else from prettydate 
 function in my language file.
 What am I doing wrong ?
 Thanks





 On Saturday, July 4, 2015 at 1:45:24 PM UTC+2, icodk wrote:

 Is there any reason why the 'ago' is not translate in 
 prettydate  (gluon/tools.py) ?

 *suffix = ' ago'* instead of:
 *suffix = ** T( ago)*

 In Danish that will be translated to: 'siden'
 Also I can't find the other strings in my language file
 T('1 year' + suffix)
 T('1 month' + suffix)
 etc.

 I can only find:
 %d weeks ago




  -- 
 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+un...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/d/optout.




 -- 
 Selman Kocael
 İsabet Yayınları

 

-- 
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: Scheduling and/or multiprocessing

2015-07-07 Thread Phillip
I may be testing soon now that I have enough incentive to try it (first 
need to implement/test in python scripts and verify the best way to store 
custom Python objects for my purpose).

On Monday, July 6, 2015 at 10:26:15 AM UTC-5, Massimo Di Pierro wrote:

 It should be fine as long as the process calling multiprocess waits for 
 the spawned process.
 There may be issue with the database connection maintained by the process. 
 Try it and let us know.

 On Monday, 6 July 2015 10:22:10 UTC-5, Phillip wrote:

 It is my understanding that if only multiprocessing is used to spawn 
 processes, the processes are at risk of being killed (depending on their 
 time lapse).


 Are there any reasons Web2py's scheduler would have problems scheduling a 
 python script that uses multiprocessing?


 Thanks



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


[web2py] Re: google play

2015-07-07 Thread eric cuver

Bruno cezar rocha on twitter answer me: 



   1. *eric* ‏@ghyfr1  https://twitter.com/ghyfr1 12 hil y a 12 heures 
   https://twitter.com/ghyfr1/status/617988200615813120
   
   @rochacbruno https://twitter.com/rochacbruno hi bruno you can show me 
   or explain how i can create web2py application for google play #web2py 
   https://twitter.com/hashtag/web2py?src=hash
   https://twitter.com/ghyfr1/status/6179882006158131200 Retweet1 favoris
   Répondre
Retweeter
Favori1
   Voir l'activité du Tweet
   Plus
   2. 
   *Bruno Cezar Rocha* ‏@rochacbruno  https://twitter.com/rochacbruno 10 hil 
   y a 10 heures https://twitter.com/rochacbruno/status/618012797251792896
   
   @ghyfr1 https://twitter.com/ghyfr1 you can create a web2py api to 
   serve data to a mobile app but not an android app with web2py. You can try 
   appery.io.
   Voir la traduction
   04:05 - 6 juil. 2015 · Détails 
   https://twitter.com/rochacbruno/status/618012797251792896
   Masquer la conversation 
   https://twitter.com/rochacbruno/status/6180127972517928960 Retweet0 
   favoris
   Répondre
Retweeter
Favori
   Plus
   Texte du Tweet
   Répondre à @rochacbruno https://twitter.com/rochacbruno 
   https://twitter.com/rochacbruno
Qui apparaît sur ces photos ?
   3. *e* https://twitter.com/ghyfr1ric ‏@ghyfr1  
   https://twitter.com/ghyfr1 10 hil y a 10 heures 
   https://twitter.com/ghyfr1/status/618019273601122304
   
   @rochacbruno https://twitter.com/rochacbruno I would like to do with 
   as you slice web2py application on google play
   https://twitter.com/ghyfr1/status/6180192736011223040 Retweet0 favoris
   Répondre
Retweeter
Favori
   Voir l'activité du Tweet
   Plus
   4. *e* https://twitter.com/ghyfr1ric ‏@ghyfr1  
   https://twitter.com/ghyfr1 10 hil y a 10 heures 
   https://twitter.com/ghyfr1/status/618019407093202944
   
   @rochacbruno https://twitter.com/rochacbruno I would like to do with 
   as you web2py slice application on google play
   https://twitter.com/ghyfr1/status/6180194070932029440 Retweet0 favoris
   Répondre
Retweeter
Favori
   Voir l'activité du Tweet
   Plus
   5. *Bruno Cezar Rocha* ‏@rochacbruno  https://twitter.com/rochacbruno 10 
   hil y a 10 heures 
   https://twitter.com/rochacbruno/status/618022376601731072
   
   @ghyfr1 https://twitter.com/ghyfr1 that was created by appyet service, 
   just an RSS feed reader
   

*eric* ‏@ghyfr1  https://twitter.com/ghyfr1 10 hil y a 10 heures 
https://twitter.com/ghyfr1/status/618024509778591744

@rochacbruno https://twitter.com/rochacbruno ok it's cool thanks
Voir la traduction
https://twitter.com/ghyfr1/status/6180245097785917440 Retweet0 favoris
Répondre
 Retweeter
 Favori
Voir l'activité du Tweet
Plus
04:51 - 6 juil. 2015 · Détails 
https://twitter.com/ghyfr1/status/618024509778591744


Le lundi 6 juillet 2015 22:07:36 UTC+2, Dave S a écrit :



 On Monday, July 6, 2015 at 8:27:08 AM UTC-7, Massimo Di Pierro wrote:

 No but if you find out let us know. :-)

 On Monday, 6 July 2015 10:22:21 UTC-5, eric cuver wrote:


 hi everybody anyone know how I can create a mobile application on google 
 play with web2py as web2pyslices


 Is that Google Play as the store (application distribution), or Google 
 Play as the engine (application environment)?

 I've seen a few examples of mobile apps in this group, but Web2Py's device 
 detection and view mapping seem to be the key parts of that.  I haven't 
 tried any of them yet.

 /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.


[web2py] ascii codec can't decode byte

2015-07-07 Thread icodk
I have a small web2py site that works fine when runs on a Windows 7 machine.
I move it to a linux machine,and everything worked fine until I try to save 
some text to a pg database  that includes letters like: æØÅ

I can insert that type of letters in the database (using pgAdmin3 or 
commandline ) and even see it in a browser when web2py read it from the 
database but when try to save it from the browser I get the type 
*'exceptions.UnicodeDecodeError'** 'ascii' codec can't decode byte 0xc3 in 
position 248: ordinal not in range(128)*
What am I doing wrong, Or better yet: How can I solve it?

-- 
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] get fullpath of uploaded files

2015-07-07 Thread reddyreddy
Hello all,

I want to get the full path of the files that were uploaded.
Iam giving the uploaded folder as 'static/temp'  in db.py.

Thankyou in advance.




-- 
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: list:integer X list:reference for auth_user table

2015-07-07 Thread kulin shah
Hi, 
I am a newbie to web2py and programming in general. I have something like 
this:
Field('cc_list','list:integer',requires=IS_EMPTY_OR(IS_IN_DB(db,'auth_user.id',db.auth_user._format,multiple=True))),
but this is giving an error:
Traceback 

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.

Traceback (most recent call last):
  File /home/kulin/web2py/gluon/restricted.py, line 227, in restricted
exec ccode in environment
  File /home/kulin/web2py/applications/tester/controllers/default.py 
http://127.0.0.1:8000/admin/default/edit/tester/controllers/default.py, line 
143, in module
  File /home/kulin/web2py/gluon/globals.py, line 412, in lambda
self._caller = lambda f: f()
  File /home/kulin/web2py/gluon/tools.py, line 3583, in f
return action(*a, **b)
  File /home/kulin/web2py/applications/tester/controllers/default.py 
http://127.0.0.1:8000/admin/default/edit/tester/controllers/default.py, line 
50, in create_details
form = SQLFORM(db.post).process()
  File /home/kulin/web2py/gluon/html.py, line 2301, in process
self.validate(**kwargs)
  File /home/kulin/web2py/gluon/html.py, line 2238, in validate
if self.accepts(**kwargs):
  File /home/kulin/web2py/gluon/sqlhtml.py, line 1688, in accepts
self.vars.id = self.table.insert(**fields)
  File /home/kulin/web2py/gluon/packages/dal/pydal/objects.py, line 691, in 
insert
ret = self._db._adapter.insert(self, self._listify(fields))
  File /home/kulin/web2py/gluon/packages/dal/pydal/adapters/base.py, line 
731, in insert
raise e
IntegrityError: FOREIGN KEY constraint failed

What am i doing wrong?

On Monday, December 6, 2010 at 8:50:55 AM UTC-8, rochacbruno wrote:


 Is there any important difference?

 1.
 Field('assigned_to','list:integer',requires=IS_IN_DB(db,db.auth_user.id
 ,'db.auth_user.first_name',multiple=True)),

 2.
 Field('assigned_to','list:reference auth_user'),


 In the case of 2, how to represent as 'db.auth_user.first_name' for 
 multiple users?

 -- 

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


-- 
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] allow multiple extensions on upload

2015-07-07 Thread reddyreddy
Hello,

I want to allow upload field to be as .c or .java or .py.
I have seen the book that there is a way for uploading images with 
different extensions.
Can anyone please let me know how to do it for files.

Thanks in advance.

-- 
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: sending email

2015-07-07 Thread Chaitu P
Thank you so much, that got worked.

On Sun, Jul 5, 2015 at 4:47 PM, Jose C houdinihoun...@gmail.com wrote:

 Hmm...are you running your code on a webfaction server or on another
 machine?

 If not running on a webfaction server you'll need to connect to port 587
 like so:
 mail.settings.server = 'smtp.webfaction.com
 http://smtp.webfaction.com:25/:587'



  --
 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.




-- 
Chaitanya Pochampally

-- 
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: Invalid literal for init with base 64

2015-07-07 Thread Alessio Varalta


Hi, thank for your reply this is my table and the filed date are the problem

db.define_table('esercizio',
Field 
http://127.0.0.1:8000/examples/global/vars/Field('partenza',type='date',requires=IS_NOT_EMPTY
 http://127.0.0.1:8000/examples/global/vars/IS_NOT_EMPTY()),
Field 
http://127.0.0.1:8000/examples/global/vars/Field('finale',type='date',requires=IS_NOT_EMPTY
 http://127.0.0.1:8000/examples/global/vars/IS_NOT_EMPTY()),
Field 
http://127.0.0.1:8000/examples/global/vars/Field('inviato',type='boolean',requires=IS_NOT_EMPTY
 http://127.0.0.1:8000/examples/global/vars/IS_NOT_EMPTY()),
Field 
http://127.0.0.1:8000/examples/global/vars/Field('user_id','reference 
auth_user'),
)



On Monday, July 6, 2015 at 5:22:21 PM UTC+2, Alessio Varalta wrote:

 Hi, i use a sqlite database and i use SQLFORM for save my dateThe 
 problem is that have a table with two Field that have date type and when i 
 use SQLFORM and save this date, I have a error when i try to retrieve the 
 date and i have a error when i use appadmin for see my database and the 
 error is:

 Invalid literal for init with base 64


-- 
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] Is the server or client processing Python in the controller?

2015-07-07 Thread Phillip


I assume python embedded into a view would be processed by the server. This 
would be useful to know to given the difficulty to say what CPU costs may 
be. If all is by default processed by the server, would delegating this 
processing to the client be viable? 


Any ideas appreciated

-- 
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: Prevent multiple submit buttons from showing Working... on submit

2015-07-07 Thread Krzysztof Socha


On Wednesday, December 11, 2013 at 10:01:39 PM UTC+1, Mark Li wrote:

 I looked into the code and my web2py.js was not the same as the github 
 link, which I noticed because my forminputclickselector did not contain 

 :not([name])

 . When I diff-ed the original link for the newest web2py.js, with my 
 current web2py.js, it showed no difference. Very odd, maybe I had an old 
 web2py.js in browser cache. Sorry for the confusion.



I have the same problem now -all of my (non-submit!) buttons got 
'Working...' message when submitting the form.
 I checked the github link again... The lines do not match anymore, but I 
have not found not([name]) anywhere now... How do I disable this behaviour?

Krzysztof.

-- 
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] Where to call python code for processing (embedded as JS or in controllers)?

2015-07-07 Thread Phillip


I am having trouble finding anything definitive here. Please help if you 
have any input, even if short.


My goal is to prevent the server from doing the python processing. 


Is this incorrect?: 

If running the python in the controller function (instead of embedding as 
JS), the server will do the processing


Since python functions need to be used in the view for client processing, 
is there an elegant way to call the python methods in the page? Could you 
give me an example of a good way to do this with a large script? i.e. 
returning methods or scripts from the controller, using AJax, etc.

 Am I on the right track?


Thanks,


Phillip K

-- 
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: Semantic 2.0

2015-07-07 Thread eric cuver
oh my god semantic i'm fan 

Le lundi 6 juillet 2015 18:12:28 UTC+2, JorgeH a écrit :

 I am open to use both.

 On Monday, July 6, 2015 at 10:21:55 AM UTC-5, Massimo Di Pierro wrote:

 I am the one who proposed moving to semantic a year ago but the 
 overwhelming majority here wanted bootstrap. :-(

 On Monday, 6 July 2015 09:11:10 UTC-5, Richard wrote:

 Semantic include so much goodies!!

 :)

 Richard

 On Fri, Jul 3, 2015 at 12:03 PM, Massimo Di Pierro 
 massimo@gmail.com wrote:

 We cannot make the layout name a variable because it would break 
 bytecode compilation. If you make a semantic scaffolding app I would like 
 to see it. We can make a site where multiple apps are posted.


 On Thursday, 2 July 2015 06:48:36 UTC-5, 黄祥 wrote:

 have a plan to use semantic for web2py scaffolding app? perhaps, 
 something like
 private/appconfig.ini
 [layout]
 css = bootstrap3
 ;css = bootstrap
 ;css = semantic

 best regards,
 stifan

  -- 
 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+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: DAL min on 2 date columns

2015-07-07 Thread pjryan126
Why not make it Field('date_updated', 'datetime', default=request.now, 
update=request.now) and then search on date_updated only?

On Tuesday, July 7, 2015 at 9:04:21 AM UTC-4, lyn2py wrote:

 Hi,

 If I have 2 columns, date_created, date_updated

 db.define_table('table', 
 Field('date_created', 'datetime',default=request.now),
 Field('date_updated', 'datetime',update=request.now),
 )

 and I want to do a DAL query to get the datetime that is the furthest from 
 now (i.e. the db entry is the oldest) on both the date_created and 
 date_updated. I know how to do it if it's just one column by following the 
 example here 
 (http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#sum--avg--min--max-and-len),
  
 but how should I do this if two columns are involved?




-- 
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: ascii codec can't decode byte

2015-07-07 Thread Leonardo Pires Felix
Use psycopg2 as database driver, just install it and restart your 
application.

pg8000 has a problem with coding.

Em terça-feira, 7 de julho de 2015 18:40:55 UTC-3, icodk escreveu:

 I have a small web2py site that works fine when runs on a Windows 7 
 machine.
 I move it to a linux machine,and everything worked fine until I try to 
 save some text to a pg database  that includes letters like: æØÅ

 I can insert that type of letters in the database (using pgAdmin3 or 
 commandline ) and even see it in a browser when web2py read it from the 
 database but when try to save it from the browser I get the type 
 *'exceptions.UnicodeDecodeError'** 'ascii' codec can't decode byte 0xc3 
 in position 248: ordinal not in range(128)*
 What am I doing wrong, Or better yet: How can I solve it?



-- 
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: Is the server or client processing Python in the controller?

2015-07-07 Thread Michael Beller
The book has a good overview how a web application works:
http://www.web2py.com/books/default/chapter/29/01/introduction#Model-View-Controller

A browser only processes HTML, CSS, and Javascript. The w2p controller 
processes a view and generates the html, css, and javascript required to 
send to the browser via the http response.

On Tuesday, July 7, 2015 at 5:40:39 PM UTC-4, Phillip wrote:

 I assume python embedded into a view would be processed by the 
 server. This would be useful to know to given the difficulty to say what 
 CPU costs may be. If all is by default processed by the server, would 
 delegating this processing to the client be viable? 


 Any ideas appreciated


-- 
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: JSON and url vars

2015-07-07 Thread Leonardo Pires Felix
This is not a recomended approach. Sending such variables on URL you may 
run out of space, see here http://support.microsoft.com/kb/208427. And 
those variables will be cached on user browser, giving space for security 
breaches. And exposing those variables to the user you may run with some 
unexpected behaviours

Em terça-feira, 7 de julho de 2015 13:05:44 UTC-3, Carla Raquel escreveu:

 I'm passing a few variables from the controller(including one of them a 
 list) to the view and I have a link that is built using those 
 variables.Below is the controller function:

 def indexResumo():
 meses = 
 {'Janeiro':1,'Fevereiro':2,'Março':3,'Abril':4,'Maio':5,'Junho':6,'Julho':7,'Agosto':8,'Setembro':9,'Outubro':10,'Novembro':11,'Dezembro':12}
 newlist=[]
 year =request.now.year
 name = session.auth.user.first_name + ' ' + session.auth.user.last_name
 month = (list(meses.keys())[list(meses.values()).index(request.now.month 
 - 1)])
 query = (db.auth_user.Supervisor == session.auth.user.id)
 colaboradores = 
 db(query).select(db.auth_user.first_name,db.auth_user.last_name)
 for x in colaboradores:
 newlist.append(x.first_name + ' ' + x.last_name)

 return locals()


 And here is part of the view indexResumo that matters:

 a 
 href={{=URL('default','resumoMensalTMN',vars={'nome':name,'mes':month,'ano':year,'colaboradores':newlist})}}

 a 
 href={{=URL('default','resumoMensalLocal',vars={'nome':name,'mes':month,'ano':year,'colaboradores':newlist})}}


 When the above link loads, I have a javascript function that reads each of 
 the variables passed:

 getUrlVars()[name_of_the_var];


 My question is,what would be better: reading the variables this way, or 
 move the code in the function indexResumo to both functions 
 resumoMensalTMN and resumoMensalLocal,have no variables sent in the 
 url, and read those via json on my view? I hope I made any sense here.


-- 
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: Where to call python code for processing (embedded as JS or in controllers)?

2015-07-07 Thread Michael Beller
Why do you want to prevent the server from doing the python processing?

I don't know what you mean by instead of embedding as JS

On Tuesday, July 7, 2015 at 5:40:39 PM UTC-4, Phillip wrote:

 I am having trouble finding anything definitive here. Please help if you 
 have any input, even if short.


 My goal is to prevent the server from doing the python processing. 


 Is this incorrect?: 

 If running the python in the controller function (instead of embedding as 
 JS), the server will do the processing


 Since python functions need to be used in the view for client processing, 
 is there an elegant way to call the python methods in the page? Could you 
 give me an example of a good way to do this with a large script? i.e. 
 returning methods or scripts from the controller, using AJax, etc.

  Am I on the right track?


 Thanks,


 Phillip K


-- 
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: allow multiple extensions on upload

2015-07-07 Thread Leonardo Pires Felix
The validator IS_UPLOAD_FILENAME does what you want. Just add the regex 
that check if the extension is the one you want.

requires = IS_UPLOAD_FILENAME(filename='^README$', extension='^(py|java|c)$', 
case=0)



Em terça-feira, 7 de julho de 2015 18:40:55 UTC-3, reddyreddy escreveu:

 Hello,

 I want to allow upload field to be as .c or .java or .py.
 I have seen the book that there is a way for uploading images with 
 different extensions.
 Can anyone please let me know how to do it for files.

 Thanks in advance.


-- 
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: Invalid literal for init with base 64

2015-07-07 Thread Dave S


On Tuesday, July 7, 2015 at 2:40:55 PM UTC-7, Alessio Varalta wrote:

 Hi, thank for your reply this is my table and the filed date are the problem

 db.define_table('esercizio',
 Field 
 http://127.0.0.1:8000/examples/global/vars/Field('partenza',type='date',requires=IS_NOT_EMPTY
  http://127.0.0.1:8000/examples/global/vars/IS_NOT_EMPTY()),
 Field 
 http://127.0.0.1:8000/examples/global/vars/Field('finale',type='date',requires=IS_NOT_EMPTY
  http://127.0.0.1:8000/examples/global/vars/IS_NOT_EMPTY()),
 Field 
 http://127.0.0.1:8000/examples/global/vars/Field('inviato',type='boolean',requires=IS_NOT_EMPTY
  http://127.0.0.1:8000/examples/global/vars/IS_NOT_EMPTY()),
 Field 
 http://127.0.0.1:8000/examples/global/vars/Field('user_id','reference 
 auth_user'),
 )



AIUI, you are overriding the default validator which would be IS_DATE().  I 
think you may want something like this,
gleaned from another post:

Field(..., requires=[IS_DATE(), IS_NOT_EMPTY()])

 (the post I cribbed that from had a format inside the IS_DATE:  format=(
'%d-%m-%Y'), but that's not the main point)

/dps

 


 On Monday, July 6, 2015 at 5:22:21 PM UTC+2, Alessio Varalta wrote:

 Hi, i use a sqlite database and i use SQLFORM for save my dateThe 
 problem is that have a table with two Field that have date type and when i 
 use SQLFORM and save this date, I have a error when i try to retrieve the 
 date and i have a error when i use appadmin for see my database and the 
 error is:

 Invalid literal for init with base 64



-- 
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: Display SQLFORM.Grid inside view of another SQLFORM.grid.

2015-07-07 Thread 黄祥
had you try to give a name for each SQLFORM.grid(formname = 'form1') and 
SQLFORM.grid(formname = 'form2')

best regards,
stifan

-- 
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: questions about autocomplete widget

2015-07-07 Thread 黄祥
it seems autocomplete have a logic from first word that store in the field 
table
e.g.
db.sale_order.customer.widget = SQLFORM.widgets.autocomplete(
request, db,customer.address, id_field = db.customer.id, 
 limitby = (0, 
10), min_length = 2)

i have customer A with address : Address 1
i have customer B with address : Address 2

when i type '1' it didn't shown anything.

any idea or suggestion?

thanks and best regards,
stifan

On Friday, June 19, 2015 at 6:40:27 AM UTC+7, 黄祥 wrote:

 hi,

 i have several questions about autocomplete widget
 *code*
 db.define_table('customer', 
 Field('first_name'), 
 Field('last_name'), 
 Field('address', 'text'), 
 Field('phone', 'list:string'), 
 format = lambda r: '%s  %s' % (r.first_name, r.last_name) )
 
 is it possible to have autocomplete widget that refer to multiple fields 
 on another table?
 e.g. tested not work (no error occured but the result is not shown)
 db.sale_order.customer.widget = SQLFORM.widgets.autocomplete(request, 
 db.customer.first_name | db,customer.address, 
  id_field = 
 db.customer.id, 
  limitby = (0, 
 10), min_length = 2)

 is it possible to have autocomplete widget that refer to another table 
 that have field type as list:string or list:reference?
 e.g. tested not work (no error occured but the result is not shown)
 db.sale_order.customer.widget = SQLFORM.widgets.autocomplete(request, 
 db.customer.phone, id_field = db.customer.id, 
  limitby = (0, 
 10), min_length = 2)

 how to make autocomplete smarter?
 e.g. 
 db.sale_order.customer.widget = SQLFORM.widgets.autocomplete(request, 
 db,customer.address, id_field = db.customer.id, 
  limitby = (0, 
 10), min_length = 2)

 i have customer A with address : Address 1
 i have customer B with address : Address 2

 then when i type the customer in sale order 'add' it shown address 1 and 
 address 2 (as expected), 
 but when i add another wrong letter 'adds', the list is still same (not 
 expected), 
 what i expected is when user type another wrong letter 'adds', the list of 
 ['address 1', 'address 2'] is disapear.

 any idea?

 thanks and best regards,
 stifan


-- 
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: Display SQLFORM.Grid inside view of another SQLFORM.grid.

2015-07-07 Thread Prasad Muley
Hi stifan,

I've tried to give a different name for each SQLFORM.grid But it didn't 
work.


On Tuesday, July 7, 2015 at 5:56:18 PM UTC+5:30, 黄祥 wrote:

 had you try to give a name for each SQLFORM.grid(formname = 'form1') and 
 SQLFORM.grid(formname = 'form2')

 best regards,
 stifan


-- 
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: get fullpath of uploaded files

2015-07-07 Thread Anthony
os.path.join(request.folder, 'static', 'temp', filename)

On Tuesday, July 7, 2015 at 5:40:39 PM UTC-4, reddyreddy wrote:

 Hello all,

 I want to get the full path of the files that were uploaded.
 Iam giving the uploaded folder as 'static/temp'  in db.py.

 Thankyou in advance.






-- 
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: Where to call python code for processing (embedded as JS or in controllers)?

2015-07-07 Thread Anthony
Any Python in your app, whether in a controller or view, will be executed 
on the server, as the browser cannot execute Python. If you want things to 
happen dynamically on the page in the browser without loading a new page, 
then you can use Javascript or make Ajax calls to get new HTML content from 
the server.

Anthony

On Tuesday, July 7, 2015 at 5:40:39 PM UTC-4, Phillip wrote:

 I am having trouble finding anything definitive here. Please help if you 
 have any input, even if short.


 My goal is to prevent the server from doing the python processing. 


 Is this incorrect?: 

 If running the python in the controller function (instead of embedding as 
 JS), the server will do the processing


 Since python functions need to be used in the view for client processing, 
 is there an elegant way to call the python methods in the page? Could you 
 give me an example of a good way to do this with a large script? i.e. 
 returning methods or scripts from the controller, using AJax, etc.

  Am I on the right track?


 Thanks,


 Phillip K


-- 
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: Display SQLFORM.Grid inside view of another SQLFORM.grid.

2015-07-07 Thread Anthony
The problem is that both grids then need to share the URL args. You can 
probably manage that by using the args argument to tell the second grid 
to ignore the first few URL args (which are used by the first grid), but 
life might be easier if you just put the second grid inside an Ajax 
component.

Anthony

On Tuesday, July 7, 2015 at 8:34:52 AM UTC-4, Prasad Muley wrote:

 Hi stifan,

 I've tried to give a different name for each SQLFORM.grid But it 
 didn't work.


 On Tuesday, July 7, 2015 at 5:56:18 PM UTC+5:30, 黄祥 wrote:

 had you try to give a name for each SQLFORM.grid(formname = 'form1') and 
 SQLFORM.grid(formname = 'form2')

 best regards,
 stifan



-- 
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: Display SQLFORM.Grid inside view of another SQLFORM.grid.

2015-07-07 Thread Anthony
Also, you cannot call form.process() on a grid form, as the initial call to 
.grid() already does the processing (so you are attempting to process it a 
second time, which will fail).

On Tuesday, July 7, 2015 at 10:07:44 AM UTC-4, Anthony wrote:

 The problem is that both grids then need to share the URL args. You can 
 probably manage that by using the args argument to tell the second grid 
 to ignore the first few URL args (which are used by the first grid), but 
 life might be easier if you just put the second grid inside an Ajax 
 component.

 Anthony

 On Tuesday, July 7, 2015 at 8:34:52 AM UTC-4, Prasad Muley wrote:

 Hi stifan,

 I've tried to give a different name for each SQLFORM.grid But it 
 didn't work.


 On Tuesday, July 7, 2015 at 5:56:18 PM UTC+5:30, 黄祥 wrote:

 had you try to give a name for each SQLFORM.grid(formname = 'form1') and 
 SQLFORM.grid(formname = 'form2')

 best regards,
 stifan



-- 
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] Display SQLFORM.Grid inside view of another SQLFORM.grid.

2015-07-07 Thread Massimiliano
Hi,

take a look to the manual:

http://www.web2py.com/books/default/chapter/29/07/forms-and-validators#SQLFORM-grid
Multiple grids per controller function

Because of the way grid works one can only have one grid per controller
function, unless they are embedded as components via LOAD. To make the
default search grid work in more than one LOADed grid, please use a
different formname for each one.


On Tue, Jul 7, 2015 at 10:59 AM, Prasad Muley pmmu...@gmail.com wrote:

 Hi,

   I have a SQLFORM.grid which displays information about employee
 table. Every employee may have multiple addresses.
 So I have to display multiple address in another grid (address grid)
 inside edit form of the employee grid.


 *models/db.py*

 db.define_table('employee',
 Field('fname', 'string', label=T(First Name),
 required=True),
 Field('lname', 'string', label=T(Last Name),
 required=True),
 Field('email', requires=IS_EMAIL()),
 format='%(email)s')

 db.define_table('address',
 Field('employee', db.employee),
 Field('Address', 'text'))

 *controllers/default.py*

 def _validate_emp_records(form):
 error_exist = False
 if not form.vars.fname:
 form.errors.fname = T(Enter First Name)
 error_exist = True

 if not form.vars.lname:
 form.errors.lname = T('Enter last name')
 error_exist = True

 return not error_exist


 @auth.requires_login()
 def index():
 
 example action using the internationalization operator T and flash
 rendered by views/default/index.html or views/generic.html

 if you need a simple wiki simply replace the two lines below with:
 return auth.wiki()
 
 query = (db.employee.id  0)
 emp_grid = SQLFORM.grid(query, showbuttontext=False, csv=False,
 deletable=False)
 address_grid = None

 if request.args(0) == 'edit':
 form = emp_grid.update_form
 emp_id = request.args(2)
 address_query = (db.address.employee == emp_id)
 # show all address in edit form of employee
 address_grid = SQLFORM.grid(address_query, deletable=False,
 showbuttontext=False, csv=False)

 if form.process(onvalidation=_validate_emp_records).accepted:
 session.flash = T('Updated %s' % form.vars.id)
 redirect(URL('default', 'index'))
 elif form.errors:
 response.flash = T(form has errors)

 if request.args(0) == 'view':
 form = emp_grid.view_form

 if request.args(0) == 'new':
 form = emp_grid.create_form

 return dict(emp_grid=emp_grid, address_grid=address_grid)


 *views/default/index.html*


 {{extend 'layout.html'}}

 {{=emp_grid}}

 {{ if address_grid: }}
  {{ =address_grid}}
 {{ pass }}


 Here,
  It shows two edit forms whenever I click on edit icon. [See
 attachment edit_records.png]

 Is it possible to display SQLFORM.grid inside view of another SQLFORM.grid?


  --
 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.




-- 
Massimiliano

-- 
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] DAL min on 2 date columns

2015-07-07 Thread lyn2py
Hi,

If I have 2 columns, date_created, date_updated

db.define_table('table', 
Field('date_created', 'datetime',default=request.now),
Field('date_updated', 'datetime',update=request.now),
)

and I want to do a DAL query to get the datetime that is the furthest from 
now (i.e. the db entry is the oldest) on both the date_created and 
date_updated. I know how to do it if it's just one column, but how should I 
do this if two columns are involved?


-- 
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] @cache lose response

2015-07-07 Thread Dmitry Ermolaev
if
@cache.action(time_expire=exp_time, cache_model=cache.disk, vars=False, 
public=False, lang=True)
def contacts():
response.title=T('Контакты')
response.not_show_func = True
h = CAT(
H3(T('Отзывы, Обсуждение, Жалобы, Благодарности')),
T('Можно найти в ветке на'),' ',
A(T('международном форуме о криптовалютах'),
  _href='https://bitcointalk.org/index.php?topic=307648.0', 
_target='_blank'),'. ',
T('Там же можно сообщить об ошибке'),'.',
H3('Обратная связь'),
T('Почтовый ящик'),': ', 'supp...@7pay.in',BR(),
T('Skype'),': ', 'i-creator'
)
return dict(h =h)


If 1-st call - al ok!
then - view run as response.title and response not_show_func is null
view is generic:
{{extend 'layout.html'}}

{{if not response.not_show_func:}}
h2{{=' '.join(x.capitalize() for x in request.function.split('_'))}}/h2
{{pass}}
{{if len(response._vars)==1:}}
{{=BEAUTIFY(response._vars.values()[0])}}
{{elif len(response._vars)1:}}
{{=BEAUTIFY(response._vars)}}
{{pass}}
{{if request.is_local:}}
{{=response.toolbar()}}
{{pass}}



-- 
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: Web2py application running very slow on rocket server in production mode

2015-07-07 Thread Ramashish Gaurav
Hello Richard,

I appreciate your interest in my issue. I tried looking into the script 
folder of web2py, however did not find any stage/production file or 
script. Can you please explain in detail what you are trying to say. 

On Wednesday, July 8, 2015 at 12:37:16 AM UTC+5:30, Richard wrote:

 Rocket is for development... Apache, Nginx IIS (microsoft web server), 
 etc. are production web servers...

 You may have a look in web2py scripts folder there is basic 
 stage/production facilitating script that may help you set up you 
 production environment... Let says at start more a stage environment...

 Richard

 On Tue, Jul 7, 2015 at 3:04 PM, Ramashish Gaurav ramas...@gmail.com 
 javascript: wrote:

 Hello Leonel!

 Thanks for your interest. Can you explain a bit more about IIS and 
 fastcgi How to use it ? Is it an alternative to Apache or Rocket or is 
 it just for running  testing phase of the app? 

 On Tuesday, July 7, 2015 at 10:41:46 PM UTC+5:30, Leonel Câmara wrote:

 Well rocket is slow. Use IIS and fastcgi.

  -- 
 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+un...@googlegroups.com javascript:.
 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.