[web2py] restful services call

2022-11-23 Thread T.R.Rajkumar
Is web2py.com down, I am not able to access. 
Also, in the book services is not responding. 
How to call restful services in web2py?
Thank you.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/912b1ce4-6eb2-4a14-874a-b45255735601n%40googlegroups.com.


[web2py] Re: Object type None error

2020-10-19 Thread T.R.Rajkumar
Dear Jim S
 I found the error to be in the database in one of the tables. When I 
corrected the form worked nicely. It was all a programming error on my 
part. Thank you so much for your valuable time and effort in helping me 
out. Web2py rocks.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/e311ffea-aa0c-45a2-962e-3423fcfe938ao%40googlegroups.com.


[web2py] Re: Object type None error

2020-10-17 Thread T.R.Rajkumar
The print rowsconlab for id other than 1910 is 

web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2020
Version 2.14.6-stable+timestamp.2016.05.10.00.21.47
Database drivers available: sqlite3, imaplib, pyodbc, pymysql, pg8000
please visit:
http://127.0.0.1:8000/
starting browser...
[{'thsk': '0.0', 'tsk': '0.0', 'unitid': 'ts2', 'da': '0.00', 
'vda': '0.
00', 'sacamt': '0.00', 'amcno': 'PLT17CS051', 'tusk': '0.0', 'awg': 
'0.00',
'esiamt': '0.00', 'pfamt': '0.00', 'tssk': '0.0'}]

for id 1910 there is nothing printed in the cmd window.

but the sp does return result below for id 1910

unitidamcnothsktsktssktuskawgdavda
pfamtsacamtesiamt
ts2AHO20DP05710.00.00.010.0
2800.000.00460.002042.56186.78510.64

for reasons unknow  to me web2py dal is not reading the result, resulting 
in None type object not iterable error.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/b412c91d-090f-4048-8c69-4292e7978a33o%40googlegroups.com.


[web2py] Re: Object type None error

2020-10-16 Thread T.R.Rajkumar



>- 
>
>
>
>
>
>
>
>I get this error for a particular amcid = 1910, for others it is 
>working ok. What might be the problem. The sp
>
>usr_getconlabqty_amc_new is indeed returning row from db when checked 
>in the backend. please elucidate.
>
> Actually the code is working fine, but for a particular id 1910 it reports 
error None cannot be iterated. The database does return the result but in 
dal/base.py as_dict check function the variable columns is not intialized 
as the execulte sql is returning None, I think so. But for all other amcids 
it is working fine. How to debug this. 
 
 

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/5037b009-1e5e-4885-8409-9439b4fc398co%40googlegroups.com.


[web2py] Re: Object type None error

2020-10-15 Thread T.R.Rajkumar



