[web2py] Re: db query

2015-03-09 Thread Garry Smith
Hi Thanks for the reply,

I have got query 2 working with the following:-

qry = request.vars.upn_no
q = (db.pupils.upn_no == qry)
s = db(q) 
row = s.select(db.pupils.upn_no,db.pupils.surname)

which gives me the following.

pupils.upn_no pupils.surname

Dalglish

Once in the view is their a way off changing column headings and just 
showing what you want from the db.






On Monday, 9 March 2015 13:48:17 UTC, Jim S wrote:

 thelist=[row.first_name for row in db(db.user.upn == 444).select()]

 Have you read chapter 6 from the book?  It is well worth your time and 
 should help with most of your questions.  
 http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer

 -Jim






 On Monday, March 9, 2015 at 8:31:13 AM UTC-5, Garry Smith wrote:

 I'm new to web2py, but do have a php and mysql background using 
 codeigniter.
 I'm trying to write a couple of queries but sure how to do them.
 These are the queries I'm trying to write,

 query1

 SELECT user.s_name, user.f_name, user.year, pe.date, pe.sport, pe.id
 FROM user
 INNER JOIN pe
 ON user.user_id=pe.user_id
 WHERE pe.date = DATE(NOW())
 ORDER BY user.year

 query 2

 SELECT user.upn, user.f_name, user.s_name where user.upn = ''

  I tried this on the second query,
 thelist=[row.first_name for row in db().select(db.pupils.first_name, 
 db.pupils.upn')]

 which pulls all records, need to know where to put   where upn = ''

 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: DAL negate a query - error

2015-03-09 Thread Niphlod
for the same exact reason. 

NOT field = True 

in t-sql means just FALSE, not FALSE and NULL

On Monday, March 9, 2015 at 2:37:46 PM UTC+1, Dmitry Ermolaev wrote:

 I use negate -  why this not worked?

 воскресенье, 8 марта 2015 г., 23:15:49 UTC+3 пользователь Niphlod написал:

 booleans in T-SQL are not treated the same way as python. in T-SQL, 
 NULL values are neither True or False, they are just NULL.

 So, if you want closed either None or False, you should do

 ((db.progs.closed == None) | (db.progs.closed == False))

 one shortcut to it would be

 db.progs.closed.belongs((None, False))

 that'll turn this syntax to the previous one, effectively selecing both 
 None and False values.

 On Sunday, March 8, 2015 at 7:23:54 PM UTC+1, Dmitry Ermolaev wrote:

 db((db.progs.promo==True)  (db.progs.closed!=True)).select():
 or
 db((db.progs.promo==True)  ~(db.progs.closed==True)).select():


 not worked ((
 if exist record wirh promo=True and closed=None or False - it not 
 selected!



-- 
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] Dilemma: how to store reports

2015-03-09 Thread Najtsirk
Dear Web2pyers,

I have dilemma not connected directly to Web2py. I am running / developing 
a web application where different projects seek impact investments and 
donations. Each project is obliged to submit a report by the end of the 
year. 

For the first two years we accepted written reports  in word documents. 
From this year on we contemplate of e-reporting. So here we face dilemma. I 
have in mind two ways of doing that:

 - define databse schema with all the necessary fields. The problem is what 
if we decide to change schema next year.

 - write report as a xml structured document in our database. 

Which way is better in your opinion?

Best
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: db query

2015-03-09 Thread Jim S
thelist=[row.first_name for row in db(db.user.upn == 444).select()]

Have you read chapter 6 from the book?  It is well worth your time and 
should help with most of your questions. 
 http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer

-Jim






On Monday, March 9, 2015 at 8:31:13 AM UTC-5, Garry Smith wrote:

 I'm new to web2py, but do have a php and mysql background using 
 codeigniter.
 I'm trying to write a couple of queries but sure how to do them.
 These are the queries I'm trying to write,

 query1

 SELECT user.s_name, user.f_name, user.year, pe.date, pe.sport, pe.id
 FROM user
 INNER JOIN pe
 ON user.user_id=pe.user_id
 WHERE pe.date = DATE(NOW())
 ORDER BY user.year

 query 2

 SELECT user.upn, user.f_name, user.s_name where user.upn = ''

  I tried this on the second query,
 thelist=[row.first_name for row in db().select(db.pupils.first_name, 
 db.pupils.upn')]

 which pulls all records, need to know where to put   where upn = ''

 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] db query

2015-03-09 Thread Garry Smith
I'm new to web2py, but do have a php and mysql background using codeigniter.
I'm trying to write a couple of queries but sure how to do them.
These are the queries I'm trying to write,

query1

SELECT user.s_name, user.f_name, user.year, pe.date, pe.sport, pe.id
FROM user
INNER JOIN pe
ON user.user_id=pe.user_id
WHERE pe.date = DATE(NOW())
ORDER BY user.year

query 2

SELECT user.upn, user.f_name, user.s_name where user.upn = ''

 I tried this on the second query,
thelist=[row.first_name for row in db().select(db.pupils.first_name, 
db.pupils.upn')]

which pulls all records, need to know where to put   where upn = ''

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: storing more than 1 millions uploaded files

2015-03-09 Thread Yang
Dear All,

I am facing the same problem for storing a large number of data files.
My database backend is PostgreSQL. And I am using the default fs with 
separated folder selected. 
I would like to know if there is other choices of file system recommended 
for my case, besides buying Amazon S3 service? 

It seems that using the default fs I have to write my own script for fs 
level backup? and the subfolder number limitation would be an issue in 
future? am I right?

Thank you 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: Dilemma: how to store reports

2015-03-09 Thread Willoughby
If you just need to store the reports, then just use XML blobs.

If you need to do math on data within the reports (i.e. analytics across 
projects) then break it into a schema.

On Monday, March 9, 2015 at 9:48:23 AM UTC-4, Najtsirk wrote:

 Dear Web2pyers,

 I have dilemma not connected directly to Web2py. I am running / developing 
 a web application where different projects seek impact investments and 
 donations. Each project is obliged to submit a report by the end of the 
 year. 

 For the first two years we accepted written reports  in word documents. 
 From this year on we contemplate of e-reporting. So here we face dilemma. I 
 have in mind two ways of doing that:

  - define databse schema with all the necessary fields. The problem is 
 what if we decide to change schema next year.

  - write report as a xml structured document in our database. 

 Which way is better in your opinion?

 Best
 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: DAL negate a query - error

2015-03-09 Thread Dmitry Ermolaev
I use negate -  why this not worked?

воскресенье, 8 марта 2015 г., 23:15:49 UTC+3 пользователь Niphlod написал:

 booleans in T-SQL are not treated the same way as python. in T-SQL, 
 NULL values are neither True or False, they are just NULL.

 So, if you want closed either None or False, you should do

 ((db.progs.closed == None) | (db.progs.closed == False))

 one shortcut to it would be

 db.progs.closed.belongs((None, False))

 that'll turn this syntax to the previous one, effectively selecing both 
 None and False values.

 On Sunday, March 8, 2015 at 7:23:54 PM UTC+1, Dmitry Ermolaev wrote:

 db((db.progs.promo==True)  (db.progs.closed!=True)).select():
 or
 db((db.progs.promo==True)  ~(db.progs.closed==True)).select():


 not worked ((
 if exist record wirh promo=True and closed=None or False - it not 
 selected!



-- 
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] Bunch/Batch/Bulk insert Re-use db.define_table field definition in SQLFORM.factory() ?

2015-03-09 Thread Richard Vézina
This should do what you want :
https://groups.google.com/d/msg/web2py/oiyOIC0IH04/6-NvVOJECU8J

I remember having post this solution somewhere else (other thread) and
other web2py users had posting many other solution but can find it back...
You have at least this solution that work very well and is completly web2py
base (server side) and not imply ajax calback or ajax insertion (with the
validation that it requires beyound the scene).

Other references :

https://groups.google.com/d/msg/web2py-developers/thQiiC3-2LQ/s8AiuSpUmh0J

Richard

On Mon, Mar 9, 2015 at 5:48 AM, Ramkrishan Bhatt ramkrishan.bh...@gmail.com
 wrote:

 Hi All,
   My question is about expanding form on dynamically for example.
 we have two tables. company and address
 now did SQLFORM.factory(db.company,db.address)

 Now requirement is says that where company can have multiple address so i
 need a button for add more address. On click we need to append form.

 Can anybody provide the specific solutions.

 On Monday, 17 February 2014 20:43:00 UTC+5:30, Richard wrote:

 That an option... The other option is to wrap IS_IN_DB() into
 IS_EMPTY_OR()... But it is not garanti that the concerning field will be
 filled...

 Richard


 On Sat, Feb 15, 2014 at 3:48 PM, ksotiris sotiris...@gmail.com wrote:

 Hello web2py-users,  I am new to web2py framework. I have a question
 about the followings:


 @Steve it exactly what I have in mind, except in my case the form has
 to be generic for many differents tables, but if you only one table to
 bunch insert, that way it works fine...

 Notice, if you create more inputs then the number your users will need
 (not 3 records for instance) you get in trouble if you have not null
 requires or IS_IN_DB or other validators)... So I use an other form to
 catch the number of input the user is needing and I pass it buy the URL as
 a vars something like that :

 URL(c='controller', f='bunch_func', vars=dict(nb_inputs=3))

 Then I use it in range function :

 for i in range(0, int(request.vars.nb_inputs))


 Is there another more easy way to do this ?

 For example why not to have an option before validate the posted data to
 delete emtpy row - fields of the form and post only row - fields with no
 empty values ???
 I have already try a lot of things but nothing is working.
 The batch input form is usefull and i think must be an easy way for this.
 The above is working but is not so practical for the end user of the
 batch input form.


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


  --
 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: db query

2015-03-09 Thread Garry Smith
Hi

My view is basic at the moment just showing the column headings and results 
from db.

{{extend 'layout.html'}}
h1Results/h1

{{=row}}

The headings show :-   pupil.upn_no and pupils.surname with the results 
underneath.
what I would like to do is put the results in my own table.

coming from php I would do

? foreach ($results as $peak) : ?
div (?=$peak-peak_id?)?=$peak-peak_area?/div
? endforeach; ?

I have tried:_-
{extend 'layout.html'}}
h1Results/h1

{{for r in row:}}
pr.pupils.upn_nop

{{pass}}

,but get no data back.

thanks again.






On Monday, 9 March 2015 14:32:37 UTC, Jim S wrote:

 What does your view look like?

 Also, this chapter should be helpful:  
 http://web2py.com/books/default/chapter/29/05/the-views

 -Jim

 On Monday, March 9, 2015 at 8:56:38 AM UTC-5, Garry Smith wrote:

 Hi Thanks for the reply,

 I have got query 2 working with the following:-

 qry = request.vars.upn_no
 q = (db.pupils.upn_no == qry)
 s = db(q) 
 row = s.select(db.pupils.upn_no,db.pupils.surname)

 which gives me the following.

 pupils.upn_no pupils.surname

 Dalglish

 Once in the view is their a way off changing column headings and just 
 showing what you want from the db.






 On Monday, 9 March 2015 13:48:17 UTC, Jim S wrote:

 thelist=[row.first_name for row in db(db.user.upn == 444).select()]

 Have you read chapter 6 from the book?  It is well worth your time and 
 should help with most of your questions.  
 http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer

 -Jim






 On Monday, March 9, 2015 at 8:31:13 AM UTC-5, Garry Smith wrote:

 I'm new to web2py, but do have a php and mysql background using 
 codeigniter.
 I'm trying to write a couple of queries but sure how to do them.
 These are the queries I'm trying to write,

 query1

 SELECT user.s_name, user.f_name, user.year, pe.date, pe.sport, pe.id
 FROM user
 INNER JOIN pe
 ON user.user_id=pe.user_id
 WHERE pe.date = DATE(NOW())
 ORDER BY user.year

 query 2

 SELECT user.upn, user.f_name, user.s_name where user.upn = ''

  I tried this on the second query,
 thelist=[row.first_name for row in db().select(db.pupils.first_name, 
 db.pupils.upn')]

 which pulls all records, need to know where to put   where upn = 
 ''

 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: db query

2015-03-09 Thread Jim S
What does your view look like?

Also, this chapter should be helpful: 
 http://web2py.com/books/default/chapter/29/05/the-views

-Jim

On Monday, March 9, 2015 at 8:56:38 AM UTC-5, Garry Smith wrote:

 Hi Thanks for the reply,

 I have got query 2 working with the following:-

 qry = request.vars.upn_no
 q = (db.pupils.upn_no == qry)
 s = db(q) 
 row = s.select(db.pupils.upn_no,db.pupils.surname)

 which gives me the following.

 pupils.upn_no pupils.surname

 Dalglish

 Once in the view is their a way off changing column headings and just 
 showing what you want from the db.






 On Monday, 9 March 2015 13:48:17 UTC, Jim S wrote:

 thelist=[row.first_name for row in db(db.user.upn == 444).select()]

 Have you read chapter 6 from the book?  It is well worth your time and 
 should help with most of your questions.  
 http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer

 -Jim






 On Monday, March 9, 2015 at 8:31:13 AM UTC-5, Garry Smith wrote:

 I'm new to web2py, but do have a php and mysql background using 
 codeigniter.
 I'm trying to write a couple of queries but sure how to do them.
 These are the queries I'm trying to write,

 query1

 SELECT user.s_name, user.f_name, user.year, pe.date, pe.sport, pe.id
 FROM user
 INNER JOIN pe
 ON user.user_id=pe.user_id
 WHERE pe.date = DATE(NOW())
 ORDER BY user.year

 query 2

 SELECT user.upn, user.f_name, user.s_name where user.upn = ''

  I tried this on the second query,
 thelist=[row.first_name for row in db().select(db.pupils.first_name, 
 db.pupils.upn')]

 which pulls all records, need to know where to put   where upn = ''

 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] {{=LOAD()}} problem with views

2015-03-09 Thread Richard Vézina
Hello Annet,

I have hard time follow... It could be easier I think if you just pasting
the view with the LOAD() that don't work and both controller the main page
and the loaded page...

Thanks

Richard

On Mon, Mar 9, 2015 at 5:45 AM, Annet anneve...@googlemail.com wrote:


 I have the following page/index.html view:

 {{extend 'scaffolding/outer_layout.html'}}

 div class=main
   {{include 'page/ad.html'}}
   {{if groupcomponent:}}
   section class=main-group
 div class=container
   div id=group-component
 {{include 'page/group.html'}}
   /div !-- /#group-component --
 /div !-- /.container --
   /section !-- /.main-group --
   {{pass}}
   section class=main-content
   {{include 'buildingblocks/address_element.html'}}
 /div !-- /.container --
   /section !-- /.main-content--
 /div !-- /.main --


 This works. Now, I'd like page/group to be a separate function and load it
 using ajax.
 I replaced {{include 'page/group.html'}} with:

 {{=LOAD('page', 'group', args=nodeID, ajax=True, target='group-component',
 content='')}}

 and renamed 'page/group.html' 'page/group.load'


 The function simply returns group:

 def group():
 session.forget(response)

 nodeID = request.args(0, cast=int)

 response.view = 'page/group.load'

 group = db((db.grp_group.nodeID==nodeID) 
 (db.grp_group.orderBy==0)).select(db.grp_group.ALL, limitby=(0,1),

 orderby_on_limitby=False).first()

 return locals()


 The problem is that this loads the entire page/index.html view where I
 want it to load page/group.load, the latter
 is completely ignored. What am I doing wrong?


 Kind regards,

 Annet

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


Re: [web2py] Re: IMPORTANT - DROPPING SUPPORT FOR PYTHON 2.5?

2015-03-09 Thread Phyo Arkar
Me and my team is fine since we are always on the edge :) .

But i would like to see input from old wizards that uses Old RedHat
for servers and Debian 4.x .



On Sun, Mar 8, 2015 at 10:04 AM, Ron Chatterjee
achatterjee...@gmail.com wrote:
 I use 2.7.6 from canopy.  I will b okay.I think...

 --
 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: db query

2015-03-09 Thread Garry Smith
Hi again after reading chapter 6,

I have found what I'm looking for.
I did the following and got thre results I wanted.

{{for r in row:}}
p{{=r.surname}}p

{{pass}}

One other question I would like to ask.

web2py works a lot like codeigniter for php using MVC, does web2py let you 
use jquery to send  data using  json ajax back to the controllers.

For example using:div 
id='tracks_selected'onclick='getTracks($album-track_id)  in the view.

Then use the following jquery


function getTracks(id) {
$.post(/media/getTracks, { id:id },
function(data){
$('#tracks').html(data);
});
}-

Which would go the a controller /media/tracks with the id number to be 
processes in the controller?



On Monday, 9 March 2015 13:56:38 UTC, Garry Smith wrote:

 Hi Thanks for the reply,

 I have got query 2 working with the following:-

 qry = request.vars.upn_no
 q = (db.pupils.upn_no == qry)
 s = db(q) 
 row = s.select(db.pupils.upn_no,db.pupils.surname)

 which gives me the following.

 pupils.upn_no pupils.surname

 Dalglish

 Once in the view is their a way off changing column headings and just 
 showing what you want from the db.






 On Monday, 9 March 2015 13:48:17 UTC, Jim S wrote:

 thelist=[row.first_name for row in db(db.user.upn == 444).select()]

 Have you read chapter 6 from the book?  It is well worth your time and 
 should help with most of your questions.  
 http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer

 -Jim






 On Monday, March 9, 2015 at 8:31:13 AM UTC-5, Garry Smith wrote:

 I'm new to web2py, but do have a php and mysql background using 
 codeigniter.
 I'm trying to write a couple of queries but sure how to do them.
 These are the queries I'm trying to write,

 query1

 SELECT user.s_name, user.f_name, user.year, pe.date, pe.sport, pe.id
 FROM user
 INNER JOIN pe
 ON user.user_id=pe.user_id
 WHERE pe.date = DATE(NOW())
 ORDER BY user.year

 query 2

 SELECT user.upn, user.f_name, user.s_name where user.upn = ''

  I tried this on the second query,
 thelist=[row.first_name for row in db().select(db.pupils.first_name, 
 db.pupils.upn')]

 which pulls all records, need to know where to put   where upn = ''

 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] Global search form example

2015-03-09 Thread Gael Princivalle
Hello all.

I would like to add a global search form in a website, the classical one 
with one field and a search button.
I've got some idea's about how doing it, but I would like to know if 
there's an example on line, or if someone have some suggestions.

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: db query

2015-03-09 Thread Dave S


On Monday, March 9, 2015 at 9:53:42 AM UTC-7, Ron Chatterjee wrote:

 you need to do 


 {{response.files.append(URL('static','js/java_script_file_I_am_runnning.js))}}

 in web2py before ajax call layout.html

 and then use 

 script

 your function

 /script

 Correct me if I am wrong. Someone?


That step is either unnecessary or already done for you, because I didn't 
have to do it. 


DIV id=my_hats
{{=LOAD(c='t_hats', f='t_hats2.load', target='my_hats', ajax=True)}}
span id=jsoffsJavascript off?  a href=t_hats2.html id=jsoffaClick 
here/a/span
/DIV

(If javascript is enabled, I set the span's visibility to 'hidden')

JQuery is covered in Chapter 11
URL:http://www.web2py.com/books/default/chapter/29/11/jquery-and-ajax
and LOAD() is covered in Chapter 12
URL:http://www.web2py.com/books/default/chapter/29/12/
components-and-plugins#LOAD


It's easy enough to use, even I figured it out  :-)

Here's an example where I arm a button:

 dis_str = CAT(dis_str,
TT(),
INPUT(_name=derby, _type=hidden, value=index),
TAG.BUTTON('derby promotion t=%s' % index,
   _type=button, _name=proms%d % (index),
   _value=addy,
   _onclick='ajax(promotes.load, [addy,hname, 
derby], my_promotions)',
   _style=visibility:collapse, _id=promst%d % 
(index)),
BR())

and eventually dis_str gets sent to the client to display.

/dps




 On Monday, March 9, 2015 at 12:12:47 PM UTC-4, Garry Smith wrote:

 Hi again after reading chapter 6,

 I have found what I'm looking for.
 I did the following and got thre results I wanted.

 {{for r in row:}}
 p{{=r.surname}}p

 {{pass}}

 One other question I would like to ask.

 web2py works a lot like codeigniter for php using MVC, does web2py let 
 you use jquery to send  data using  json ajax back to the controllers.

 For example using:div 
 id='tracks_selected'onclick='getTracks($album-track_id)  in the view.

 Then use the following jquery


 function getTracks(id) {
 $.post(/media/getTracks, { id:id },
 function(data){
 $('#tracks').html(data);
 });
 }-

 Which would go the a controller /media/tracks with the id number to be 
 processes in the controller?

 

 On Monday, 9 March 2015 13:56:38 UTC, Garry Smith wrote:

 Hi Thanks for the reply,

 I have got query 2 working with the following:-

 qry = request.vars.upn_no
 q = (db.pupils.upn_no == qry)
 s = db(q) 
 row = s.select(db.pupils.upn_no,db.pupils.surname)

 which gives me the following.

 pupils.upn_no pupils.surname

 Dalglish

 Once in the view is their a way off changing column headings and just 
 showing what you want from the db.






 On Monday, 9 March 2015 13:48:17 UTC, Jim S wrote:

 thelist=[row.first_name for row in db(db.user.upn == 444).select()]

 Have you read chapter 6 from the book?  It is well worth your time and 
 should help with most of your questions.  
 http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer

 -Jim






 On Monday, March 9, 2015 at 8:31:13 AM UTC-5, Garry Smith wrote:

 I'm new to web2py, but do have a php and mysql background using 
 codeigniter.
 I'm trying to write a couple of queries but sure how to do them.
 These are the queries I'm trying to write,

 query1

 SELECT user.s_name, user.f_name, user.year, pe.date, pe.sport, pe.id
 FROM user
 INNER JOIN pe
 ON user.user_id=pe.user_id
 WHERE pe.date = DATE(NOW())
 ORDER BY user.year

 query 2

 SELECT user.upn, user.f_name, user.s_name where user.upn = ''

  I tried this on the second query,
 thelist=[row.first_name for row in db().select(db.pupils.first_name, 
 db.pupils.upn')]

 which pulls all records, need to know where to put   where upn = 
 ''

 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: list reference with ondelete=set null breaking when delete parent

2015-03-09 Thread Ron Chatterjee
Wonder if he can try to make it a list and do list.remove?

Have you tried that?

On Thursday, March 20, 2014 at 3:07:47 PM UTC-4, Leonel Câmara wrote:

 I think you should have a third table anyway or searches for T-shirts of a 
 given colour will be quite slow.


-- 
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: db query

2015-03-09 Thread Ron Chatterjee
you need to do 

{{response.files.append(URL('static','js/java_script_file_I_am_runnning.js))}}

in web2py before ajax call layout.html

and then use 

script

your function

/script

Correct me if I am wrong. Someone?

On Monday, March 9, 2015 at 12:12:47 PM UTC-4, Garry Smith wrote:

 Hi again after reading chapter 6,

 I have found what I'm looking for.
 I did the following and got thre results I wanted.

 {{for r in row:}}
 p{{=r.surname}}p

 {{pass}}

 One other question I would like to ask.

 web2py works a lot like codeigniter for php using MVC, does web2py let you 
 use jquery to send  data using  json ajax back to the controllers.

 For example using:div 
 id='tracks_selected'onclick='getTracks($album-track_id)  in the view.

 Then use the following jquery


 function getTracks(id) {
 $.post(/media/getTracks, { id:id },
 function(data){
 $('#tracks').html(data);
 });
 }-

 Which would go the a controller /media/tracks with the id number to be 
 processes in the controller?

 

 On Monday, 9 March 2015 13:56:38 UTC, Garry Smith wrote:

 Hi Thanks for the reply,

 I have got query 2 working with the following:-

 qry = request.vars.upn_no
 q = (db.pupils.upn_no == qry)
 s = db(q) 
 row = s.select(db.pupils.upn_no,db.pupils.surname)

 which gives me the following.

 pupils.upn_no pupils.surname

 Dalglish

 Once in the view is their a way off changing column headings and just 
 showing what you want from the db.






 On Monday, 9 March 2015 13:48:17 UTC, Jim S wrote:

 thelist=[row.first_name for row in db(db.user.upn == 444).select()]

 Have you read chapter 6 from the book?  It is well worth your time and 
 should help with most of your questions.  
 http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer

 -Jim






 On Monday, March 9, 2015 at 8:31:13 AM UTC-5, Garry Smith wrote:

 I'm new to web2py, but do have a php and mysql background using 
 codeigniter.
 I'm trying to write a couple of queries but sure how to do them.
 These are the queries I'm trying to write,

 query1

 SELECT user.s_name, user.f_name, user.year, pe.date, pe.sport, pe.id
 FROM user
 INNER JOIN pe
 ON user.user_id=pe.user_id
 WHERE pe.date = DATE(NOW())
 ORDER BY user.year

 query 2

 SELECT user.upn, user.f_name, user.s_name where user.upn = ''

  I tried this on the second query,
 thelist=[row.first_name for row in db().select(db.pupils.first_name, 
 db.pupils.upn')]

 which pulls all records, need to know where to put   where upn = 
 ''

 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: {{=LOAD()}} problem with views

2015-03-09 Thread JorgeH
Annet
Bear in mind that within .load extension files you dont  write this line

{{extend layout.html}}   REMOVE THIS LINE FROM YOUR .LOAD FILE


try this. good luck.



On Monday, March 9, 2015 at 4:45:39 AM UTC-5, Annet wrote:


 I have the following page/index.html view:

 {{extend 'scaffolding/outer_layout.html'}}

 div class=main
   {{include 'page/ad.html'}}
   {{if groupcomponent:}}
   section class=main-group
 div class=container
   div id=group-component
 {{include 'page/group.html'}}
   /div !-- /#group-component --
 /div !-- /.container --
   /section !-- /.main-group --
   {{pass}}
   section class=main-content
   {{include 'buildingblocks/address_element.html'}}
 /div !-- /.container --
   /section !-- /.main-content--
 /div !-- /.main --


 This works. Now, I'd like page/group to be a separate function and load it 
 using ajax.
 I replaced {{include 'page/group.html'}} with:

 {{=LOAD('page', 'group', args=nodeID, ajax=True, target='group-component', 
 content='')}}

 and renamed 'page/group.html' 'page/group.load'


 The function simply returns group:

 def group():
 session.forget(response)

 nodeID = request.args(0, cast=int)

 response.view = 'page/group.load'

 group = db((db.grp_group.nodeID==nodeID)  
 (db.grp_group.orderBy==0)).select(db.grp_group.ALL, limitby=(0,1),
   
  
 orderby_on_limitby=False).first()

 return locals()


 The problem is that this loads the entire page/index.html view where I 
 want it to load page/group.load, the latter
 is completely ignored. What am I doing wrong?


 Kind regards,

 Annet


-- 
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: list reference with ondelete=set null breaking when delete parent

2015-03-09 Thread Francisco Costa
Hi ANdré, did you find a way to solve this?

On Thursday, 20 March 2014 22:10:33 UTC, André Kablu wrote:

 Yes just migrated to mongodb, and there really exist some issue.

 using CASCADE or SET NULL, it does not matter, web2py does not respect and 
 remove the reference from the referencing collection or delete the 
 reference...




 Em quinta-feira, 20 de março de 2014 16h16min43s UTC-3, André Kablu 
 escreveu:

 I will migrate it later to mongodb, but wanted it to work on sqlite too 
 for dev, and not have to create a lot of validators on each delete or 
 update.

 That`s why I was wondering if web2py can handle this transparently.



 On Thu, Mar 20, 2014 at 4:07 PM, Leonel Câmara leonel...@gmail.com 
 javascript: wrote:

 I think you should have a third table anyway or searches for T-shirts of 
 a given colour will be quite slow.
  
 -- 
 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/0tVp5QVR1-8/unsubscribe.
 To unsubscribe from this group and all its topics, 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.


[web2py] Re: Global search form example

2015-03-09 Thread Gael Princivalle
Sure.

The search field at the top:
http://www.chainreactioncycles.com/us/en


Il giorno lunedì 9 marzo 2015 17:47:09 UTC+1, Ron Chatterjee ha scritto:

 Can you give an example of global Search. Any reference site?

 On Monday, March 9, 2015 at 12:18:54 PM UTC-4, Gael Princivalle wrote:

 Hello all.

 I would like to add a global search form in a website, the classical one 
 with one field and a search button.
 I've got some idea's about how doing it, but I would like to know if 
 there's an example on line, or if someone have some suggestions.

 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: Global search form example

2015-03-09 Thread Ron Chatterjee
Can you give an example of global Search. Any reference site?

On Monday, March 9, 2015 at 12:18:54 PM UTC-4, Gael Princivalle wrote:

 Hello all.

 I would like to add a global search form in a website, the classical one 
 with one field and a search button.
 I've got some idea's about how doing it, but I would like to know if 
 there's an example on line, or if someone have some suggestions.

 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: is it possible to conditionally format grid field based on other field in the row?

2015-03-09 Thread Ron Chatterjee
Have you tried,

lastmodified

?


On Monday, March 9, 2015 at 1:31:04 PM UTC-4, Alex Glaros wrote:

 ahhh... this worked...needed quotes

 db.InternalMessage.subjectLine.represent = lambda value,row: DIV(value, 
 _style='font-size:75%;color:#656555') if 'modified_on' != None else DIV(
 value, _style='font-size:135%;color:#991155')




-- 
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: {{=LOAD()}} problem with views

2015-03-09 Thread Annet
Thank you both for your replies.

I finally found the issue has nothing to do with the controller and views.

I am using a CDN to get jquery, in layout.html I've got:


script src=//code.jquery.com/jquery-1.11.1.min.js/script

 {{include 'web2py_ajax.html'}}


and from web2py_ajax.html I removed the following line.

response.files.insert(0, URL('dbmodel','static','js/jquery.js'))


putting the line back in web2py_ajax.html solves the issue.

I don't understand why I cannot use a CDN, jquery loads before
web2py_ajax.html is being included.


Kind regards,

Annet

-- 
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 it possible to conditionally format grid field based on other field in the row?

2015-03-09 Thread Alex Glaros
ahhh... this worked...needed quotes

db.InternalMessage.subjectLine.represent = lambda value,row: DIV(value, 
_style='font-size:75%;color:#656555') if 'modified_on' != None else DIV(
value, _style='font-size:135%;color:#991155')


-- 
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 it possible to conditionally format grid field based on other field in the row?

2015-03-09 Thread Alex Glaros
wait... did NOT work

can anyone type example of correct syntax or say that the concept doesn't 
exist?

-- 
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: Global search form example

2015-03-09 Thread Ron Chatterjee
SQLFORM.build_query[(db.table.field)]

Passing a list ([]) into that will give you a text in that field. and then 
you can use a form input to do the display like the book on page 84 on the 
book. Damn I am getting good at this!

On Monday, March 9, 2015 at 1:44:23 PM UTC-4, Gael Princivalle wrote:

 Sure.

 The search field at the top:
 http://www.chainreactioncycles.com/us/en


 Il giorno lunedì 9 marzo 2015 17:47:09 UTC+1, Ron Chatterjee ha scritto:

 Can you give an example of global Search. Any reference site?

 On Monday, March 9, 2015 at 12:18:54 PM UTC-4, Gael Princivalle wrote:

 Hello all.

 I would like to add a global search form in a website, the classical one 
 with one field and a search button.
 I've got some idea's about how doing it, but I would like to know if 
 there's an example on line, or if someone have some suggestions.

 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] Select categories that are in use

2015-03-09 Thread Gael Princivalle

 Hello all.

I've got some news categories:
db.define_table('news_categories',
Field('name', type='string', requires=IS_NOT_EMPTY(), label=
'Nome'),
format = '%(name)s')

And some news:
db.define_table('news',
Field('title', type='string', requires=IS_NOT_EMPTY()),
Field('body', type='text''),
Field('category', 'reference news_categories', requires = 
IS_IN_DB(db, db.news_categories.id,'%(name)s'),
  represent=lambda id, r: db.news_categories[id].name))

How can I select only the news_categories that have almost one news of that 
category ?
Now I've got all categories.
categories=db().select(db.news_categories.ALL)

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] is it possible to conditionally format grid field based on other field in the row?

2015-03-09 Thread Alex Glaros
can content of one grid field control formatting of other field in same row?

tried many variations including this but got: 'Row' object has no attribute 
'modified_on'

db.InternalMessage.subjectLine.represent = lambda value,row: DIV(value, 
_style='font-size:75%;color:#656555') if row.modified_on == None else DIV(
value, _style='font-size:135%;color:#991155')

thanks,

Alex Glaros

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


[web2py] how do I add form attributes to SQLFORM.factory?

2015-03-09 Thread Oliver Holloway

How do I get the form to autofocus the cursor into the text box? Here's one 
of the approaches I've tried. 

  attributes = {'_autofocus':'autofocus', '_type':'tel', 
'_autocomplete':'off', '_style':'height:80px; width:80px'}
  score_box = SQLFORM.factory(Field('score', 'integer'), **attributes)

Interestingly, the autocomplete attribute is definitely getting through, 
I've tested that repeatedly. None of the other ones are. 

I did see the post about doing this with a form.custom.widget 
https://groups.google.com/forum/#!searchin/web2py/autofocus/web2py/PC2nDnltGic/OiYEpQEORnkJ
 
setting, but couldn't figure out how to make that work in my case. I've 
also experimented with using keepvalues=True, from looking through the book.

Any help is much appreciated. This is the last thing on my list to have 
this demo ready. 

-- 
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 negate a query - error

2015-03-09 Thread Dmitry Ermolaev
but
db((db.progs.promo==True)).select():

is work!

понедельник, 9 марта 2015 г., 16:58:26 UTC+3 пользователь Niphlod написал:

 for the same exact reason. 

 NOT field = True 

 in t-sql means just FALSE, not FALSE and NULL

 On Monday, March 9, 2015 at 2:37:46 PM UTC+1, Dmitry Ermolaev wrote:

 I use negate -  why this not worked?

 воскресенье, 8 марта 2015 г., 23:15:49 UTC+3 пользователь Niphlod написал:

 booleans in T-SQL are not treated the same way as python. in T-SQL, 
 NULL values are neither True or False, they are just NULL.

 So, if you want closed either None or False, you should do

 ((db.progs.closed == None) | (db.progs.closed == False))

 one shortcut to it would be

 db.progs.closed.belongs((None, False))

 that'll turn this syntax to the previous one, effectively selecing both 
 None and False values.

 On Sunday, March 8, 2015 at 7:23:54 PM UTC+1, Dmitry Ermolaev wrote:

 db((db.progs.promo==True)  (db.progs.closed!=True)).select():
 or
 db((db.progs.promo==True)  ~(db.progs.closed==True)).select():


 not worked ((
 if exist record wirh promo=True and closed=None or False - it not 
 selected!



-- 
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] .decode('utf-8') on a string containg €

2015-03-09 Thread Kenneth
Hello,

is there a way to do a decode('utf-8') on a string containg for example the 
€ sign?


Kenneth

-- 
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 negate a query - error

2015-03-09 Thread Dmitry Ermolaev
not work:
for pr in db((db.progs.promo.belongs((None, False)))  
(db.progs.closed.belongs((None, False.select():

work:
for pr in db(db.progs).select():
if pr.promo or pr.closed: continue


понедельник, 9 марта 2015 г., 16:58:26 UTC+3 пользователь Niphlod написал:

 for the same exact reason. 

 NOT field = True 

 in t-sql means just FALSE, not FALSE and NULL

 On Monday, March 9, 2015 at 2:37:46 PM UTC+1, Dmitry Ermolaev wrote:

 I use negate -  why this not worked?

 воскресенье, 8 марта 2015 г., 23:15:49 UTC+3 пользователь Niphlod написал:

 booleans in T-SQL are not treated the same way as python. in T-SQL, 
 NULL values are neither True or False, they are just NULL.

 So, if you want closed either None or False, you should do

 ((db.progs.closed == None) | (db.progs.closed == False))

 one shortcut to it would be

 db.progs.closed.belongs((None, False))

 that'll turn this syntax to the previous one, effectively selecing both 
 None and False values.

 On Sunday, March 8, 2015 at 7:23:54 PM UTC+1, Dmitry Ermolaev wrote:

 db((db.progs.promo==True)  (db.progs.closed!=True)).select():
 or
 db((db.progs.promo==True)  ~(db.progs.closed==True)).select():


 not worked ((
 if exist record wirh promo=True and closed=None or False - it not 
 selected!



-- 
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] SQLFORM.grid search with multiple terms

2015-03-09 Thread Ian Holser
The search function on SQLFORM grid works fine for single terms, but when 
typing multiple terms, it doesn't seem to work.

For example:
If I have a field value of 'example example1', it will find it with a 
search for 'example' or 'example1'.  A search for 'example example1' comes 
up with the whole list (no search performed)

What is causing this behavior and can it be fixed?

Thanks,
Ian Holser

-- 
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] Different template in the same PDF file

2015-03-09 Thread Kenneth
Hi,

I have built an PDF report using the Template of pyfpdf, but I have done it 
a stupid way. The problem is that I need different templates on every page. 

This is not directly a web2py questions, but maybe somebody might have an 
idea how to use different Templates on different pages when creating PDF:s 
with pyfpdf. 


Kenneth

-- 
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 negate a query - error

2015-03-09 Thread Niphlod
with that query you get None or False for both promo and closed. What do 
you want ?

On Monday, March 9, 2015 at 8:27:27 PM UTC+1, Dmitry Ermolaev wrote:

 not work:
 for pr in db((db.progs.promo.belongs((None, False)))  
 (db.progs.closed.belongs((None, False.select():

 work:
 for pr in db(db.progs).select():
 if pr.promo or pr.closed: continue


 понедельник, 9 марта 2015 г., 16:58:26 UTC+3 пользователь Niphlod написал:

 for the same exact reason. 

 NOT field = True 

 in t-sql means just FALSE, not FALSE and NULL

 On Monday, March 9, 2015 at 2:37:46 PM UTC+1, Dmitry Ermolaev wrote:

 I use negate -  why this not worked?

 воскресенье, 8 марта 2015 г., 23:15:49 UTC+3 пользователь Niphlod 
 написал:

 booleans in T-SQL are not treated the same way as python. in T-SQL, 
 NULL values are neither True or False, they are just NULL.

 So, if you want closed either None or False, you should do

 ((db.progs.closed == None) | (db.progs.closed == False))

 one shortcut to it would be

 db.progs.closed.belongs((None, False))

 that'll turn this syntax to the previous one, effectively selecing both 
 None and False values.

 On Sunday, March 8, 2015 at 7:23:54 PM UTC+1, Dmitry Ermolaev wrote:

 db((db.progs.promo==True)  (db.progs.closed!=True)).select():
 or
 db((db.progs.promo==True)  ~(db.progs.closed==True)).select():


 not worked ((
 if exist record wirh promo=True and closed=None or False - it not 
 selected!



-- 
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 it possible to conditionally format grid field based on other field in the row?

2015-03-09 Thread Alex Glaros
thanks Ron.  This below really works

db.InternalMessage.subjectLine.represent = lambda value,row: DIV(value, 
_style='font-size:115%;color:#33') if row.InternalMessage.modified_on == 
None else DIV(value, _style='font-size:85%;color:#99')


-- 
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: db query

2015-03-09 Thread Garry Smith
Hi

Thanks for the reply

I have messing about a little with jquery today.
With some success, then not with others.

I put this code in a js file.


function DoAction( id )
{
$.ajax({
 type: POST,
 url: http://127.0.0.1:8080/School_Clubs/default/test1;,
 data: id= + id,
 
});
}

 and this code in my view.
{{for r in row:}}

a href=# OnClick=DoAction('{{=r.upn_no}}');  Click /a


{{}pass}

This sends a number to a test1 controller, which works.

I use number in the controller, to get info from a db. eg. get a row id 
based on the number.
Then insert some data in a db after some checks.(got some parts working)
After that I want to redirect to a another page, is that possible.
Bear in mind that when I send the number via jquery to the controller it 
does it in the background,
it doesn't change page.

What I'm trying todo is as follows.

I have a search page, which searches the database for a person based on a 
number.
This then brings back the users name onto a results page.
I would then click on the user name which then registers the person in the 
database into
another table with the room and period.

This is what it does in the background.
It checks to see if that person is already in the a room with that period, 
if false it puts them in the room.
then goes back to the search page.
If true it goes back to the search page without adding the person.
This stops you registering the same person in the same period.

Ive done this in codeigniter php framework with no problems.
 
I want do it in web2py, this seems a lot less code for what I have 
archieved so for, plus
its a good way to learn web2py and find the good and things and limitations 
if any.

Thnaks


On Monday, 9 March 2015 18:00:24 UTC, Dave S wrote:



 On Monday, March 9, 2015 at 9:53:42 AM UTC-7, Ron Chatterjee wrote:

 you need to do 


 {{response.files.append(URL('static','js/java_script_file_I_am_runnning.js))}}

 in web2py before ajax call layout.html

 and then use 

 script

 your function

 /script

 Correct me if I am wrong. Someone?


 That step is either unnecessary or already done for you, because I didn't 
 have to do it. 


 DIV id=my_hats
 {{=LOAD(c='t_hats', f='t_hats2.load', target='my_hats', ajax=True)}}
 span id=jsoffsJavascript off?  a href=t_hats2.html 
 id=jsoffaClick 
 here/a/span
 /DIV

 (If javascript is enabled, I set the span's visibility to 'hidden')

 JQuery is covered in Chapter 11
 URL:http://www.web2py.com/books/default/chapter/29/11/jquery-and-ajax
 and LOAD() is covered in Chapter 12
 URL:http://www.web2py.com/books/default/chapter/29/12/
 components-and-plugins#LOAD


 It's easy enough to use, even I figured it out  :-)

 Here's an example where I arm a button:

  dis_str = CAT(dis_str,
 TT(),
 INPUT(_name=derby, _type=hidden, value=index),
 TAG.BUTTON('derby promotion t=%s' % index,
_type=button, _name=proms%d % (index),
_value=addy,
_onclick='ajax(promotes.load, 
 [addy,hname, derby], my_promotions)',
_style=visibility:collapse, _id=promst%d % 
 (index)),
 BR())

 and eventually dis_str gets sent to the client to display.

 /dps




 On Monday, March 9, 2015 at 12:12:47 PM UTC-4, Garry Smith wrote:

 Hi again after reading chapter 6,

 I have found what I'm looking for.
 I did the following and got thre results I wanted.

 {{for r in row:}}
 p{{=r.surname}}p

 {{pass}}

 One other question I would like to ask.

 web2py works a lot like codeigniter for php using MVC, does web2py let 
 you use jquery to send  data using  json ajax back to the controllers.

 For example using:div 
 id='tracks_selected'onclick='getTracks($album-track_id)  in the view.

 Then use the following jquery


 function getTracks(id) {
 $.post(/media/getTracks, { id:id },
 function(data){
 $('#tracks').html(data);
 });
 }-

 Which would go the a controller /media/tracks with the id number to be 
 processes in the controller?

 

 On Monday, 9 March 2015 13:56:38 UTC, Garry Smith wrote:

 Hi Thanks for the reply,

 I have got query 2 working with the following:-

 qry = request.vars.upn_no
 q = (db.pupils.upn_no == qry)
 s = db(q) 
 row = s.select(db.pupils.upn_no,db.pupils.surname)

 which gives me the following.

 pupils.upn_no pupils.surname

 Dalglish

 Once in the view is their a way off changing column headings and just 
 showing what you want from the db.






 On Monday, 9 March 2015 13:48:17 UTC, Jim S wrote:

 thelist=[row.first_name for row in db(db.user.upn == 444).select()]

 Have you read chapter 6 from the book?  It is well worth your time and 
 should help with most of your questions.  
 http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer

 -Jim






 On Monday, March 9, 2015 at 8:31:13 AM UTC-5, Garry Smith wrote:

 I'm new to web2py, but 

Re: [web2py] Re: {{=LOAD()}} problem with views

2015-03-09 Thread Richard Vézina
Because web2py_ajax.html is loading jquery if I remember...

Richard

On Mon, Mar 9, 2015 at 2:15 PM, Annet anneve...@googlemail.com wrote:

 Thank you both for your replies.

 I finally found the issue has nothing to do with the controller and views.

 I am using a CDN to get jquery, in layout.html I've got:


 script src=//code.jquery.com/jquery-1.11.1.min.js/script

  {{include 'web2py_ajax.html'}}


 and from web2py_ajax.html I removed the following line.

 response.files.insert(0, URL('dbmodel','static','js/jquery.js'))


 putting the line back in web2py_ajax.html solves the issue.

 I don't understand why I cannot use a CDN, jquery loads before
 web2py_ajax.html is being included.


 Kind regards,

 Annet

 --
 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] SQLFORM Validation and Password Hashes

2015-03-09 Thread horridohobbyist
I use SQLFORM to add records to a table. However, one of the fields is a 
password which requires=[IS_STRONG(upper=2),CRYPT(salt=False)].

I would like to use SQLFORM to update records in the table, but I run into 
a problem:  the password field contains the hash of the password, which 
will not pass validation. So even if I don't change the password field, 
SQLFORM insists that I enter something that can be validated.

If I can't use SQLFORM, then I will have to build my own form and do 
everything from scratch, essentially mimicking SQLFORM. That seems to me to 
be a lot of unnecessary work.

Is there an easy workaround?

(Yeah, I'm still a web2py newbie.)

-- 
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: .decode('utf-8') on a string containg €

2015-03-09 Thread Leonel Câmara
Yes, utf-8 is perfectly capable of representing €, that decode should 
convert an utf-8 string with the € character into unicode. If you're having 
any problems somewhere in your stack something isn't using utf-8.

-- 
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: Bootstrap is really killing web2py

2015-03-09 Thread Johann Spies
Try createing a new app from the admin interface and replace it's bootstrap
css-files (in static/css) and js-files (in static/js) with bootstrap3 files
and see what you get.

Regards
Johann

On 5 March 2015 at 07:16, Moiz Nagpurwala moiz...@gmail.com wrote:

 Hello,

 I'm using latest relaease of web2py on my local machine. (
 2.9.12-stable+timestamp.2015.02.15.23.04.25 (Running on Rocket 1.2.6,
 Python 2.7.9))
 Unable to install the w2p file provided for BS 3.

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




-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)

-- 
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: gluon/Portlocker.py LockedFile BROKEN!

2015-03-09 Thread Niphlod
still don't see any reference in the docs..

On Monday, March 9, 2015 at 8:01:13 AM UTC+1, da...@mail.hebrew.edu wrote:

 the work around is to set truncate(0).


 On Sunday, March 8, 2015 at 5:14:14 PM UTC+2, da...@mail.hebrew.edu wrote:

 hi,
 after python 2.7.2, seek(0) on an opened file for append does not seek to 
 the begining - read the manual.

 so LockedFile(...) used by languages, is screwing up the language 
 translation file.

 I don't understand why the code does a seek(0)/truncate if not opened for 
 truncate, maybe it's
 a windows issue? It's not working on UNix!

 danny



-- 
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: gluon/Portlocker.py LockedFile BROKEN!

2015-03-09 Thread danny
the work around is to set truncate(0).


On Sunday, March 8, 2015 at 5:14:14 PM UTC+2, da...@mail.hebrew.edu wrote:

 hi,
 after python 2.7.2, seek(0) on an opened file for append does not seek to 
 the begining - read the manual.

 so LockedFile(...) used by languages, is screwing up the language 
 translation file.

 I don't understand why the code does a seek(0)/truncate if not opened for 
 truncate, maybe it's
 a windows issue? It's not working on UNix!

 danny



-- 
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] {{=LOAD()}} problem with views

2015-03-09 Thread Annet

I have the following page/index.html view:

{{extend 'scaffolding/outer_layout.html'}}

div class=main
  {{include 'page/ad.html'}}
  {{if groupcomponent:}}
  section class=main-group
div class=container
  div id=group-component
{{include 'page/group.html'}}
  /div !-- /#group-component --
/div !-- /.container --
  /section !-- /.main-group --
  {{pass}}
  section class=main-content
  {{include 'buildingblocks/address_element.html'}}
/div !-- /.container --
  /section !-- /.main-content--
/div !-- /.main --


This works. Now, I'd like page/group to be a separate function and load it 
using ajax.
I replaced {{include 'page/group.html'}} with:

{{=LOAD('page', 'group', args=nodeID, ajax=True, target='group-component', 
content='')}}

and renamed 'page/group.html' 'page/group.load'


The function simply returns group:

def group():
session.forget(response)

nodeID = request.args(0, cast=int)

response.view = 'page/group.load'

group = db((db.grp_group.nodeID==nodeID)  
(db.grp_group.orderBy==0)).select(db.grp_group.ALL, limitby=(0,1),
   
orderby_on_limitby=False).first()

return locals()


The problem is that this loads the entire page/index.html view where I want 
it to load page/group.load, the latter
is completely ignored. What am I doing wrong?


Kind regards,

Annet

-- 
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: gluon/Portlocker.py LockedFile BROKEN!

2015-03-09 Thread danny
i replied from my mailer, which goggle sent to the moderator :-)
here we go again:

sure, e.g:

https://docs.python.org/2.4/lib/bltin-file-objects.html

look for seek:
  
*seek*(
 
*offset*[*, whence*])
  
Set the file's current position, like stdio's fseek(). The *whence* argument 
is optional and defaults to 0 (absolute file positioning); other values are 
1 (seek relative to the current position) and 2 (seek relative to the 
file's end). There is no return value. Note that if the file is opened for 
appending (mode 'a' or 'a+'), any seek() operations will be undone at the 
next write. 
**

If the file is only opened for 
writing in append mode (mode 'a'), this method is essentially a no-op, but 
it remains useful for files opened in append mode with reading enabled 
(mode 'a+'). If the file is opened in text mode (without 'b'), only offsets 
returned by tell() are legal. Use of other offsets causes undefined 
behavior.

Note that not all file objects are seekable.
On Monday, March 9, 2015 at 10:44:29 AM UTC+2, Niphlod wrote:

 still don't see any reference in the docs..

 On Monday, March 9, 2015 at 8:01:13 AM UTC+1, da...@mail.hebrew.edu wrote:

 the work around is to set truncate(0).


 On Sunday, March 8, 2015 at 5:14:14 PM UTC+2, da...@mail.hebrew.edu 
 wrote:

 hi,
 after python 2.7.2, seek(0) on an opened file for append does not seek 
 to the begining - read the manual.

 so LockedFile(...) used by languages, is screwing up the language 
 translation file.

 I don't understand why the code does a seek(0)/truncate if not opened 
 for truncate, maybe it's
 a windows issue? It's not working on UNix!

 danny



-- 
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: gluon/Portlocker.py LockedFile BROKEN!

2015-03-09 Thread danny

the docs:

sure, e.g:

https://docs.python.org/2.4/lib/bltin-file-objects.html

look for seek:
  
*seek*(
 
*offset*[*, whence*])
  
Set the file's current position, like stdio's fseek(). The *whence* argument 
is optional and defaults to 0 (absolute file positioning); other values are 
1 (seek relative to the current position) and 2 (seek relative to the 
file's end). There is no return value. Note that if the file is opened for 
appending (mode 'a' or 'a+'), any seek() operations will be undone at the 
next write. 
**

If the file is only opened for 
writing in append mode (mode 'a'), this method is essentially a no-op, but 
it remains useful for files opened in append mode with reading enabled 
(mode 'a+'). If the file is opened in text mode (without 'b'), only offsets 
returned by tell() are legal. Use of other offsets causes undefined 
behavior.

Note that not all file objects are seekable.
On Sunday, March 8, 2015 at 5:14:14 PM UTC+2, da...@mail.hebrew.edu wrote:

 hi,
 after python 2.7.2, seek(0) on an opened file for append does not seek to 
 the begining - read the manual.

 so LockedFile(...) used by languages, is screwing up the language 
 translation file.

 I don't understand why the code does a seek(0)/truncate if not opened for 
 truncate, maybe it's
 a windows issue? It's not working on UNix!

 danny



-- 
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] Bunch/Batch/Bulk insert Re-use db.define_table field definition in SQLFORM.factory() ?

2015-03-09 Thread Ramkrishan Bhatt
Hi All,
  My question is about expanding form on dynamically for example. 
we have two tables. company and address 
now did SQLFORM.factory(db.company,db.address)

Now requirement is says that where company can have multiple address so i 
need a button for add more address. On click we need to append form. 

Can anybody provide the specific solutions. 

On Monday, 17 February 2014 20:43:00 UTC+5:30, Richard wrote:

 That an option... The other option is to wrap IS_IN_DB() into 
 IS_EMPTY_OR()... But it is not garanti that the concerning field will be 
 filled...

 Richard


 On Sat, Feb 15, 2014 at 3:48 PM, ksotiris sotiris...@gmail.com 
 javascript: wrote:

 Hello web2py-users,  I am new to web2py framework. I have a question 
 about the followings: 
  

 @Steve it exactly what I have in mind, except in my case the form has to 
 be generic for many differents tables, but if you only one table to bunch 
 insert, that way it works fine...

 Notice, if you create more inputs then the number your users will need 
 (not 3 records for instance) you get in trouble if you have not null 
 requires or IS_IN_DB or other validators)... So I use an other form to 
 catch the number of input the user is needing and I pass it buy the URL as 
 a vars something like that :

 URL(c='controller', f='bunch_func', vars=dict(nb_inputs=3))

 Then I use it in range function :

 for i in range(0, int(request.vars.nb_inputs))


 Is there another more easy way to do this ?

 For example why not to have an option before validate the posted data to 
 delete emtpy row - fields of the form and post only row - fields with no 
 empty values ???
 I have already try a lot of things but nothing is working. 
 The batch input form is usefull and i think must be an easy way for this.
 The above is working but is not so practical for the end user of the 
 batch input form.


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




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