>- 
>
>
>
>
>
>def schII():
>if not URL.verify(request, hmac_key=KEY): raise HTTP(403)
>amcid = request.vars.amcid
>rowsamcdet = db(db.amc_details.amc_id == 
>amcid).select(db.amc_details.amcno)
>if not rowsamcdet:
>session.flash = "No jobs to make provn"
>redirect(URL('new_contract'))
>amcnod = db(db.amc_master.id == 
>amcid).select(db.amc_master.amcno).first()
>x = db(db.cont_overheads.amc_id == 
>amcid).select(db.cont_overheads.id)
>for i in x:
>record = i['id']
>#rows = db(db.cont_overheads.id == record).select()
>fields = ['phhskn','phhskd','phhsk',
>  'phskn','phskd','phsk',
>  'phsskn','phsskd','phssk',
>  'phuskn','phuskd','phusk',
>  'alwhskn','alwhskd','alwhsk',
>  'alwskn','alwskd','alwsk',
>  'alwsskn','alwsskd','alwssk',
>  'alwuskn','alwuskd','alwusk',
>  'tax','insurance','sac','bonus',
>  'supchr','fringes']
>form = 
>SQLFORM(db.cont_overheads,record,keepvalues=True,fields=fields)
>if form.process(session=None, 
>formname='frmschII',dbio=False,onvalidation=schII_validation).accepted:
>form.vars.amc_id = amcid
>form.vars.update_uid = session.uname
>form.vars.amcno = amcnod['amcno']
>form.record.update_record(**dict(form.vars))
>db.executesql("exec update_load_schII_amt_awg @amcid = 
>?",placeholders=([form.vars.amc_id]))
>session.flash = 'Overheads updated.'
>redirect(URL('new_contract'))
>elif form.errors:
>print form.errors
>response.flash = 'form has errors'
>else:
>response.flash = 'please fill the form'
># Note: no form instance is passed to the view
>## record passed to set the id value in view.
>rows = db(db.cont_overheads.id == record).select()
>rowsconlab = db.executesql("exec usr_getconlabqty_amc_new 
>@amcid=?",placeholders=([amcid]),as_dict=True)
>rowsrate = get_amc_rate(amcid)
>return 
>dict(record=record,rowsconlab=rowsconlab,rows=rows,rowsrate=rowsrate)
>
>
the error occurs in the  line marked red.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/dede93b9-3709-412a-9a33-dbea09285ae6o%40googlegroups.com.


[web2py] Re: Object type None error

2020-10-13 Thread T.R.Rajkumar
this is the result of the sp for amcid = 1910

unitidamcnothsktsktssktuskawgdavda
pfamtsacamtesiamt
ts2AHO20DP0529921.366008865.319458317.76000
31453.642458198133.440.001201554.585840151.72
532868.361460037.93

On Wednesday, October 14, 2020 at 10:40:53 AM UTC+5:30 T.R.Rajkumar wrote:

>
> I get this error for a particular amcid = 1910, for others it is working 
> ok. What might be the problem. The sp 
>
> usr_getconlabqty_amc_new is indeed returning row from db when checked in the 
> backend. please elucidate.
>
> Error ticket for "web_ocms" Ticket ID 
>
> 127.0.0.1.2020-10-14.10-26-27.939fd264-ebf8-4e08-aa76-2ca0d84a5703
>  'NoneType' object is not iterable Version 
> web2py™ Version 2.14.6-stable+timestamp.2016.05.10.00.21.47 
> Python Python 2.7.5: D:\Python\python.exe (prefix: D:\Python) Traceback 
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
>
> Traceback (most recent call last):
>   File "D:\web2py\gluon\restricted.py", line 227, in restricted
> exec ccode in environment
>   File "D:/web2py/applications/web_ocms/controllers/amc.py" 
> <http://127.0.0.1:8000/admin/default/edit/web_ocms/controllers/amc.py>, line 
> 407, in 
>   File "D:\web2py\gluon\globals.py", line 417, in 
> self._caller = lambda f: f()
>   File "D:/web2py/applications/web_ocms/controllers/amc.py" 
> <http://127.0.0.1:8000/admin/default/edit/web_ocms/controllers/amc.py>, line 
> 247, in schII
> rowsconlab = db.executesql("exec usr_getconlabqty_amc_new 
> @amcid=?",placeholders=([amcid]),as_dict=True)
>   File "D:\web2py\gluon\packages\dal\pydal\base.py", line 1028, in executesql
> fields = colnames or [f[0] for f in columns]
> TypeError: 'NoneType' object is not iterable
>
> Error snapshot [image: help] 
> <http://127.0.0.1:8000/admin/default/ticket/web_ocms/127.0.0.1.2020-10-14.10-26-27.939fd264-ebf8-4e08-aa76-2ca0d84a5703#>
>  
>
> ('NoneType' object is not iterable) 
>
> inspect attributes 
> Frames 
>
>- 
>
>*File D:\web2py\gluon\restricted.py in restricted at line 227* code 
>arguments variables 
>- 
>
>*File D:\web2py\applications\web_ocms\controllers\amc.py in  
>at line 407* code arguments variables 
>- 
>
>*File D:\web2py\gluon\globals.py in  at line 417* code 
>arguments variables 
>- 
>
>*File D:\web2py\applications\web_ocms\controllers\amc.py in schII at 
>line 247* code arguments variables 
>- 
>
>*File D:\web2py\gluon\packages\dal\pydal\base.py in executesql at line 
>1028* code arguments variables 
>Function argument list 
>
>(self=, 
>query='exec usr_getconlabqty_amc_new @amcid=?', placeholders=['1910'], 
>as_dict=True, fields=None, colnames=None, as_ordered_dict=False)
>Code listing 
>
>1023.
>1024.
>1025.
>1026.
>1027.
>1028.
>
>1029.
>1030.
>1031.
>1032.
>
># Non-DAL legacy db query, converts cursor results to dict.
># sequence of 7-item sequences. each sequence tells about a 
> column.
># first item is always the field name according to Python 
> Database API specs
>columns = adapter.cursor.description
># reduce the column info down to just the field names
>fields = colnames or [f[0] for f in columns]
>
>if len(fields) != len(set(fields)):
>raise RuntimeError("Result set includes duplicate column 
> names. Specify unique column names using the 'colnames' argument")
>#: avoid bytes strings in columns names (py3)
>if columns and not PY2:
>
>Variables 
>fields None 
>colnames None 
>columns None 
>f undefined
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/df927438-f572-40ac-8db3-52ea122845cen%40googlegroups.com.


[web2py] Object type None error

2020-10-13 Thread T.R.Rajkumar

I get this error for a particular amcid = 1910, for others it is working 
ok. What might be the problem. The sp 

usr_getconlabqty_amc_new is indeed returning row from db when checked in the 
backend. please elucidate.

Error ticket for "web_ocms" Ticket ID 

127.0.0.1.2020-10-14.10-26-27.939fd264-ebf8-4e08-aa76-2ca0d84a5703
 'NoneType' object is not iterable Version 
web2py™ Version 2.14.6-stable+timestamp.2016.05.10.00.21.47 
Python Python 2.7.5: D:\Python\python.exe (prefix: D:\Python) Traceback 

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

Traceback (most recent call last):
  File "D:\web2py\gluon\restricted.py", line 227, in restricted
exec ccode in environment
  File "D:/web2py/applications/web_ocms/controllers/amc.py" 
, line 
407, in 
  File "D:\web2py\gluon\globals.py", line 417, in 
self._caller = lambda f: f()
  File "D:/web2py/applications/web_ocms/controllers/amc.py" 
, line 
247, in schII
rowsconlab = db.executesql("exec usr_getconlabqty_amc_new 
@amcid=?",placeholders=([amcid]),as_dict=True)
  File "D:\web2py\gluon\packages\dal\pydal\base.py", line 1028, in executesql
fields = colnames or [f[0] for f in columns]
TypeError: 'NoneType' object is not iterable

Error snapshot [image: help] 

 

('NoneType' object is not iterable) 

inspect attributes 
Frames 
   
   - 
   
   *File D:\web2py\gluon\restricted.py in restricted at line 227* code 
   arguments variables 
   - 
   
   *File D:\web2py\applications\web_ocms\controllers\amc.py in  at 
   line 407* code arguments variables 
   - 
   
   *File D:\web2py\gluon\globals.py in  at line 417* code arguments 
   variables 
   - 
   
   *File D:\web2py\applications\web_ocms\controllers\amc.py in schII at 
   line 247* code arguments variables 
   - 
   
   *File D:\web2py\gluon\packages\dal\pydal\base.py in executesql at line 
   1028* code arguments variables 
   Function argument list 
   
   (self=, 
   query='exec usr_getconlabqty_amc_new @amcid=?', placeholders=['1910'], 
   as_dict=True, fields=None, colnames=None, as_ordered_dict=False)
   Code listing 
   
   1023.
   1024.
   1025.
   1026.
   1027.
   1028.
   
   1029.
   1030.
   1031.
   1032.
   
   # Non-DAL legacy db query, converts cursor results to dict.
   # sequence of 7-item sequences. each sequence tells about a 
column.
   # first item is always the field name according to Python 
Database API specs
   columns = adapter.cursor.description
   # reduce the column info down to just the field names
   fields = colnames or [f[0] for f in columns]
   
   if len(fields) != len(set(fields)):
   raise RuntimeError("Result set includes duplicate column 
names. Specify unique column names using the 'colnames' argument")
   #: avoid bytes strings in columns names (py3)
   if columns and not PY2:
   
   Variables 
   fields None 
   colnames None 
   columns None 
   f undefined
   

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/e43d24a7-2db8-44b3-ba29-e4a1f421809fo%40googlegroups.com.


[web2py] Re: URI for mssql

2020-08-17 Thread T.R.Rajkumar
I use the following.
mssql2://user:pwd@servername\instance/databasename
for connecting to mssql 2016
I have my webserver apache and web2py running in windows8.
mssql in windows 2016 server.
In servername I use the IP of the machine.
In instancename I have SQL16S7INS1   --- the instance name created by me 
when installing mssql
In databasename I have ocms_nlc   which is the database I have created 
in mssql
In username I give sa. You can give restricted username also if you have 
created one and given permission for that user to the concerned database.


On Sunday, August 16, 2020 at 3:24:18 PM UTC+5:30 and...@gmail.com wrote:

> Is it correct this uri to connect to mssql server 2016?
>
> uri   = mssql4://user:password@servername\instance/databasename
>
> or
>
> uri   = mssql4://user:password@servername/databasename
> (without instance)
>
> Do I have to use "/" for all separations or even "\"?
>
> how can I be sure to use pyodbc or pypyodbc?
>
> Thank you
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/23fcb03f-38e4-4c44-b74e-d36ee54647a7n%40googlegroups.com.


[web2py] Re: smart grid

2020-07-18 Thread T.R.Rajkumar
Thank you AGRogers. It works.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/027b2e4a-5225-4232-a4c9-a2a10e5e532do%40googlegroups.com.


[web2py] Re: smart grid

2020-07-18 Thread T.R.Rajkumar
Thank you villas. 
The dblc I am using a view and referencing that views lc_no in my table 
pm_events. I shall try how it works and if not I will go as you said.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/0572233b-c391-454c-9c0c-67c83912eb9do%40googlegroups.com.


[web2py] Re: smart grid

2020-07-17 Thread T.R.Rajkumar
Thank you AGRogers
As you said the equipment record format to include the location, that would 
do for me.
Can you please tell how to do that.


-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/c25d0e90-0524-4a63-95f5-85fa475b2b45o%40googlegroups.com.


[web2py] smart grid

2020-07-17 Thread T.R.Rajkumar
db.define_table('pm_events',
Field('eqp_id', 'reference pm_equip'),
Field('lc_no', 'reference 
dblc.lc_vw_lc_master.lc_no'),
Field('pending_work', type='string'),
Field('remarks', type='string'),
Field('completed', type='string', 
length=1,required='True',notnull='True'),

Field('update_uid','string',length=6,required='True',notnull='True',default 
= session.uname),

Field('update_dt','datetime',required='True',notnull='True',default=request.now)
)


dblc.define_table('lc_vw_lc_master',
Field('lc_no', 
type='string',length=11,required='True',notnull='True'),
Field('unit_descr',type='string'),
Field('btg_descr',type='string'),
Field('sys_descr',type='string'),
Field('eqp_descr',type='string'),
Field('lc_from',type='datetime'),
Field('lc_to',type='datetime'),
Field('work_descr',type='string'),
Field('lc_req_uname',type='string', length=11),
Field('lc_statue',type='string'),
Field('lc_req_dt',type='datetime'),
Field('lc_issue_uname',type='string', length=11),
Field('lc_issue_dt',type='datetime'),
primarykey=['lc_no'],
migrate=False)

db.define_table('pm_equip',
Field('equipment_id', 'integer'),
Field('equipment_no', 'string', length = 25),
Field('equipment_detail','string'),
Field('division_id', 'integer'),
Field('location_id', 'reference pm_location'),
Field('subdivision_id', 'integer'),
Field('divn', 'string',length = 10),
Field('rep_code', 'string', length = 10)
   )
db.define_table('pm_location',
Field('location_id', 'integer'),
Field('location_name', 'string')
)

I have the above tables in db.py
Now in controller pm_events.py I want to have a form for pm_events which 
has reference to pm_equip which in turn has reference to pm_location.
In the create form for pm_events on the selection of equipment it should 
show the location of the equipment and user enters other details and 
submits the form. 
How to achieve this functionality, may be in a smart grid.
Thank you for the time.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/2f1ae9c8-a967-443f-b0f4-197ab4f869e3o%40googlegroups.com.


[web2py] validators

2019-11-03 Thread T.R.Rajkumar
sqlform filed validators do not check for the precision of decimal fields. 
It would be nice it web2py validates the precision of fields.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/532ce58c-3e0c-4f09-9c1d-441dcb887476%40googlegroups.com.


[web2py] Re: float validator

2018-02-26 Thread T.R.Rajkumar
Thanks. I did as you said .0001,1.

-- 
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] float validator

2018-02-26 Thread T.R.Rajkumar
How to achieve >0.0 and <=1.0 float validator?

-- 
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: SOAP WSDL request strugle

2017-12-23 Thread T.R.Rajkumar
ts2admin.asmx is the web service. ValidateLogin is the method of that service. 
I pass the username and password to that service and it returns the result. If 
ret_code is 1 I allow login to my application LP.

-- 
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: SOAP WSDL request strugle

2017-12-23 Thread T.R.Rajkumar
In the controller login.py

-- 
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: SOAP WSDL request strugle

2017-12-23 Thread T.R.Rajkumar
I do like this

from gluon.contrib.pysimplesoap.client import SoapClient
client = 
SoapClient(wsdl="http://172.16.164.64/ws_ts2admin/ts2admin.asmx?WSDL;)
rs = client.ValidateLogin(lcUname, lcPwd, lnCode, lcMsg)
rs1 = rs['ValidateLoginResult']
ret_code = rs1['Code']
ret_msg = rs1['Msg']
#print ret_msg
#lcAppId = 'vb_cont'
if ret_code == 1:
#rs2 = client.ValidateAppUser(lcUname,lcAppId)
#rs3 = rs2['ValidateAppUserResult']
#rs4 = rs3['Code']
#if rs4 == 1:
session.logged_in = 'True'
session.uname = lcUname
redirect(URL('lp','lp'))

#else:
#response.flash ='Not a user of app.'
else:
response.flash = ret_msg

-- 
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: fonts.googleapis

2017-12-13 Thread T.R.Rajkumar
Thank you Alex. I removed the @import in bootstrap.min.css I do not want 
that.

On Friday, December 8, 2017 at 3:36:35 PM UTC+5:30, T.R.Rajkumar wrote:
>
> I have an application. The views extend layout.html. When there is no 
> internet connection my pages wait for fonts.googleapis.com
> I dont want that to happen. How to remove the dependecy on 
> fonts.gooleapis.com
>

-- 
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: fonts.googleapis

2017-12-08 Thread T.R.Rajkumar
Its an intranet application.

On Friday, December 8, 2017 at 3:36:35 PM UTC+5:30, T.R.Rajkumar wrote:
>
> I have an application. The views extend layout.html. When there is no 
> internet connection my pages wait for fonts.googleapis.com
> I dont want that to happen. How to remove the dependecy on 
> fonts.gooleapis.com
>

-- 
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] fonts.googleapis

2017-12-08 Thread T.R.Rajkumar
I have an application. The views extend layout.html. When there is no 
internet connection my pages wait for fonts.googleapis.com
I dont want that to happen. How to remove the dependecy on 
fonts.gooleapis.com

-- 
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: uploadseparate

2017-11-12 Thread T.R.Rajkumar
It's uploadfolder

-- 
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: uploadseparate

2017-11-12 Thread T.R.Rajkumar
Thank you Anthony. Now I understand uploadseparate. I will use uploaded as that 
will suit me better.

-- 
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] uploadseparate

2017-11-09 Thread T.R.Rajkumar
The uploadseparate creates folder sructure like 
uploads/amc_master.annexure/a0, uploads/amc_master.annexure/87 for the 
field annexure in table amc_master. Here a folder is created with the first 
two letters of UUID. So for me each session a new UUID folder is created 
and the annexure file is stored in it. This results in each UUID subfolder 
storing just one file. I would like all the annexure files in 
uploads/amc_master.annexure folder and not in UUID subfolder.  How to do 
that?

-- 
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: Two forms

2017-09-22 Thread T.R.Rajkumar
The order table id will be returned by the insert statement. There will be 
no race. We can use the returned id in items table.

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


[web2py] Re: grid for data entry

2017-07-24 Thread T.R.Rajkumar
Any ideas?

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


[web2py] grid for data entry

2017-07-22 Thread T.R.Rajkumar
I want data to be captured for tdr_bid_unrev_detls.rate. I have the query 
below.

select d.jcod,d.qty,u.rate,u.amt
from tdr_tender_master t join  amc_master m on t.amc_id = m.id
 join amc_details d on m.id = d.amc_id
 left join tdr_bid_unrev_detls u on u.tdr_id = t.id and u.amc_id = m.id 
where m.id = 15

This returns the result 

jcod qty  rateamt

cs00110.00NULLNULL
cs01010.00NULLNULL
cstest10.00NULLNULL
cs00210.00NULLNULL
asd 2.00NULLNULL
cs004 5.00 NULLNULL
test1 10.00 NULLNULL

Now I would like to fill the rate in the above result in a grid generated 
by the above query.
I tried this in controller

tdrid = request.vars.tdrid

query = (db.tdr_tender_master.id==tdrid) & (db.tdr_tender_master.amc_id == 
db.amc_master.id) & (db.amc_master.id == db.amc_details.amc_id) & 
(db.tdr_bid_unrev_detls.tdr_id == db.tdr_tender_master.id) 
left=db.tdr_bid_unrev_detls.on(db.tdr_tender_master.id == 
db.tdr_bid_unrev_detls.tdr_id)

form = SQLFORM.grid(query,left=left)

but i dont get the required form. I want to populate the 
tdr_bid_unrev_detls table. I am not able to do it myself reading the book. 
So pl. help. Thanks and regards.

 

-- 
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: smartgrid tampering with url in browser

2017-06-26 Thread T.R.Rajkumar
Yes, Anthony I did del session.auth in logout action and it working fine. 
Thanks for all the input. I thought I cannot use the grid without auth. But 
now because of your help the dependency has been removed and I am on my own 
authentication. Thanks again.

-- 
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: smartgrid tampering with url in browser

2017-06-24 Thread T.R.Rajkumar
Now I have ant\other small hitch. When I logout the action logout is called 
and redirect to login page. 

If I or another user logins in with the same browser window digital 
signature is not available in grid.

If I close the browser window and open the browser and login _signature is 
available.

How to get the _signature in the same window after logout/login.

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: smartgrid tampering with url in browser

2017-06-24 Thread T.R.Rajkumar
Yes, perfect Anthony. Thanks a lot for forbearing with me. Anyway it is my 
pleasure to learn from the group.

I put the above code in my login action as below. It is working perfectly.

from gluon.storage import Storage
from gluon.utils import web2py_uuid
def login():
form = FORM(TABLE(
TR('User Name:',INPUT( 
_name='txtUName',_id='txtUName',requires=[IS_NOT_EMPTY(),IS_LENGTH(6,6),IS_MATCH('^e\d{5}',error_message='not
 
valid user name.')])),
TR('Password:', INPUT (_name='txtPwd', _id='txtPwd', 
_type='password',requires=[IS_NOT_EMPTY(),IS_LENGTH(8,6)])),
INPUT (_type='submit',_value='Login') 
)
   )
msg=''
if form.process(keepvalues=True).accepted:

lcUname = form.vars.txtUName
lcPwd = form.vars.txtPwd
lnCode = 10
lcMsg = 'y'

from gluon.contrib.pysimplesoap.client import SoapClient
client = 
SoapClient(wsdl="http://172.16.164.64/ws_ts2admin/ts2admin.asmx?WSDL;)
rs = client.ValidateLogin(lcUname, lcPwd, lnCode, lcMsg)
rs1 = rs['ValidateLoginResult']
ret_code = rs1['Code']
ret_msg = rs1['Msg']
#print ret_msg
lcAppId = 'vb_cont'
if ret_code == 1:
rs2 = client.ValidateAppUser(lcUname,lcAppId)
rs3 = rs2['ValidateAppUserResult']
rs4 = rs3['Code']
if rs4 == 1:
rows =  db.executesql("exec admin_get_user_details 
@lcUserName = ?",placeholders=([lcUname]),as_dict=True)
for i in rows:
session.divn = i['amcdcod']
session.sec = i['amcscod']
session.unit = i['unitid']
session.logged_in = True
session.uname = lcUname
if 'auth' in session:
session.auth = None
   
* if not 'auth' in session:session.auth = 
Storage(hmac_key=web2py_uuid(), user=True)*
redirect(URL('amc','new_contract'))
else:
response.flash ='Not a user of app.'
else:
response.flash = ret_msg


return dict(form=form,msg=msg)

def logout():
session.logged_in = None
session.uname = None
session.auth = None
session.divn = None
session.sec = None
session.unit = None
redirect(URL('login','login'))

-- 
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: smartgrid tampering with url in browser

2017-06-22 Thread T.R.Rajkumar
Anthony, When I comment out auth and in model amc/amc.py I add this
from gluon.storage import Storage
from gluon.utils import web2py_uuid
if not 'auth' in session:
session.auth = Storage(hmac_key=web2py_uuid())

Now the smartgrid lists the rows but when add or edit button is clicked I 
get not authorized flash message and it is not allowing to edit or add 
records. Also when I place the mouse over edit button I see the edit urls 
are not digitally signed.

-- 
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: smartgrid tampering with url in browser

2017-06-22 Thread T.R.Rajkumar
If I am not defining auth the error does not appear, but the grid 
user_signature is not working. I am setting the hmac_key as mentioned in 
model amc.py.
from gluon.storage import Storage
from gluon.utils import web2py_uuid
if not 'auth' in session:
session.auth = Storage(hmac_key=web2py_uuid()

How can I make grid user_signature to work without auth.

-- 
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: smartgrid tampering with url in browser

2017-06-21 Thread T.R.Rajkumar
I put the below  code in my model file amc.py

from gluon.storage import Storage
from gluon.utils import web2py_uuid
if not 'auth' in session:
session.auth = Storage(hmac_key=web2py_uuid())

But now when in run http://127.0.0.1:8000/web_ocms/amc/new_contract I get 
this error.

Error ticket for "web_ocms" Ticket ID 

127.0.0.1.2017-06-22.10-26-57.a604f48d-7432-4cf3-b628-81168a796052
 unsupported type for timedelta seconds 
component: NoneType Version 
web2py™ Version 2.14.6-stable+timestamp.2016.05.10.00.21.47 
Python Python 2.7.5: D:\Python\python.exe (prefix: D:\Python) Traceback 

1.
2.
3.
4.
5.
6.
7.
8.
9.

Traceback (most recent call last):
  File "D:\web2py\gluon\restricted.py", line 227, in restricted
exec ccode in environment
  File "D:/web2py/applications/web_ocms/models/db.py" 
, line 86, in 

auth = Auth(db, host_names=myconf.get('host.names'))
  File "D:\web2py\gluon\tools.py", line 1766, in __init__
delta = datetime.timedelta(days=0, seconds=auth.expiration)
TypeError: unsupported type for timedelta seconds component: NoneType

Error snapshot [image: help] 

 

(unsupported type for timedelta seconds 
component: NoneType) 

inspect attributes 
Frames 
   
   - 
   
   *File D:\web2py\gluon\restricted.py in restricted at line 227* code 
   arguments variables 
   - 
   
   *File D:\web2py\applications\web_ocms\models\db.py in  at line 
   86* code arguments variables 
   - 
   
   *File D:\web2py\gluon\tools.py in __init__ at line 1766* code arguments 
   variables 
   Function argument list 
   
   (self=, environment=, db=, mailer=True, 
   hmac_key=None, controller='default', function='user', cas_provider=None, 
   signature=True, secure=False, csrf_prevention=True, 
   propagate_extension=None, url_index=None, jwt=None, 
   host_names=['localhost:*', '127.0.0.1:*', '*:*', '*'])
   Code listing 
   
   1761.
   1762.
   1763.
   1764.
   1765.
   1766.
   
   1767.
   1768.
   1769.
   1770.
   
   # if we have auth info
   #if not expired it, used it
   #if expired, clear the session
   # else, only clear auth info in the session
   if auth:
   delta = datetime.timedelta(days=0, seconds=auth.expiration)
   
   if auth.last_visit and auth.last_visit + delta > now:
   self.user = auth.user
   # this is a trick to speed up sessions to avoid many writes
   if (now - auth.last_visit).seconds > (auth.expiration / 10):
   
   Variables 
   auth.expiration None 
   seconds undefined 
   days undefined 
   auth  
   global datetime  
   delta undefined 
   datetime.timedelta 
   
So now I commented in db.py
#auth = Auth(db, host_names=myconf.get('host.names'))

After commenting auth the url works. Is this because of the hmac_key ?


-- 
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: smartgrid tampering with url in browser

2017-06-21 Thread T.R.Rajkumar
Yes, Anthony now with user_signature = True prevents tampering of urls 
generated by smartgrid. 
This is when I use auth and signup and then call the grid.
But in my app I am using custom login form with user credentials from a 
legacy table.
Can I achieve the same result with custom login form?
As of now in login form I set session.logged_id = True if credentials are 
OK. 
In db.py I have this function.

def check_logged_in(callee):
def wrapper():
if session.logged_in == None:
session.flash = 'Please login.'
redirect(URL('login', 'login'))
else:
return callee()
return wrapper

and in controller I do this
@check_logged_in
def new_contract():

With this set up if I set user_signature = True in grid it does not allow 
editing and inserting. It allows only viewing. 
How to achieve the same effect as auth using my check_logged_in function.
Thank you for the help.
Regards.
 

-- 
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: smartgrid links

2017-06-20 Thread T.R.Rajkumar
Thank you Anthony. I will do the same.

-- 
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] smartgrid tampering with url in browser

2017-06-20 Thread T.R.Rajkumar
I have this page from the edit button of the child. 
http://127.0.0.1:8000/web_ocms/amc/new_contract/amc_master/amc_details.amc_id/17/edit/amc_details/10
Here 17 is the id of the master and 10 is the id of the child.
I have set common_filter in controller so that the records of master and 
child belonging to the logged in user is listed in grid.
So in controller I check the master id and child id and if not of the user 
I raise a flash tampering not allowed and redirect to the master grid.
So far OK. 
But now if 17 and 10 are tampered to say 20 and 25 and the new record also 
belongs to the user the form show the record to edit.
I would like that the tampering of url not be allowed. That is if one 
clicks the edit button and gets the above url I should allow processing 
only with 17 and 10 and not any other record.
Thanks for suggestions.

-- 
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: Edit grid/smartgrid problem

2017-06-20 Thread T.R.Rajkumar
If you are creating the form in html then for update forms you must add a 
hidden input with name id and set to the edit records id.

-- 
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: smartgrid links

2017-06-19 Thread T.R.Rajkumar
Am I not clear in my question?

-- 
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] smartgrid links

2017-06-13 Thread T.R.Rajkumar
In grid we have this in book. links_in_grid if set to False, links will 
only be displayed in the "details" and "edit" page (so, not on the main 
grid). 

I want the reverse, the links to be displayed in the main grid and not in 
the edit or details page. And that too in the parent gird only, not in the 
children grid. Thank you in advance for the 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: grid add/edit form label

2017-06-06 Thread T.R.Rajkumar
Thanks a lot icodk. Now I am able to change the text of buttons.

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


[web2py] Re: grid add/edit form label

2017-06-05 Thread T.R.Rajkumar
Thanks icodk for the code. But I do not understand grid[1][0][2][0]. What 
is that? Could you pl. tell me. Thank you once again.

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


[web2py] Re: grid add/edit form label

2017-06-05 Thread T.R.Rajkumar
Thanks icodk. You  said The last part is after the call to 
SQLFORM.smartgrid. Here you can manipulate the serialized HTML data by for 
example changing the "+Add record" text to "+Add person" in the  auto 
generated button 

I would like to know how you manipulate the html in controller as above for 
changing the button text. 

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


[web2py] Re: grid add/edit form label

2017-06-05 Thread T.R.Rajkumar
Yes, Anthony. It now works. Thank you for your valuable time.

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


[web2py] Re: grid add/edit form label

2017-06-02 Thread T.R.Rajkumar
As said I did this in controller but there is no effect in either create or 
edit forms of amc_master or amc_details. I added the closing parenthesis 
for the first dict. Anything I miss?

form = SQLFORM.smartgrid(db.amc_master,
 linked_tables=['amc_details'],
 user_signature=False,
 fields=dict(amc_master=list_of_fields),
 formstyle='table3cols',
 headers=headers,
 formargs={'amc_master': 
dict(labels=[{'lrrflg': 'Rate Revision'}]),
   'amc_details': dict(labels=[{'qty': 
'Quantity'}])}
)

-- 
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: smartgrid edit form javascript calculation

2017-06-02 Thread T.R.Rajkumar
Sorry. I am able to do it. In view new_contract.html I have now this.
{{extend 'layout.html'}}
New Contract
{{=form}}





jQuery(document).ready(function(){
   $("#amc_details_hsk").change(function(){
calculate_rate();
});
   $("#amc_details_sk").change(function(){
calculate_rate();
});
$("#amc_details_ssk").change(function(){
calculate_rate();
});
$("#amc_details_usk").change(function(){
calculate_rate();
});
$("#amc_details_shift").change(function(){
calculate_rate();
});
$("#amc_details_misc").change(function(){
calculate_rate();
});
 $("#amc_details_eqty").change(function(){
calculate_rate();
});
 $("#amc_details_unit").change(function(){
calculate_rate();
});
});



Now I am able to set the rate for the job.

Thanks for forbearing with me.

-- 
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] smartgrid edit form javascript calculation

2017-06-02 Thread T.R.Rajkumar
In model I have this 

db.define_table('amc_details',
Field('amc_id','reference 
amc_master'),   
Field('jcod', 
type='string',required='True',notnull='True',length=10),

Field('jobdesc',type='string',required='True',notnull='True',length=250),

Field('rqty',type='decimal(18,2)',required='True',notnull='True'),

Field('rrate',type='decimal(18,2)',required='True',notnull='True'),

Field('qty',type='decimal(18,2)',required='True',notnull='True'),

Field('rate',type='decimal(18,2)',required='True',notnull='True'),

Field('amt',type='decimal(18,2)',required='True',notnull='True'),

Field('hsk',type='decimal(18,5)',required='True',notnull='True'),

Field('sk',type='decimal(18,5)',required='True',notnull='True'),

Field('ssk',type='decimal(18,5)',required='True',notnull='True'),

Field('usk',type='decimal(18,5)',required='True',notnull='True'),

Field('shift',type='decimal(18,5)',required='True',notnull='True'),

Field('eqty',type='decimal(18,2)',required='True',notnull='True'),

Field('misc',type='decimal(18,2)',required='True',notnull='True'),

Field('unit',type='decimal(18,2)',required='True',notnull='True'),

Field('uom',type='string',required='True',notnull='True',length=16),
Field('justn',type='text',required='True',notnull='True'),
Field('scope',type='text',required='True',notnull='True'),

Field('aflg',type='string',length=1,required='True',notnull='True'),

Field('update_uid','string',length=6,required='True',notnull='True',default 
= session.uname),

Field('update_dt','datetime',required='True',notnull='True',default=request.now)
)

In controller this
 
form = SQLFORM.smartgrid(db.amc_master,
 linked_tables=['amc_details'],
 user_signature=False,
 fields=dict(amc_master=list_of_fields),
 formstyle='table3cols',
 headers=headers   
)

Now when I click Add record of the child I get this. 
http://127.0.0.1:8000/web_ocms/amc/new_contract/amc_master/amc_details.amc_id/3/new/amc_details

Here as the user inputs I would like to calculate the rate as 
(hsk+sk+ssk+usk)*shift/eqty

This calculation I would like to do in javascript  and populate the rate 
field of the above view. 

Where to write the javascript onchange functiion. I have only 
new_contract.html only. Pl.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: grid add/edit form label

2017-06-01 Thread T.R.Rajkumar
You've got it backwards -- the top-level keys of the editargs and 
createargs parameters should be the table names, with the nested 
dictionaries holding the actual SQLFORM arguments.

I am not familiar with the syntax. Can you pl. elaborate with some actual 
code. Thanks Anthony.

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


[web2py] Re: grid add/edit form label

2017-06-01 Thread T.R.Rajkumar
For a smartgrid I am doing this.
form = SQLFORM.smartgrid(db.amc_master,
 linked_tables=['amc_details'],
 user_signature=False,
 fields=dict(amc_master=list_of_fields),
 formstyle='table3cols',
 headers=headers,
 
editargs={'labels':dict(amc_master={'lrrflg':'Rate Revision'},
 
amc_details={'qty':'Quantity'})},
 
createargs={'labels':dict(amc_master={'lrrflg':'Rate Revision'},
 
amc_details={'qty':'Quantity'})})

But I see no effect in labels of edit/create forms. I dont know how to do 
that. Pl. 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] grid add/edit form label

2017-06-01 Thread T.R.Rajkumar
The grid object accepts headers but is only for the grid. Now how to set 
the labels of the fields in grid add/edit forms. 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: grid edit

2017-05-31 Thread T.R.Rajkumar
Yes Anthony, with this the grid edit is OK.
[setattr(f, 'writable', False) for f in db.
amc_master
 if f.name not in ['id', 'amcdesc', 'amcmod', 'complndays']]

But how come it worked fine with postgresql without the id field setting?

Anyway thanks a lot for resolving the issue.

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

2017-05-31 Thread T.R.Rajkumar
Could be interesting to hear what are the arguments for the porting 

The points are
1. The application business logic has changed and the workflow has also 
changed. So I have to do the app fresh. 
2. Since I like web2py I thought of porting it to web2py. Why I like 
web2py? The answer is
   a. The neat and clean MVC design.
   b. SQLFORM, grid which are great time savers as told in the book itself 
   c. The HTML helpers, the DAL which almost reduces my views to {{=form}}
   d. In jsp for crud we have different pages for creating and editing. The 
grid saves all the code for edit pages.
   e. If I concentrate on model then my controller and views are a breeze. 
Thanks for all the validators.
   f. This group which is very friendly and I get answers to problems 
almost always.
   g. jsp is doing things in a very roundabout way atleast in the app I 
have. The pages have <%@ taglib prefix="app" 
uri="http://localhost:8080/cms/jstl/cms-custom-taglib; %> I have to go to 
tag lib see the function siganture go the bean find the function and locate 
the stored procedure which does the job. A
   In web2py it is so straight. 
   h. So comes the ease of maintenance. 
Thank you web2py for all this and the nice people over 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: grid edit

2017-05-31 Thread T.R.Rajkumar
When I do SQLFORM.grid(db.amc_master) without setting any of the 
readable/writable attributes the grid edit works fine. I am able to edit 
and the form submits without errors. 
Even with specifying the fields list grid edit works fine as the edit from 
has all the fields of the table. 
But when I set the  readable/writable attributes to filter the fields in 
edit form the the error 42000 listed above occurs. 
Thank you Anthony for the test guidance. 
How to go about now?

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


[web2py] Re: grid edit

2017-05-30 Thread T.R.Rajkumar
I don't know why there is no response from anyone in the group. Is the post 
not clear? 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] web2py support

2017-05-30 Thread T.R.Rajkumar
I am now porting a jsp application to web2py. Should I stay with web2py or 
wait for web3py? Will there be web2py group support like now after web3py. 
Pl guide. 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: grid edit

2017-05-25 Thread T.R.Rajkumar
I googled and saw this https://www.drupal.org/node/2342699 where it is 
stated that SqlContentEntityStorage::mapToStorageRecord sends update 
statements that includes IDENTITY fields that need to be updated, such as: 
UPDATE xxx SET nid = 1, property0 = :value0 WHERE nid = 1;. This is not 
supported in SQL Server because although there is no actual update 
happening it is explicitly telling the database engine that you wish to 
perform an update.

and here https://www.drupal.org/node/2090251  it is said The underlying 
problem is that MySQL accepts identity updates (when there are no changes) 
but Sql Server being properly designed complains with this bad practice.

Is this the issue in web2py also.
 

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


[web2py] Re: grid edit

2017-05-24 Thread T.R.Rajkumar
When I connect to postgresql the same model the grid edit form submits 
without error. Is this to do with pyodbc?

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


[web2py] Re: grid edit

2017-05-24 Thread T.R.Rajkumar
I have this in model.
db.define_table('amc_master',
Field('amcno', type='string',length=10,
required='True',notnull='True',requires=IS_LENGTH(10)),
Field('unitid',type='string',length=3,notnull='True'),
Field('amcdesc', 
type='string',length=512,required='True',notnull='True'),
Field('estval', type='decimal(18,2)'),
Field('supcflg', type='string', length=1),
Field('supcval',type='decimal(18,2)'),
Field('netestval',type='decimal(18,2)'),
Field('bidmethod',type='string',length=3),
Field('capbud',type='string',length=1),
Field('amcmod',type='string',length=3),
Field('lrrflg',type='string',length=1),
Field('insflg',type='string',length=1),
Field('stflg',type='string',length=1),
Field('phwflg',type='string',length=1),
Field('contyp',type='string',length=3),
Field('rfact',type='decimal(18,2)'),
Field('qfact',type='decimal(18,2)'),
Field('emdamt',type='decimal(18,2)'),
Field('doccharge',type='decimal(18,2)'),
Field('divn',type='string',length=3),
Field('subdivn',type='string',length=2),
Field('cflg',type='string',length=1),
Field('statflg',type='string',length=3),
Field('appauthority',type='string',length=16),
Field('accappddt',type='datetime'),
Field('iewappddt',type='datetime'),
Field('complndays',type='integer'),
Field('examcno',type='string',length=10),
Field('consoldamcstr',type='string',length=70),
Field('isconsold',type='string',length=1),
Field('estonprovn',type='decimal(18,2)'),
Field('totest',type='decimal(18,2)'),

Field('update_uid','string',length=6,required='True',notnull='True'),
Field('update_dt','datetime',required='True',notnull='True')
)

in controller i have this

def newamcmaster():
list_of_fields = 
[db.amc_master.amcdesc,db.amc_master.amcmod,db.amc_master.complndays]
[setattr(f, 'readable', False) for f in db.amc_master if f.name not in 
['amcdesc','amcmod','complndays']]
[setattr(f, 'writable', False) for f in db.amc_master if f.name not in 
['amcdesc','amcmod','complndays']]
grid = 
SQLFORM.grid(db.amc_master,user_signature=False,fields=list_of_fields,oncreate=create_new_amc)
return locals()

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


[web2py] Re: grid oncreate

2017-05-24 Thread T.R.Rajkumar
First, why use db.executesql rather than a regular DAL query? Second, you 
should move the call to get_new_amcno to the controller function where you 
need to do this insert and set the defaults there -- otherwise, you are 
doing this database query on every single request to the app, even all the 
requests where it is not needed. To set the defaults after the table 
definition, just do:

db.mytable.myfield.default = 'some value'

Anthony

Thanks Anthony for the guidance. I have moved get_new_amcno to the 
controller. I use executesql for calling stored procedure which gives the 
coined amcno as result. For coining of amcno it uses other tables like 
amcdivn, amcsection which I have not defined in my model because I never am 
to do any crud on these tables. So I thought an sp would do fine. Is that 
approach OK? Regards.

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


[web2py] Re: grid edit

2017-05-24 Thread T.R.Rajkumar
Why is DAL trying to update id column in grid edit form submission.

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


[web2py] grid edit

2017-05-23 Thread T.R.Rajkumar
I call this 127.0.0.1:8000/web_ocms/amc/newamcmaster/edit/amc_master/3 by 
clicking the edit button of the recor in the grid, and the edit form for 
the record is displayed. After editing when I submit error ticket is issued 
stating id column cannot be updated. Pl. help. Thanks for your time.
The ticket is

Error ticket for "web_ocms" Ticket ID 

127.0.0.1.2017-05-23.17-15-24.8a493eb8-5c35-4dd1-8ade-97ef1e190c7c
 ('42000', "[42000] [Microsoft][ODBC SQL 
Server Driver][SQL Server]Cannot update identity column 'id'. (8102) 
(SQLExecDirectW)") Version 
web2py™ Version 2.14.6-stable+timestamp.2016.05.10.00.21.47 
Python Python 2.7.5: D:\Python\python.exe (prefix: D:\Python) Traceback 

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

Traceback (most recent call last):
  File "D:\web2py\gluon\restricted.py", line 227, in restricted
exec ccode in environment
  File "D:/web2py/applications/web_ocms/controllers/amc.py" 
, line 
49, in 
  File "D:\web2py\gluon\globals.py", line 417, in 
self._caller = lambda f: f()
  File "D:/web2py/applications/web_ocms/models/db.py" 
, line 140, in 
wrapper
return callee()
  File "D:/web2py/applications/web_ocms/controllers/amc.py" 
, line 
42, in newamcmaster
grid = 
SQLFORM.grid(db.amc_master,user_signature=False,fields=list_of_fields,oncreate=create_new_amc)
  File "D:\web2py\gluon\sqlhtml.py", line 2352, in grid
next=referrer)
  File "D:\web2py\gluon\html.py", line 2298, in process
self.validate(**kwargs)
  File "D:\web2py\gluon\html.py", line 2236, in validate
if self.accepts(**kwargs):
  File "D:\web2py\gluon\sqlhtml.py", line 1744, in accepts
self.id_field_name]).update(**fields)
  File "D:\web2py\gluon\packages\dal\pydal\objects.py", line 2054, in update
ret = db._adapter.update("%s" % table._tablename, self.query, fields)
  File "D:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 1031, in 
update
raise e
ProgrammingError: ('42000', "[42000] [Microsoft][ODBC SQL Server Driver][SQL 
Server]Cannot update identity column 'id'. (8102) (SQLExecDirectW)")

Error snapshot [image: help] 

 

(('42000', "[42000] [Microsoft][ODBC SQL 
Server Driver][SQL Server]Cannot update identity column 'id'. (8102) 
(SQLExecDirectW)")) 

inspect attributes 
Frames 
   
   - 
   
   *File D:\web2py\gluon\restricted.py in restricted at line 227* code 
   arguments variables 
   - 
   
   *File D:\web2py\applications\web_ocms\controllers\amc.py in  at 
   line 49* code arguments variables 
   - 
   
   *File D:\web2py\gluon\globals.py in  at line 417* code arguments 
   variables 
   - 
   
   *File D:\web2py\applications\web_ocms\models\db.py in wrapper at line 
   140* code arguments variables 
   - 
   
   *File D:\web2py\applications\web_ocms\controllers\amc.py in newamcmaster 
   at line 42* code arguments variables 
   - 
   
   *File D:\web2py\gluon\sqlhtml.py in grid at line 2352* code arguments 
   variables 
   - 
   
   *File D:\web2py\gluon\html.py in process at line 2298* code arguments 
   variables 
   - 
   
   *File D:\web2py\gluon\html.py in validate at line 2236* code arguments 
   variables 
   - 
   
   *File D:\web2py\gluon\sqlhtml.py in accepts at line 1744* code arguments 
   variables 
   - 
   
   *File D:\web2py\gluon\packages\dal\pydal\objects.py in update at line 
   2054* code arguments variables 
   - 
   
   *File D:\web2py\gluon\packages\dal\pydal\adapters\base.py in update at 
   line 1031* code arguments variables 
   Function argument list 
   
   (self=, 
   tablename='amc_master', query=, 
   fields=[(, None), (, 'bid'), (, None), 
   (, None), (, None), 
   (, None), (, None), 
   (, None), (, None), 
   (, 3L), (, None), 
   (, None), (, None), 
   (, datetime.datetime(2017, 5, 23, 16, 59, 23)), 
   (, None), (, None), 
   (, None), (, None), 
   (, None), (, None), 
   ...])
   Code listing 
   
   1026.
   1027.
   1028.
   1029.
   1030.
   1031.
   
   1032.
   1033.
   1034.
   1035.
   
   except Exception:
   e = sys.exc_info()[1]
   table = self.db[tablename]
   if hasattr(table,'_on_update_error'):
   return table._on_update_error(table,query,fields,e)
   raise e
   
   try:
   return self.cursor.rowcount
   except:
   return None
   
   Variables 
   e
   
   
   ProgrammingError('42000', "[42000] [Microsoft][O...e identity column 
   'id'. (8102) (SQLExecDirectW)")
   
   
   
   
   

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- 

[web2py] Re: grid oncreate

2017-05-23 Thread T.R.Rajkumar
I solved the issue as hinted by Anthony and Dave S. 

In model db.py I added this function

def get_new_amcno():
rows =  db.executesql("exec gen_amcno_new @ucod = 
?,@divcod=?,@sec=?",placeholders=([session.unit,session.divn, 
session.sec]),as_dict=True) 
for i in rows:
amcno = i['amcno']
return amcno

And in table definition for amcno I set the default = get_new_amcno

Now this inserts the new coined amcno in the field.

Thanks Anthony, Dave S

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


[web2py] Re: grid oncreate

2017-05-23 Thread T.R.Rajkumar
The values are for the user. So as soon the user logs in I can find the 
values.

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


[web2py] Re: grid oncreate

2017-05-22 Thread T.R.Rajkumar
The amcno is coined based on the user, his working division, section and 
previous amcno. Also the update_uid is the user who has logged in. As said 
may be the update_dt can be set to default request.now. But how to set 
others which requires calculation?


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


[web2py] grid oncreate

2017-05-22 Thread T.R.Rajkumar
I have this in model.
db.define_table('amc_master',
Field('amcno', 
type='string',length=10,required='True',notnull='True',requires=IS_LENGTH(10)),
Field('unitid',type='string',length=3,notnull='True'),
Field('amcdesc', 
type='string',length=512,required='True',notnull='True'),
Field('estval', type='decimal(18,2)'),
Field('supcflg', type='string', length=1),
Field('supcval',type='decimal(18,2)'),
Field('netestval',type='decimal(18,2)'),
Field('bidmethod',type='string',length=3),
Field('capbud',type='string',length=1),
Field('amcmod',type='string',length=3),
Field('lrrflg',type='string',length=1),
Field('insflg',type='string',length=1),
Field('stflg',type='string',length=1),
Field('phwflg',type='string',length=1),
Field('contyp',type='string',length=3),
Field('rfact',type='decimal(18,2)'),
Field('qfact',type='decimal(18,2)'),
Field('emdamt',type='decimal(18,2)'),
Field('doccharge',type='decimal(18,2)'),
Field('divn',type='string',length=3),
Field('subdivn',type='string',length=2),
Field('cflg',type='string',length=1),
Field('statflg',type='string',length=3),
Field('appauthority',type='string',length=16),
Field('accappddt',type='datetime'),
Field('iewappddt',type='datetime'),
Field('complndays',type='integer'),
Field('examcno',type='string',length=10),
Field('consoldamcstr',type='string',length=70),
Field('isconsold',type='string',length=1),
Field('estonprovn',type='decimal(18,2)'),
Field('totest',type='decimal(18,2)'),

Field('update_uid','string',length=6,required='True',notnull='True'),
Field('update_dt','datetime',required='True',notnull='True')
)

in controller i have this

def newamcmaster():
list_of_fields = 
[db.amc_master.amcdesc,db.amc_master.amcmod,db.amc_master.complndays]
[setattr(f, 'readable', False) for f in db.amc_master if f.name not in 
['amcdesc','amcmod','complndays']]
[setattr(f, 'writable', False) for f in db.amc_master if f.name not in 
['amcdesc','amcmod','complndays']]
grid = 
SQLFORM.grid(db.amc_master,user_signature=False,fields=list_of_fields,oncreate=create_new_amc)
return locals()

when I call http://127.0.0.1:8000/web_ocms/amc/newamcmaster the grid 
displays the three fields amcdesc, amcmod, complndays.

When addrecord is clicked it displays form with the above three fields 
correctly. 

Now the amcno,update_uid, update_dt fields are mandatory but has to be 
filled by the server. The user is not to input these fields.

How to insert a new record with user inputting the three fields and other 
required fields are filled in oncreate callback or some other methods. Pl. 
help. Regards.

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

2017-04-30 Thread T.R.Rajkumar
On Friday, April 28, 2017 at 1:12:24 PM UTC+5:30, T.R.Rajkumar wrote:
> I have  a table in which two fields say amcno and unit are there. Now how to 
> ensure amcno+unitid is unique in dal?

Thank you Pierre, Anthony. I will do as you said. Thank you once again.

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

2017-04-29 Thread T.R.Rajkumar
What is the web2py way of ensuring uniqueness of amcno+unitid composite. 
amcno is not unique, unitid is also not unique but amcno+unitid need to be 
unique. how to ensure that?

On Friday, April 28, 2017 at 1:12:24 PM UTC+5:30, T.R.Rajkumar wrote:
>
> I have  a table in which two fields say amcno and unit are there. Now how 
> to ensure amcno+unitid is unique in dal?
>

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

2017-04-28 Thread T.R.Rajkumar
Yes that is a round about way. dal should allow creation of primary keys. 
This is a requirement in rdbms. In book primary key is said for legacy 
databases with constraints. Can I define the primary key in backend 
database. Will dal not bother about it? Thanks.

On Friday, April 28, 2017 at 1:12:24 PM UTC+5:30, T.R.Rajkumar wrote:
>
> I have  a table in which two fields say amcno and unit are there. Now how 
> to ensure amcno+unitid is unique in dal?
>

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

2017-04-28 Thread T.R.Rajkumar
Thank you Stifan.
I would like to have amcno+unitid to be unique. In dal we can set each 
field to be unique. How to do that for a combination of fields?

On Friday, April 28, 2017 at 1:12:24 PM UTC+5:30, T.R.Rajkumar wrote:
>
> I have  a table in which two fields say amcno and unit are there. Now how 
> to ensure amcno+unitid is unique in dal?
>

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

2017-04-28 Thread T.R.Rajkumar
I have  a table in which two fields say amcno and unit are there. Now how 
to ensure amcno+unitid is unique in dal?

-- 
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: Calling controller from javascript

2017-02-12 Thread T.R.Rajkumar
You can call a controller function from view by using ajax.
The form is generated in controller as below.
TD(INPUT(_id='txt'+str(i+1)+'2',_name='txt'+str(i+1)+'2',value=row.lp_mcod,_style='width:100px;',_onblur='getDescr(this)'))

In the onblur event you call the javascript funciton defined below which in 
turn calls the controller function get_descr and fills element with the 
fetched results. 

function getDescr(e){
var currentId = e.getAttribute('id');  //target.id;
//alert(currentId);
var nextId = currentId.substring(0,4);
var n = parseInt(currentId.substring(4,5));
var rowno = parseInt(currentId.substring(3,4));
//alert(rowno);
n = n + 1;
nextId = nextId + String(n);
nextIdN = '#' + nextId;
//alert(nextId);
currentIdN = '#' + currentId;
//var table = document.getElementById('tblItems');
//var row = table.rows[rowno];
//var tb = row.cells[2].childNodes[0];
//alert(tb.id);
//ajax('get_descr',[currentId],'txtItemh');
//fill_descr(rowno);

   var request = $.ajax({
  url: "/web_lp/lp/get_descr",
  method: "GET",
  data: { mcod : e.value},
  dataType: "text"
});
 
request.done(function( msg ) {
  $( nextIdN ).val( msg );
});
 
request.fail(function( jqXHR, textStatus ) {
  alert( "Request failed: " + textStatus );
});
}

Hope this helps you.



-- 
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: Fullcalendar scheduler

2017-02-09 Thread T.R.Rajkumar
Thank you Richard


-- 
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: Fullcalendar scheduler

2017-02-08 Thread T.R.Rajkumar
@Richard
  I do not know about memory leaks. How to detect a memory leak. 
Thanks for the notice.

On Monday, February 6, 2017 at 1:32:00 AM UTC+5:30, Andrea Fae' wrote:
>
> Someone can help me? Thank you
>
> Any people can tell me how to load from database table resources to show 
> using this add-on?
>
> https://fullcalendar.io/scheduler/
>
> Any suggestion? Thanks a lot
>

-- 
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: Fullcalendar scheduler

2017-02-07 Thread T.R.Rajkumar
You have to add this in view.
 
  


On Monday, February 6, 2017 at 1:32:00 AM UTC+5:30, Andrea Fae' wrote:
>
> Someone can help me? Thank you
>
> Any people can tell me how to load from database table resources to show 
> using this add-on?
>
> https://fullcalendar.io/scheduler/
>
> Any suggestion? Thanks a lot
>

-- 
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: Fullcalendar scheduler

2017-02-07 Thread T.R.Rajkumar
In controller
--
def home():
rows = db(db.cal_events).select()
return dict(rows=rows)

In view


$(document).ready(function() {
$('#calendar').fullCalendar({
aspectRatio: 0.7,
fixedWeekCount: false,
height: "auto",
contentHeight: "auto",
events: [
{{for i,row in enumerate(rows):}}{{if i!=0:}},{{pass}}
{
tip: '{{=row.title}}',
title: '{{=row.title}}',
allDay: false,
start: new Date('{{=row.start_date}}'),
end: new Date('{{=row.end_date}}')
}
{{pass}}
],
eventRender: function(event, element,view) {
if(event.start._d.getMonth() !== 
$('#calendar').fullCalendar('getDate')._d.getMonth()) { 
  return false; // thanks jettpleyn 
http://stackoverflow.com/questions/7628040/remove-past-dates-and-next-months-dates-from-the-current-month
}

element.attr('title', event.tip);
},
dayRender: function (moment, cell) {
/*var m = moment();*/
var day_of_the_week = moment.day();
if  (day_of_the_week == 0)
 cell.css("background-color", "yellow");
else
cell.css("background-color", "linen");
{{for i,row in enumerate(rows):}}
{{if row.lv_type == 'PH':}}
/*cell.css("background-color","yellow");*/
   $('.fc-day[data-date="' + '{{=row.start_date}}' + 
'"]').css('background-color', 'turquoise');
{{pass}}
{{if row.lv_type == 'AH':}}
   $('.fc-day[data-date="' + '{{=row.start_date}}' + 
'"]').css('background-color', '#FF8C8D');
{{pass}}
{{if row.lv_type == 'RH':}}
   $('.fc-day[data-date="' + '{{=row.start_date}}' + 
'"]').css('background-color', '#FF8C8E');
{{pass}}
{{if row.lv_type == 'SS':}}
   $('.fc-day[data-date="' + '{{=row.start_date}}' + 
'"]').css('background-color', 'silver');
{{pass}}
   /*$('td[data-date="' + '{{=row.start_date}}' + 
'"]').addClass('fully_colored_holiday');*/
$('.fc-other-month').html('');
$('.fc-other-month').css("background-color", "linen");
{{pass}}

 }
})
});


Thats all.
On Monday, February 6, 2017 at 1:32:00 AM UTC+5:30, Andrea Fae' wrote:
>
> Someone can help me? Thank you
>
> Any people can tell me how to load from database table resources to show 
> using this add-on?
>
> https://fullcalendar.io/scheduler/
>
> Any suggestion? Thanks a lot
>

-- 
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: static asset management

2016-08-21 Thread T.R.Rajkumar
I hope the question is not clear. The purpose is to reduce band with by 
making the browser store the static css, js files and use them in further 
calls to the page. When version number is changed the browser will again 
fetch the new static files and store them. This is in the book by the 
caption static asset management.
I do as recommended in the book but I am not able to make the browser store 
the file. 
I hope this is clear. Pl.help.

On Wednesday, August 17, 2016 at 5:11:59 PM UTC+5:30, T.R.Rajkumar wrote:
>
> I have in view home.html this
> {{
> response.files.insert(0,URL('static','css/bootstrap.min.css'))
> response.include_files()
> }}
>
> In model I have 
> response.static_version = '1.2.3'
>
> In Apache 2.4 in httpd-vhosts.conf I have
>
> 
> ServerAdmin webmas...@dummy-host.example.com
> DocumentRoot "D:/web2py/applications"
> ServerName localhost:9090
> ServerAlias www.dummy-host.example.com
> #WSGIProcessGroup web2py
> 
> Options Indexes Includes FollowSymLinks
> AllowOverride AuthConfig Limit FileInfo
> Require all granted
>
> 
>
>   
> ErrorLog "logs/error.log"
> CustomLog "logs/access.log" common
> WSGIScriptAlias / "D:/web2py/wsgihandler.py" 
> AliasMatch ^/([^/]+)/static/css/(?:_[\d]+.[\d]+.[\d]+/)?(.*)
> "D:/web2py/applications/$1/static/css/$2"
> 
>
> When I request the page I get this in firefox.
>
> In firefox dev tools I see this
> GET 
> http://172.16.166.102:9090/web_ts2_site/
> *static/_1.2.3/css/bootstrap.min.css* [HTTP/1.1 304 NOT MODIFIED 16ms]
> Headers
> Response
> Cookies
> ConnectionKeep-AliveDateWed, 17 Aug 2016 11:18:37 GMTKeep-Alivetimeout=5, 
> max=99ServerApache/2.4.18 (Win32) OpenSSL/1.0.2e mod_wsgi/4.4.12 
> Python/2.7.5
> Accepttext/css,*/*;q=0.1Accept-Encodinggzip, 
> deflateAccept-Languageen-US,en;q=0.5*Cache-Controlmax-age=0*Connectionkeep-aliveCookie_ga=GA1.1.712052505.1470996245;
>  
> session_id_web_ts2_site=172.16.166.102-c261edeb-458c-4871-be0e-526d0ce3daaf; 
> session_id_admin=172.16.166.102-b49178fd-8596-4dc6-a3d4-723be9c23f67; 
> _gat_awxoapTracker=1Host172.16.166.102:9090If-Modified-SinceWed, 28 Jan 
> 2015 06:06:55 GMTRefererhttp://
> 172.16.166.102:9090/ts2User-AgentMozilla/5.0 (Windows NT 5.1; rv:48.0) 
> Gecko/20100101 Firefox/48.0
>
> As I see the cache-Controlmax-age = 0
> Also the versioning is applied after static but before css folder as in 
> the above url.
> Should the version be necessarily before the file name?
> What should I do to set the max-age 31536 as given in the book. 
> Pl. 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] static asset management

2016-08-17 Thread T.R.Rajkumar
I have in view home.html this
{{
response.files.insert(0,URL('static','css/bootstrap.min.css'))
response.include_files()
}}

In model I have 
response.static_version = '1.2.3'

In Apache 2.4 in httpd-vhosts.conf I have


ServerAdmin webmas...@dummy-host.example.com
DocumentRoot "D:/web2py/applications"
ServerName localhost:9090
ServerAlias www.dummy-host.example.com
#WSGIProcessGroup web2py

Options Indexes Includes FollowSymLinks
AllowOverride AuthConfig Limit FileInfo
Require all granted



  
ErrorLog "logs/error.log"
CustomLog "logs/access.log" common
WSGIScriptAlias / "D:/web2py/wsgihandler.py" 
AliasMatch ^/([^/]+)/static/css/(?:_[\d]+.[\d]+.[\d]+/)?(.*)
"D:/web2py/applications/$1/static/css/$2"


When I request the page I get this in firefox.

In firefox dev tools I see this
GET 
http://172.16.166.102:9090/web_ts2_site/
*static/_1.2.3/css/bootstrap.min.css* [HTTP/1.1 304 NOT MODIFIED 16ms]
Headers
Response
Cookies
ConnectionKeep-AliveDateWed, 17 Aug 2016 11:18:37 GMTKeep-Alivetimeout=5, 
max=99ServerApache/2.4.18 (Win32) OpenSSL/1.0.2e mod_wsgi/4.4.12 
Python/2.7.5
Accepttext/css,*/*;q=0.1Accept-Encodinggzip, 
deflateAccept-Languageen-US,en;q=0.5*Cache-Controlmax-age=0*Connectionkeep-aliveCookie_ga=GA1.1.712052505.1470996245;
 
session_id_web_ts2_site=172.16.166.102-c261edeb-458c-4871-be0e-526d0ce3daaf; 
session_id_admin=172.16.166.102-b49178fd-8596-4dc6-a3d4-723be9c23f67; 
_gat_awxoapTracker=1Host172.16.166.102:9090If-Modified-SinceWed, 28 Jan 
2015 06:06:55 GMTRefererhttp://172.16.166.102:9090/ts2User-AgentMozilla/5.0 
(Windows NT 5.1; rv:48.0) Gecko/20100101 Firefox/48.0

As I see the cache-Controlmax-age = 0
Also the versioning is applied after static but before css folder as in the 
above url.
Should the version be necessarily before the file name?
What should I do to set the max-age 31536 as given in the book. 
Pl. 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: web2py session disable

2016-07-21 Thread T.R.Rajkumar

it should be routes_in = (('/init', '/init', dict(web2py_disable_session=
True))
no square brackets.

On Friday, January 8, 2016 at 4:30:17 PM UTC+5:30, T.R.Rajkumar wrote:
>
> I have in my routes.py in web2py folder the following.
> routes_in = (
>   ('/ts2', '/web_ts2_site/home/home'),
>   
> )
> routes_out = ()
>
> Now I want to disable session for web_ts2_site app. If I add the below it 
> gives error. How to go about that?
>
> routes_in = [('/web_ts2_site', '/web_ts2_site', dict(
> web2py_disable_session=True)]
>
> Thank you for reading.
>

-- 
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: custom authentication

2016-03-20 Thread T.R.Rajkumar
Thank you Val K. I'll try to have my own decorator.

On Saturday, March 19, 2016 at 5:01:11 PM UTC+5:30, T.R.Rajkumar wrote:
>
> I have the username, password, role in legacy SQL server database. In my 
> login from I check the credentials against the above database. Now how to 
> restrict access to controller functions, since I am not using Auth. 
> Pl.guide.
>

-- 
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] custom authentication

2016-03-19 Thread T.R.Rajkumar
I have the username, password, role in legacy SQL server database. In my 
login from I check the credentials against the above database. Now how to 
restrict access to controller functions, since I am not using Auth. 
Pl.guide.

-- 
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: keepvalues - need help with this

2016-01-12 Thread T.R.Rajkumar
But I use FORM and not SQLFORM.

On Saturday, January 11, 2014 at 12:10:07 AM UTC+5:30, Kiran Subbaraman 
wrote:
>
> Hello All,
> The *design *is: I have a custom form with the a controller that 
> inserts/updates a table. Tthe form accepts data, and on successful 
> submission of this form, it stays on the same page (there are no redirects 
> to another page or form)
> *Issue*: The problem am seeing is, when I update values in the form, and 
> submit it, the entered values are lost when the form returns because of 
> successful submit, or due to errors. I have tried to use keepvalues=True in 
> the form.accepts() and form.process() methods. No luck.
> Details below.
>
> Since the page am building has specific design needs, I went with the 
> option of a custom form, where I used the form.custom.* options quite a 
> bit. Therefore input fields in the form look like this
>   id="country" name="country" 
> value="{{=form.custom.inpval['country']}}"
> placeholder="{{=form.custom.comment['country']}}"
>
> Also the controller is coded as below
> x = db(db.x.x_id == auth.user.id).select().first()
> if x:
> form = SQLFORM(db.x, record=x)
> else:
> form = SQLFORM(db.x)
> pass
>
>  
> # process the form
> if form.accepts(request.vars, formname='basicinfo_form', keepvalues=
> True):
> response.flash = 'Basic Information updated successfully.'
> elif form.errors:
> response.flash = 'The submitted form contains errors. The fields 
> in error are highlighted below.'
> else:
> response.flash = 'Please fill the form.'
> pass
>
> return dict(form=form)
>
> I was thinking that maybe I should capture the request.vars and send it 
> back to the view alongwith the form. 
> If the request.vars.country value exists, then I use that, instead of the 
> form.custom.inpval['country']. This only makes the view code a bit more 
> verbose, but if it solves the problem, then nothing like it. 
>
> Can anyone suggest what I could do to sort this out?
> Thank you,
> Kiran
>
> P.S: I did take a look at all the conversations in the forum about 
> keepvalues. None of them seemed to help me. Though I did find this one to 
> be interesting and am curious if this is sorted out already: 
> https://groups.google.com/forum/#!searchin/web2py/keepvalues$20on$20validate/web2py/MNEYo96Shzg/jjKZaMmfAgQJ
>
>

-- 
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: keepvalues - need help with this

2016-01-12 Thread T.R.Rajkumar
I do this
form.process(keepvalues=True,onvalidation=validate_meas).accepted:

and the form retains values on submission.

On Saturday, January 11, 2014 at 12:10:07 AM UTC+5:30, Kiran Subbaraman 
wrote:
>
> Hello All,
> The *design *is: I have a custom form with the a controller that 
> inserts/updates a table. Tthe form accepts data, and on successful 
> submission of this form, it stays on the same page (there are no redirects 
> to another page or form)
> *Issue*: The problem am seeing is, when I update values in the form, and 
> submit it, the entered values are lost when the form returns because of 
> successful submit, or due to errors. I have tried to use keepvalues=True in 
> the form.accepts() and form.process() methods. No luck.
> Details below.
>
> Since the page am building has specific design needs, I went with the 
> option of a custom form, where I used the form.custom.* options quite a 
> bit. Therefore input fields in the form look like this
>   id="country" name="country" 
> value="{{=form.custom.inpval['country']}}"
> placeholder="{{=form.custom.comment['country']}}"
>
> Also the controller is coded as below
> x = db(db.x.x_id == auth.user.id).select().first()
> if x:
> form = SQLFORM(db.x, record=x)
> else:
> form = SQLFORM(db.x)
> pass
>
>  
> # process the form
> if form.accepts(request.vars, formname='basicinfo_form', keepvalues=
> True):
> response.flash = 'Basic Information updated successfully.'
> elif form.errors:
> response.flash = 'The submitted form contains errors. The fields 
> in error are highlighted below.'
> else:
> response.flash = 'Please fill the form.'
> pass
>
> return dict(form=form)
>
> I was thinking that maybe I should capture the request.vars and send it 
> back to the view alongwith the form. 
> If the request.vars.country value exists, then I use that, instead of the 
> form.custom.inpval['country']. This only makes the view code a bit more 
> verbose, but if it solves the problem, then nothing like it. 
>
> Can anyone suggest what I could do to sort this out?
> Thank you,
> Kiran
>
> P.S: I did take a look at all the conversations in the forum about 
> keepvalues. None of them seemed to help me. Though I did find this one to 
> be interesting and am curious if this is sorted out already: 
> https://groups.google.com/forum/#!searchin/web2py/keepvalues$20on$20validate/web2py/MNEYo96Shzg/jjKZaMmfAgQJ
>
>

-- 
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 session disable

2016-01-11 Thread T.R.Rajkumar
@Anthony
Earlier I had this in routes.py

routes_in = (
  ('/ts2', '/web_ts2_site/home/home'),
  [('/web_ts2_site', '/web_ts2_site', dict(web2py_disable_session=True)],

)
routes_out = ()

After your kind question I looked into the error ticket. It reported a 
syntax error near the square bracket.

Then I edited my routes.py to the below.

routes_in = (
  ('/ts2', '/web_ts2_site/home/home'),
  ('/web_ts2_site', '/web_ts2_site', dict(web2py_disable_session=True)),

)
routes_out = ()

Now there is no error and there are no cookies. 

Thank you for the guidance. 



On Friday, January 8, 2016 at 4:30:17 PM UTC+5:30, T.R.Rajkumar wrote:
>
> I have in my routes.py in web2py folder the following.
> routes_in = (
>   ('/ts2', '/web_ts2_site/home/home'),
>   
> )
> routes_out = ()
>
> Now I want to disable session for web_ts2_site app. If I add the below it 
> gives error. How to go about that?
>
> routes_in = [('/web_ts2_site', '/web_ts2_site', dict(
> web2py_disable_session=True)]
>
> Thank you for reading.
>

-- 
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 session disable

2016-01-10 Thread T.R.Rajkumar
For the question Does web2py set automatic cookies reply by Anthony was
There's only the session cookie that gets set automatically (though there 
is one for each app, including the admin app).

If you want to completely disable sessions, including sending the session 
cookie, you can add the following anywhere in your routes.py file:

from gluon.settings import global_settings
global_settings.web2py_disable_session = True

That will disable sessions for all apps. If you want to disable sessions 
for only some apps and you do not rely on the parameter-based rewrite 
system, you can use the pattern-based rewrite system as follows:

routes_in = [('/welcome', '/welcome', dict(web2py_disable_session=True)]

That will add web2py_disable_session to the global environment only for 
requests to the welcome app.

Note, the share.js widget included by default in the footer of the default 
layout.html also sets some cookies, so you would probably want to remove 
that from the layout as well.

Anthony

So i tried that way. Is this not the way?

On Friday, January 8, 2016 at 4:30:17 PM UTC+5:30, T.R.Rajkumar wrote:
>
> I have in my routes.py in web2py folder the following.
> routes_in = (
>   ('/ts2', '/web_ts2_site/home/home'),
>   
> )
> routes_out = ()
>
> Now I want to disable session for web_ts2_site app. If I add the below it 
> gives error. How to go about that?
>
> routes_in = [('/web_ts2_site', '/web_ts2_site', dict(
> web2py_disable_session=True)]
>
> Thank you for reading.
>

-- 
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 session disable

2016-01-08 Thread T.R.Rajkumar
I have in my routes.py in web2py folder the following.
routes_in = (
  ('/ts2', '/web_ts2_site/home/home'),
  
)
routes_out = ()

Now I want to disable session for web_ts2_site app. If I add the below it 
gives error. How to go about that?

routes_in = [('/web_ts2_site', '/web_ts2_site', dict(web2py_disable_session=
True)]

Thank you for reading.

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

2015-09-26 Thread T.R.Rajkumar
Thank you for the reply. I do not know how to code it in a module. Example 
code would be of great help. Is there any example in book? 

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

2015-09-25 Thread T.R.Rajkumar
A list of  employess are retuned by a stored procedure in database. I use 
this in many pages of my app. How to make it DRY? That is I should be able 
to call the procedure may be in a module and use in all my pages. Pl. 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] web2py nginx ubuntu 14.04

2015-03-04 Thread T.R.Rajkumar
I ran the setup-web2py-nginx-uwsgi-ubuntu.sh in a ubuntu 14.04 machine. The 
script ran and webpy, uwsgi, nginx are all running. I am not able to browse 
the sites. The error the server is taking too long to respond appears in 
firefox. I am able to ping the server. Pl. help. Also I want to have 
pyodbc. If I start web2py with rocket server pyodbc is not listed. Pl. 
help. 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: bar chart

2015-02-24 Thread T.R.Rajkumar
Thank you Massimo.

On Saturday, February 21, 2015 at 4:46:34 PM UTC+5:30, T.R.Rajkumar wrote:

 I want to display a bar chart. I went through the book, wiki plugins 
 widget bar chart. I am unable to comprehend the matter. So pl. tell me what 
 I should write in the controller and view to show a bar chart. 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] bar chart

2015-02-21 Thread T.R.Rajkumar
I want to display a bar chart. I went through the book, wiki plugins widget 
bar chart. I am unable to comprehend the matter. So pl. tell me what I 
should write in the controller and view to show a bar chart. 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: update_or_insert error

2014-12-02 Thread T.R.Rajkumar
Thanks Niphlod, I did as you said and it is working nicely. Thank you once 
again for pointing the mistake. 

-- 
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: update_or_insert error

2014-12-01 Thread T.R.Rajkumar
In the error page I find the following in the arguments.

*File F:\trr\web2py\web2py\gluon\dal.py in update_or_insert at line 9380* 
code arguments variables 
 Function argument list 

(self=Table cms_meas_details 
(id,meas_id,agt_no,jcod,...,m_content,remarks,update_uid,update_dt,line_no), 
_key=Query (cms_meas_details.jcod = 'TR001') AND...hift = '1')) AND 
(cms_meas_details.line_no = 1)), **values={'agt_no': '10001', 'jcod': 
'TR001', 'line_no': 1, 'loc_of_work': 'test', 'm_breadth': '', 'm_content': 
'2.000', 'm_depth': '', 'm_length': '', 'm_no': '1.0', 'm_times': '2.0', 
...})


I do not know where to see the generated query. I am a newbie. Thank you 
for the interest shown.


On Friday, November 28, 2014 10:56:16 AM UTC+5:30, T.R.Rajkumar wrote:

 When I do update_or_insert into a table in postgresql I get the following 
 error. My code is below.
 class 'gluon.contrib.pg8000.errors.ProgrammingError' ('ERROR', '42601', 
 'syntax error at or near ')

 if form.process(keepvalues=True,onvalidation=validate_meas).accepted:
 j = 1
 for i in range(1,n+1):#len(l)+1
 if is_number(form.vars['txt%s%s' % (i,9)]):
 db.cms_meas_details.update_or_insert(db(db.
 cms_meas_details.agt_no==session.agt_no)  (db.cms_meas_details.jcod==
 session.jcod)  (db.cms_meas_details.meas_date==session.meas_date)  (db.
 cms_meas_details.shift==session.shift)  (db.cms_meas_details.line_no==j),
 meas_id=m_id,agt_no=session.agt_no,
  jcod=session.jcod,
  meas_date=session.meas_date,
  shift=session.shift,
  loc_of_work=form.vars['txt%s%s' % 
 (i,1)],
  m_no=form.vars['txt%s%s' %(i,2)],
  m_times=form.vars['txt%s%s' %(i,3
 )],
  m_length=form.vars['txt%s%s' %(i,
 4)],
  m_breadth=form.vars['txt%s%s' %(i
 ,5)],
  m_depth=form.vars['txt%s%s' %(i,6
 )],
  mat_code=form.vars['cmbMat%s%s' 
 %(1,7)],
  unit_weight=form.vars['txt%s%s' 
 %(i,8)],
  m_content=form.vars['txt%s%s' %(i
 ,9)],
  remarks=form.vars['txt%s%s' %(i,
 10)],
  update_uid=e34789,
  update_dt=request.now,
  line_no=j)
 j = j + 1


 def is_number(s):   # Thanks a1an 
 http://stackoverflow.com/questions/354038/how-do-i-check-if-a-string-is-a-number-in-python
 try:
 n=str(float(s))
 if n == nan or n==inf or n==-inf : return False
 except ValueError:
 try:
 complex(s) # for complex
 except ValueError:
 return False
 return True

 Is this postgressql error? What should I do?  How to debug and find what 
 is wrong. Pl. 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] update_or_insert error

2014-11-27 Thread T.R.Rajkumar
When I do update_or_insert into a table in postgresql I get the following 
error. My code is below.
class 'gluon.contrib.pg8000.errors.ProgrammingError' ('ERROR', '42601', 
'syntax error at or near ')

if form.process(keepvalues=True,onvalidation=validate_meas).accepted:
j = 1
for i in range(1,n+1):#len(l)+1
if is_number(form.vars['txt%s%s' % (i,9)]):
db.cms_meas_details.update_or_insert(db(db.
cms_meas_details.agt_no==session.agt_no)  (db.cms_meas_details.jcod==
session.jcod)  (db.cms_meas_details.meas_date==session.meas_date)  (db.
cms_meas_details.shift==session.shift)  (db.cms_meas_details.line_no==j),
meas_id=m_id,agt_no=session.agt_no,
 jcod=session.jcod,
 meas_date=session.meas_date,
 shift=session.shift,
 loc_of_work=form.vars['txt%s%s' % (
i,1)],
 m_no=form.vars['txt%s%s' %(i,2)],
 m_times=form.vars['txt%s%s' %(i,3
)],
 m_length=form.vars['txt%s%s' %(i,4
)],
 m_breadth=form.vars['txt%s%s' %(i,5
)],
 m_depth=form.vars['txt%s%s' %(i,6
)],
 mat_code=form.vars['cmbMat%s%s' %(1
,7)],
 unit_weight=form.vars['txt%s%s' %(i
,8)],
 m_content=form.vars['txt%s%s' %(i,9
)],
 remarks=form.vars['txt%s%s' %(i,10
)],
 update_uid=e34789,
 update_dt=request.now,
 line_no=j)
j = j + 1


def is_number(s):   # Thanks a1an 
http://stackoverflow.com/questions/354038/how-do-i-check-if-a-string-is-a-number-in-python
try:
n=str(float(s))
if n == nan or n==inf or n==-inf : return False
except ValueError:
try:
complex(s) # for complex
except ValueError:
return False
return True

Is this postgressql error? What should I do?  How to debug and find what is 
wrong. Pl. 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: Hardcoded Drop Down Menu In Form

2014-11-26 Thread T.R.Rajkumar
Its not INPUT. Its SELECT. See the code below.
def get_shifts():
return [1,2,3,G]


shifts = get_shifts()

form = FORM(TABLE(
  TR('AgtNo:',SELECT(_name='cmbAgtNo',_id='cmbAgtNo', 
requires=IS_NOT_EMPTY(),*[OPTION(str(x.agt_no) + x.work_desc,_value=x.id) 
for x in agts] )),
  TR('Jcod:',SELECT(_name='cmbJcod', _id='cmbJcod', 
requires=IS_NOT_EMPTY(), *[OPTION(x.jcod + '|' + x.job_desc, _value=x.jcod) 
for x in jobs])),
  TR('MeasDate:',INPUT(_type='text', _name='txtMeasDate'
,_id='txtMeasDate', _class='date', requires=IS_NOT_EMPTY() )),
  TR('Shift:',*SELECT*(_name='cmbShift', _id='cmbShift', 
requires=IS_NOT_EMPTY(),*[OPTION(x,_value=x) for x in shifts])),
  TR('',INPUT(_type='submit',_value='CreateMeas'))
  ))re...



On Wednesday, November 26, 2014 5:17:13 AM UTC+5:30, Pablo Cruise wrote:

 I'm a novice Web2py programmer and I've searched the net but can't figure 
 this out.

 I've got a simple webpage with this form:











 *form = FORM(TABLE(TR(TH('BEG PLAN START DATE'), 
 INPUT(_name='begpstrtdt', _class='date', requires=IS_DATE(), _value=t0, 
 _style=width: 100px;)),(TH('END PLAN START DATE'), 
 INPUT(_name='endpstrtdt', _class='date', requires=IS_DATE(), _value=t0, 
 _style=width: 100px;)),TR('Group',INPUT(_name='group', 
 _id='group', , requires=IS_IN_SET(['YES', 'NO']))), 
 TR('Email Results?',INPUT(_name='emailflg', _id='emailflg', 
 _type='checkbox', _value='0')),TR('Show 
 Query?',INPUT(_name='qryflg', _id='qryflg', _type='checkbox', _value='1', 
 _checked=checked,  
 _onclick=if(jQuery('#qryflg').prop('checked')) jQuery('#qryinfo').show(); 
 else jQuery('#qryinfo').hide();)),  TR('Show 
 Debug?',INPUT(_name='dbgflg', _id='dbgflg', _type='checkbox', _value='1', 
 _checked=checked, 
 _onclick=if(jQuery('#dbgflg').prop('checked')) jQuery('#dbginfo').show(); 
 else jQuery('#dbginfo').hide();)),
 TR(INPUT(_type='submit',_value='Submit'))))*


 Everything works except I can't get the Group dropdown, 3rd element, to be 
 a dropdown menu.  It shows up as a text field.

 1. Is there an attribute I'm missing in the description?
 2. How would I get the selected value?

 I've seen many example using SQLFORM but I don't have a need for these 
 fields to be saved or retrieved to/from a database.

 Thanks,
 Paul


-- 
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: second page to be accessed only from first page

2014-11-20 Thread T.R.Rajkumar
Thanks a lot Anthony. It'll be perfect.

On Saturday, November 15, 2014 3:28:15 PM UTC+5:30, T.R.Rajkumar wrote:

 In book chapter 3 overview the following is given to restrict access to 
 second page. 

 if not request.function=='first' and not session.visitor_name:
 redirect(URL('first'))

 But if I print request.function it says 'second'.
 How to restrict access to second page only from first page?




-- 
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: read an excel file stored in session using xlrd

2014-11-20 Thread T.R.Rajkumar
Yes, Anthony I'll do as you said. Thanks once again.

On Tuesday, November 18, 2014 12:06:31 PM UTC+5:30, T.R.Rajkumar wrote:

 form_upload = SQLFORM.factory(Field('your_excel_file', 'upload',
 uploadfolder='helloworld/uploads'))
 if form_upload.process().accepted:
 session.your_excel_file = form.vars.your_excel_file

 def import_from_excel():
 workbook = xlrd.open_workbook(session.your_excel_file)


 When import_from_excel() is called gives rise to the below error.
 How to access excel file stored in session? 

 File F:/trr/web2py/web2py/applications/helloworld/controllers/cms_meas.py 
 http://127.0.0.1:8000/admin/default/edit/helloworld/controllers/cms_meas.py,
  line 255, in import_from_excel
 workbook = xlrd.open_workbook(session.your_excel_file)
   File D:\Python\lib\site-packages\xlrd\__init__.py, line 366, in 
 open_workbook
 formatting_info=formatting_info,
   File D:\Python\lib\site-packages\xlrd\__init__.py, line 725, in __init__
 f = open(filename, open_mode)
 TypeError: coercing to Unicode: need string or buffer, NoneType found






-- 
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: second page to be accessed only from first page

2014-11-18 Thread T.R.Rajkumar
@Anthony Yes the session var is OK. But I would like to see that the second 
page can be visited only after the first page. Keeping the session var 
flags can be troublesome if we have hundreds of pages and the same session 
var gets set in some other page. Is their a way out? The request.function 
seems to be perfect if it stores the first page even inside the second 
action.

On Saturday, November 15, 2014 3:28:15 PM UTC+5:30, T.R.Rajkumar wrote:

 In book chapter 3 overview the following is given to restrict access to 
 second page. 

 if not request.function=='first' and not session.visitor_name:
 redirect(URL('first'))

 But if I print request.function it says 'second'.
 How to restrict access to second page only from first page?




-- 
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: read an excel file stored in session using xlrd

2014-11-18 Thread T.R.Rajkumar
@Anthony Thanks for your kind reply. I don't need to save the file. That's 
why w/o db, session becomes handy. I upload the file in master data page 
having two forms. One form is the SQLFORM.factory for uploading the excel 
file and the other form is to enter the key parameters. When the second 
form is submitted this page redirects to another details page where I would 
like to read the excel file uploaded in the first page and populate the 
html table in the details page. Yes I would like to discard the excel file 
upon reading it. Seeking your valuable guidance.

On Tuesday, November 18, 2014 12:06:31 PM UTC+5:30, T.R.Rajkumar wrote:

 form_upload = SQLFORM.factory(Field('your_excel_file', 'upload',
 uploadfolder='helloworld/uploads'))
 if form_upload.process().accepted:
 session.your_excel_file = form.vars.your_excel_file

 def import_from_excel():
 workbook = xlrd.open_workbook(session.your_excel_file)


 When import_from_excel() is called gives rise to the below error.
 How to access excel file stored in session? 

 File F:/trr/web2py/web2py/applications/helloworld/controllers/cms_meas.py 
 http://127.0.0.1:8000/admin/default/edit/helloworld/controllers/cms_meas.py,
  line 255, in import_from_excel
 workbook = xlrd.open_workbook(session.your_excel_file)
   File D:\Python\lib\site-packages\xlrd\__init__.py, line 366, in 
 open_workbook
 formatting_info=formatting_info,
   File D:\Python\lib\site-packages\xlrd\__init__.py, line 725, in __init__
 f = open(filename, open_mode)
 TypeError: coercing to Unicode: need string or buffer, NoneType found






-- 
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: second page to be accessed only from first page

2014-11-17 Thread T.R.Rajkumar
I am able to visit the second page directly without visiting the first page 
if I have only the request.function. If I add the session var condition 
then it restricts.

On Saturday, November 15, 2014 3:28:15 PM UTC+5:30, T.R.Rajkumar wrote:

 In book chapter 3 overview the following is given to restrict access to 
 second page. 

 if not request.function=='first' and not session.visitor_name:
 redirect(URL('first'))

 But if I print request.function it says 'second'.
 How to restrict access to second page only from first page?




-- 
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] read an excel file stored in session using xlrd

2014-11-17 Thread T.R.Rajkumar
form_upload = SQLFORM.factory(Field('your_excel_file', 'upload',uploadfolder
='helloworld/uploads'))
if form_upload.process().accepted:
session.your_excel_file = form.vars.your_excel_file

def import_from_excel():
workbook = xlrd.open_workbook(session.your_excel_file)


When import_from_excel() is called gives rise to the below error.
How to access excel file stored in session? 

File F:/trr/web2py/web2py/applications/helloworld/controllers/cms_meas.py 
http://127.0.0.1:8000/admin/default/edit/helloworld/controllers/cms_meas.py, 
line 255, in import_from_excel
workbook = xlrd.open_workbook(session.your_excel_file)
  File D:\Python\lib\site-packages\xlrd\__init__.py, line 366, in 
open_workbook
formatting_info=formatting_info,
  File D:\Python\lib\site-packages\xlrd\__init__.py, line 725, in __init__
f = open(filename, open_mode)
TypeError: coercing to Unicode: need string or buffer, NoneType found




-- 
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] second page to be accessed only from first page

2014-11-15 Thread T.R.Rajkumar
In book chapter 3 overview the following is given to restrict access to 
second page. 

if not request.function=='first' and not session.visitor_name:
redirect(URL('first'))

But if I print request.function it says 'second'.
How to restrict access to second page only from first page?


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


  1   2   >