[web2py] Re: How to encrypt password

2021-07-30 Thread isi_jca
Hi everybody:

I was able to solve my problem. 

def validar_password(form):
entered_password = str(form.vars.new_password)
entered_password = entered_password.strip()
new_password = request.vars.new_password

   #Retrieve passwords
rows_password = db(db.thist_password.usrid == 
auth.user_id).select(db.thist_password.password)

for j in rows_password:
#Get digest_alg salt and el hash 
(digest_alg, salt, save_hash) = j.password.split('$')
stored_password = j.password

#Encrypt using the same salt 
new_hash = CRYPT(salt=salt)(new_password)[0]

if stored_password ==  new_hash :
form.errors.new_password = ('You can not repeat password')
break

Regards. 

El miércoles, 28 de julio de 2021 a las 16:36:08 UTC-3, isi_jca escribió:

>
>
> Hello!
>
> I was doing a test.
>
> rows_password = db(db.thist_password.usrid == 
> auth.user_id).select(db.thist_password.password)
> for j in rows_password:
> #Get digest_alg salt, hash and original hash
> (digest_alg, salt, save_hash) = j.password.split('$')
> 
> #Encrypt password
> hash_password = 
> str(CRYPT(digest_alg=digest_alg,key=new_password,salt=salt)('test')[0])
> (digest_alg, salt, new_hash) = hash_password.split('$')
>
> if new_hash ==  save_hash:
> form.errors.new_password = ('You can't repeat password')
> break
>
> But they are different
>
> save_hash: 3e7d5266c03b978652b572be1e781c1ec0c985e6 
> new_hash: 33c3e0c2606b92fadf1f7aac07f77981f5f254bd salt: b5e76116485249e1 
> digest_alg: pbkdf2(1000,20,sha512)
>
> save_hash: 0faac8814c1d26f1456a736634b1666320a19753 
> new_hash: 18a42ab5ab333ab7e21eb7e58591dd5c62885d60 salt: 936f3f68de018365 
> digest_alg: pbkdf2(1000,20,sha512)
>
> save_hash: e90398ceeaf18950bc04229fe3b2e73dc16f9896 
> new_hash: d9ca6c9d67702112b2ca5d3d344bab0aaadde276 salt: 98a1d6f146b1815b 
> digest_alg: pbkdf2(1000,20,sha512)
>
> Anybody have any idea what is wrong?
>
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/aee1a4cb-333f-462c-abea-88f80e35d2e9n%40googlegroups.com.


[web2py] Re: How to encrypt password

2021-07-28 Thread isi_jca


Hello!

I was doing a test.

rows_password = db(db.thist_password.usrid == 
auth.user_id).select(db.thist_password.password)
for j in rows_password:
#Get digest_alg salt, hash and original hash
(digest_alg, salt, save_hash) = j.password.split('$')

#Encrypt password
hash_password = 
str(CRYPT(digest_alg=digest_alg,key=new_password,salt=salt)('test')[0])
(digest_alg, salt, new_hash) = hash_password.split('$')

if new_hash ==  save_hash:
form.errors.new_password = ('You can't repeat password')
break

But they are different

save_hash: 3e7d5266c03b978652b572be1e781c1ec0c985e6 
new_hash: 33c3e0c2606b92fadf1f7aac07f77981f5f254bd salt: b5e76116485249e1 
digest_alg: pbkdf2(1000,20,sha512)

save_hash: 0faac8814c1d26f1456a736634b1666320a19753 
new_hash: 18a42ab5ab333ab7e21eb7e58591dd5c62885d60 salt: 936f3f68de018365 
digest_alg: pbkdf2(1000,20,sha512)

save_hash: e90398ceeaf18950bc04229fe3b2e73dc16f9896 
new_hash: d9ca6c9d67702112b2ca5d3d344bab0aaadde276 salt: 98a1d6f146b1815b 
digest_alg: pbkdf2(1000,20,sha512)

Anybody have any idea what is wrong?

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/b91c9992-61c6-43be-bfee-2a07b6f199d3n%40googlegroups.com.


[web2py] How to encrypt password

2021-07-22 Thread isi_jca
Hello!
I have a historical table where I save  n passwords by users so, I want to 
validate in the next change password that the user don't repeat the 
password. I need to encrypt the password and make a query in historical 
table.
How can I do to encrypt the password in Web2py?

Best 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/0eaedf8b-ef31-4d0d-a87b-dc713ad18c6bn%40googlegroups.com.


[web2py] Re: py4web has now a grid ...

2020-03-11 Thread isi_jca
Dear Massimo:

I was playing with grid, but I only have a blank page. from debugger I get 
this code html









var app=utils.app("vue11d10e4d"); app.start()



/*---Model ---*/
db.define_table('tcliente',
Field('nombre','string',length=70,label = T('Custom')),
Field('nrodoc','string',length=11,label = T('Id Number')))
db.commit()

/*---Controller ---*/
@action("cliente")
@action.uses("cliente.html")
def example_grid():
return dict(grid=publisher.grid(db.tcliente))

/*--Template (cliente.html) --*/

[[extend 'layout.html']]

Clientes
[[=grid]]

What is the problem?

Thanks in advanced, regards.

El domingo, 6 de octubre de 2019, 4:19:07 (UTC-3), Massimo Di Pierro 
escribió:
>
> I do not know. Try check the JS console for errors. Maybe it is missing 
> the js components.
>
> On Sunday, 15 September 2019 14:19:37 UTC-7, isi_jca wrote:
>>
>> Hi!
>>
>> This is output from console and the browser is Google Chrome Versión 
>> 66.0.3359.181 (Build oficial) (64 bits)
>>
>> [jalbornoz@QuoVadis ~]$ ./py4web.sh 
>>
>> ██╗ ██╗   ██╗██╗  ██╗██╗██╗███╗██╗ 
>> ██╔══██╗╚██╗ ██╔╝██║  ██║██║██║██╔╝██╔══██╗
>> ██╔╝ ╚╔╝ ███║██║ █╗ ██║█╗  ██╔╝
>> ██╔═══╝   ╚██╔╝  ╚██║██║███╗██║██╔══╝  ██╔══██╗
>> ██║██║██║╚███╔███╔╝███╗██╔╝
>> ╚═╝╚═╝╚═╝ ╚══╝╚══╝ ╚══╝╚═╝ 
>> It is still experimental...
>>
>> assets-folder: 
>> /home/jalbornoz/py4web-env/lib64/python3.7/site-packages/py4web/assets
>> Choose a one-time dashboad password: 
>> Dashboard is at: http://127.0.0.1:8000/_dashboard
>> [X] loaded _dashboard 
>> [X] loaded _default 
>> [X] loaded MyFirstApp 
>> Bottle v0.12.17 server starting up (using TornadoServer())...
>> Listening on http://127.0.0.1:8000/
>> Hit Ctrl-C to quit.
>>
>> WARNING:tornado.access:404 GET /favicon.ico (127.0.0.1) 1.93ms
>> WARNING:tornado.access:404 GET /_dashboard/static/favicon.ico (127.0.0.1) 
>> 1.59ms
>> WARNING:tornado.access:404 GET /MyFirstApp/static/favicon.ico (127.0.0.1) 
>> 1.18ms
>> WARNING:tornado.access:404 GET /_default/static/favicon.ico (127.0.0.1) 
>> 0.92ms
>> Titulo Grilla
>>
>>
>>
>>
>> El domingo, 15 de septiembre de 2019, 14:13:41 (UTC-3), Massimo Di Pierro 
>> escribió:
>>>
>>> what bowser? any console error? what do you see in the page source?
>>>
>>> On Saturday, 14 September 2019 15:15:18 UTC-7, isi_jca wrote:
>>>>
>>>> Hi Massimo:
>>>>
>>>> When I try the example I only watch a page blank. Why?
>>>>
>>>> Best Regards
>>>>
>>>> El jueves, 12 de septiembre de 2019, 3:31:36 (UTC-3), Massimo Di Pierro 
>>>> escribió:
>>>>>
>>>>> ... it is incomplete. It is experimental. The API is subject to 
>>>>> change. But I could use some community feedback:
>>>>>
>>>>> from py4web.utils.publisher import Publisher, ALLOW_ALL_POLICY
>>>>>
>>>>>
>>>>> # exposes services necessary to access the db via ajax
>>>>> publisher = Publisher(db, policy=ALLOW_ALL_POLICY) 
>>>>>
>>>>>
>>>>> # expose as /examples/grid 
>>>>> @action('grid') 
>>>>> @action.uses('grid.html') 
>>>>> def example_grid(): 
>>>>>  return dict(grid=publisher.grid(db.person)) 
>>>>>
>>>>> embed in template with [[=grid]] in templates/grid.html as in web2py. 
>>>>> The difference from web2py is that the grid communicate with the 
>>>>> server via ajax and the style is in static/components/mtable.html
>>>>> Still does not access authentication based access control but will add 
>>>>> it very soon.
>>>>>
>>>>> You can try it.
>>>>>
>>>>> https://github.com/web2py/py4web/blob/master/apps/examples/__init__.py#L41
>>>>>
>>>>

-- 
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/25348dff-1471-43b9-a764-03846e46317a%40googlegroups.com.


[web2py] Re: py4web grid syntax - needs testers

2019-09-30 Thread isi_jca
Hi! 

Anybody have idea why py4web doesn't translate  the labels?

Best regards


El domingo, 22 de septiembre de 2019, 22:02:16 (UTC-3), isi_jca escribió:
>
> Hi!!!
>
> In models.py, I have this table
>
> db.define_table('tempresa',
> Field('descripcion','string',length=50,label = T('Enterprise')),
> Field('email','string',length=50, label = T('Email')),
> Field('phone','string',length=50, label = T('Phone')),
> Field('estado','reference trestado',label = T('State')),migrate=False)
>
> When I use grid get this string:
>
> { "__class__": "lazyT", "kwargs": {}, "text": "Enterprise", "translator": 
> { "__class__": "method" } } 
> { "__class__": "lazyT", "kwargs": {}, "text": "Email", "translator": { 
> "__class__": "method" } } 
> { "__class__": "lazyT", "kwargs": {}, "text": "Phone", "translator": { 
> "__class__": "method" } } 
> { "__class__": "lazyT", "kwargs": {}, "text": "State", "translator": { 
> "__class__": "method" } }
>
>
> In init.py my script is this.
>
> # exposed as /examples/grid
> @action('empresa_grid', method=['GET','POST'])
> @action.uses('empresa_grid.html',db, session,T)
> def empresa_grid():
> Titulo = T('Enterprise')
> grid=publisher.grid(db.tempresa)
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/f1d8053b-ecb8-4ee5-a30a-20a37e358b32%40googlegroups.com.


[web2py] Re: py4web grid syntax - needs testers

2019-09-22 Thread isi_jca
Hi!!!

In models.py, I have this table

db.define_table('tempresa',
Field('descripcion','string',length=50,label = T('Enterprise')),
Field('email','string',length=50, label = T('Email')),
Field('phone','string',length=50, label = T('Phone')),
Field('estado','reference trestado',label = T('State')),migrate=False)

When I use grid get this string:

{ "__class__": "lazyT", "kwargs": {}, "text": "Enterprise", "translator": { 
"__class__": "method" } } 
{ "__class__": "lazyT", "kwargs": {}, "text": "Email", "translator": { 
"__class__": "method" } } 
{ "__class__": "lazyT", "kwargs": {}, "text": "Phone", "translator": { 
"__class__": "method" } } 
{ "__class__": "lazyT", "kwargs": {}, "text": "State", "translator": { 
"__class__": "method" } }


In init.py my script is this.

# exposed as /examples/grid
@action('empresa_grid', method=['GET','POST'])
@action.uses('empresa_grid.html',db, session,T)
def empresa_grid():
Titulo = T('Enterprise')
grid=publisher.grid(db.tempresa)
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/a483bd50-ef58-446d-b215-9ffe5873e4dd%40googlegroups.com.


[web2py] Re: py4web grid syntax - needs testers

2019-09-16 Thread isi_jca
Hi!!!

1°)
When I try to use 

"A page with an update form example", the console show:

ERROR:root:Traceback (most recent call last):
  File 
"/home/jalbornoz/py4web-env/lib64/python3.7/site-packages/py4web/core.py", 
line 461, in wrapper
ret = func(*func_args, **func_kwargs)
  File 
"/home/jalbornoz/py4web-env/lib64/python3.7/site-packages/py4web/core.py", 
line 427, in wrapper
ret = func(*args, **kwargs)
  File "/home/jalbornoz/apps/examples/__init__.py", line 33, in example_form
form = Form(db.person, id, deletable=False, formstyle=FormStyleBulma)
  File 
"/home/jalbornoz/py4web-env/lib64/python3.7/site-packages/py4web/utils/form.py",
 
line 184, in __init__
(value, error) = field.validate(value)
TypeError: validate() missing 1 required positional argument: 'record_id'

id= 42

2°) The dashboard don't let to edit row on table or create a new row.





-- 
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/26b96605-2f4d-47c4-b431-20eb64b9643a%40googlegroups.com.


[web2py] Re: py4web has now a grid ...

2019-09-14 Thread isi_jca
Hi Massimo:

When I try the example I only watch a page blank. Why?

Best Regards

El jueves, 12 de septiembre de 2019, 3:31:36 (UTC-3), Massimo Di Pierro 
escribió:
>
> ... it is incomplete. It is experimental. The API is subject to change. 
> But I could use some community feedback:
>
> from py4web.utils.publisher import Publisher, ALLOW_ALL_POLICY
>
>
> # exposes services necessary to access the db via ajax
> publisher = Publisher(db, policy=ALLOW_ALL_POLICY) 
>
>
> # expose as /examples/grid 
> @action('grid') 
> @action.uses('grid.html') 
> def example_grid(): 
>  return dict(grid=publisher.grid(db.person)) 
>
> embed in template with [[=grid]] in templates/grid.html as in web2py. 
> The difference from web2py is that the grid communicate with the server 
> via ajax and the style is in static/components/mtable.html
> Still does not access authentication based access control but will add it 
> very soon.
>
> You can try it.
> https://github.com/web2py/py4web/blob/master/apps/examples/__init__.py#L41
>

-- 
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/dbff0519-0dc7-4691-b560-1de6c952b09f%40googlegroups.com.


[web2py] Re: How can I update the record in one table with value entry of another table as soon as the value is entered?

2019-09-05 Thread isi_jca
Hi!!!,

When you made a sale, only must to update the products sold.

For example:

 db(db.product.amount.id = product_id ).update(amount=amount1)


El jueves, 5 de septiembre de 2019, 15:04:57 (UTC-3), mostwanted escribió:
>
> Everything you are saying i understand but I cant put into code, every 
> attempt I have made all day today just went up on traceback-flames! I am 
> recording sales made into the sales db through the buy function:
> def buy():
> if not session.cart:
> session.flash = 'Add something to shopping cart'
> redirect(URL('index'))
> invoice = session.invoiceNo
> total = sum(db.product(id).price*qty for id,qty in session.cart.items
> ())
> for session.key, session.value in session.cart.items():
> db.sales.insert(invoice=invoice,buyer=auth.user.id,product = 
> session.key,quantity = session.value,price = db.product(session.key).price
> )
> 
> session.cart.clear()
> session.flash = 'Sale Complete'
> redirect(URL('invoice',args=invoice))
> return dict(cart=session.cart,form=form,total=total)
>
> My cart doest really do alot,
> def cart():
> if not session.cart:
> session.flash = 'Add something to shopping basket'
> redirect(URL('index'))
> total = sum(db.product(id).price*qty for id,qty in session.cart.items
> ())
> vat=round(total*0, 2)
> totalPrice=total+vat
> session.invoiceNo="".join([random.choice(string.ascii_uppercase)\
>for i in range(4)])+"-"+"".join([random.choice(string.
> digits)\
> for i in range(4)])+
> "-"+"".join([random.choice(string.ascii_uppercase)\
>   
>for i in range(4)])+"-"+"".join([random.choice(string.digits)\
>for i in range(4)])
> 
> #CONVERT TO INTEGER TO BE ABLE TO UTILIZE {{=MoneyFormat()}} FUNCTION
> text=request.vars.name
> if text is None:
> text=int(0)
> if text:
> text=int(request.vars.name)
> change=float(text)-totalPrice
> else:
> change=int(0)
> return dict(cart=session.cart, total=total, totalPrice=totalPrice, vat
> =vat, text=text, change=change, invoiceNo=session.invoiceNo)
>
>
> From what you said I felt if i could identify the sold items in the sale 
> table and match them against the items in the product table and then from 
> there update those that have the same id. As a concept in my head its easy 
> but implementing it goes side ways:
>
> Mostwanted
>
> On Thursday, September 5, 2019 at 8:21:56 AM UTC+2, Dave S wrote:
>>
>>
>>
>> On Wednesday, September 4, 2019 at 10:59:21 PM UTC-7, mostwanted wrote:
>>>
>>> I have a website where I am selling items, what I desperately want to 
>>> achieve is to be able to show the buyers the remaining number of each item. 
>>> I have 2 tables, the table that has all the items being sold & has a field 
>>> amount which is the current number of items in stock and the other 
>>> table which records sales as customers buy and has a field quantity 
>>> which is the quantity of items purchased. After a customer has made a 
>>> purchase I want to be able to subtract quantity from amount and have 
>>> difference update and be the new value for amount.
>>>
>>> I wrote some controller code which is not achieving this, it is instead 
>>> updating the amount field for all items with the same figure.
>>>
>>>
>>> THE VIEW
>>>
>>> {{extend 'layout.html'}}
>>>
>>> 
>>> {{for p in products:}}
>>> {{if p.product_type=="Earrings":}}
>>> 
>>> {{=p.name}}
>>> {{=p.amount}} available in stock
>>> 
>>> {{=MoneyFormat(p.price)}}
>>> 
>>> >> height="200px"/>
>>> 
>>> {{=session.cart.get(p.id,0)}} in cart - {{=A('add to 
>>> cart',callback=URL('cart_callback',vars=dict(id=p.id,action='add')),target='item%s'%p.id,_class='button
>>>  pill')}}
>>> 
>>> Click 
>>> the image to enlarge
>>> 
>>> 
>>> {{pass}}
>>>
>>> {{pass}}
>>> 
>>>
>>>
>>> THE CART_CALLBACK FUNCTION
>>>
>>>
>>> def cart_callback():
>>> id = int(request.vars.id)
>>> if request.vars.action == 'add':
>>> session.cart[id]=session.cart.get(id,0)+1
>>> if request.vars.action == 'sub':
>>> session.cart[id]=max(0,session.cart.get(id,0)-1)
>>> return str(session.cart[id])
>>>
>>>
>>> MY FUNCTION FOR UPDATING AFTER PURCHASES
>>>
>>> def index():
>>> if not auth.user:
>>> response.flash=T('PLEASE LOG IN FIRST TO BE ABLE TO GET THE MENU 
>>> AND BUY')
>>> products = db(db.product).select(orderby=db.product.name)
>>> num=db(db.sale).select()
>>> for n in num:
>>> quantity=n.quantity
>>> if quantity is None:
>>> quantity=0
>>> for p in products:
>>> amount1=p.amount-quantity
>>> db(db.product.amount).update(amount=amount1)
>>> return locals()
>>>
>>>
>>> What should 

[web2py] Re: Connect to Sybase ASE 15.7

2019-04-25 Thread isi_jca
Using Python native module in SDK ASE 16, the connection is sucessful

 import sybpydb
 conn = sybpydb.connect(servername='TEST',user='Myuser', 
password='Pa$$w0rd')
 cur = conn.cursor()
 cur.execute("select succod, sucdesc from mydb..tsucursal")
 while True:
 row = cur.fetchone()
 if (not row):
break
print("%s: %s" % (row[0], row[1]))
 else:
 print('Sucursal',row[0],'Descripcion',row[1])
 cur.close()
conn.close()


/*==*/
>From web2py, I am using 'mssql' intead of 'sybase' because sybase has not 
DSN attribute.

db = DAL('mssql://DSN=SERVERTEST',check_reserved=['all'])
 
  ('42000', "[42000] [SAP][ASE ODBC 
Driver][Adaptive Server Enterprise]Incorrect syntax near '('.\n (102) 
(SQLExecDirectW)")
 Version
 web2py™ Version 2.18.5-stable+timestamp.2019.04.08.04.22.03
 Python Python 2.7.8: C:\Python27\python.exe (prefix: C:\Python27)
 Traceback
 
 Traceback (most recent call last):
   File "C:\web2py\gluon\restricted.py", line 219, in restricted
 exec(ccode, environment)
   File "C:\web2py\applications\StatusWeb\models\db.py", line 98, in 

 auth.define_tables(username=False, signature=False)
   File "C:\web2py\gluon\tools.py", line 2092, in define_tables
 super(Auth, self).define_tables(username, signature, migrate, 
fake_migrate)._table_signature_list
   File "C:\web2py\gluon\authapi.py", line 350, in define_tables
 format='%(first_name)s %(last_name)s (%(id)s)'))
   File "C:\web2py\gluon\packages\dal\pydal\base.py", line 592, in 
define_table
 table = self.lazy_define_table(tablename, *fields, **kwargs)
   File "C:\web2py\gluon\packages\dal\pydal\base.py", line 626, in 
lazy_define_table
 polymodel=polymodel)
   File "C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 798, in 
create_table
 return self.migrator.create_table(*args, **kwargs)
   File "C:\web2py\gluon\packages\dal\pydal\migrator.py", line 281, in 
create_table
 self.adapter.create_sequence_and_triggers(query, table)
   File "C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 881, in 
create_sequence_and_triggers
 self.execute(query)
   File "C:\web2py\gluon\packages\dal\pydal\adapters\__init__.py", line 67, 
in wrap
 return f(*args, **kwargs)
   File "C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 413, in 
execute
 rv = self.cursor.execute(command, *args[1:], **kwargs)
 ProgrammingError: ('42000', "[42000] [SAP][ASE ODBC Driver][Adaptive 
Server Enterprise]Incorrect syntax near '('.\n (102) (SQLExecDirectW)")
 
 Error snapshot help
 
 (('42000', "[42000] [SAP][ASE ODBC 
Driver][Adaptive Server Enterprise]Incorrect syntax near '('.\n (102) 
(SQLExecDirectW)"))
 
 inspect attributes
 Frames
 
 File C:\web2py\gluon\restricted.py in restricted at line 219 code 
arguments variables
 
 File C:\web2py\applications\StatusWeb\models\db.py in  at line 
98 code arguments variables
 
 File C:\web2py\gluon\tools.py in define_tables at line 2092 code 
arguments variables
 
 File C:\web2py\gluon\authapi.py in define_tables at line 350 code 
arguments variables
 
 File C:\web2py\gluon\packages\dal\pydal\base.py in define_table at 
line 592 code arguments variables
 
 File C:\web2py\gluon\packages\dal\pydal\base.py in lazy_define_table 
at line 626 code arguments variables
 
 File C:\web2py\gluon\packages\dal\pydal\adapters\base.py in 
create_table at line 798 code arguments variables
 
 File C:\web2py\gluon\packages\dal\pydal\migrator.py in create_table at 
line 281 code arguments variables
 
 File C:\web2py\gluon\packages\dal\pydal\adapters\base.py in 
create_sequence_and_triggers at line 881 code arguments variables
 
 File C:\web2py\gluon\packages\dal\pydal\adapters\__init__.py in wrap 
at line 67 code arguments variables
 
 File C:\web2py\gluon\packages\dal\pydal\adapters\base.py in execute at 
line 413 code arguments variables
 Function argument list
 
 (self=, *args=('CREATE TABLE 
"auth_user"(\n "id" INT IDENTITY ... NULL,\n "registration_id" VARCHAR(512) 
NULL\n);',), **kwargs={})
 Code listing
 
 
 
 def execute(self, *args, **kwargs):
 command = self.filter_sql_command(args[0])
 handlers = self._build_handlers_for_execution()
 for handler in handlers:
 handler.before_execute(command)
 rv = self.cursor.execute(command, *args[1:], **kwargs)
 for handler in handlers:
 handler.after_execute(command)
 return rv
 
 Variables
 rv undefined
 self 
 args ('CREATE TABLE "auth_user"(\n "id" INT IDENTITY ... NULL,\n 
"registration_id" VARCHAR(512) NULL\n);',)
 self.cursor 
 command 'CREATE TABLE "auth_user"(\n "id" INT IDENTITY ... NULL,\n 
"registration_id" VARCHAR(512) NULL\n);'
 self.cursor.execute 
 kwargs {}
 
 
 

[web2py] Re: How to catch index error

2019-03-19 Thread isi_jca
In this place

def sleep_chart():

response.files.append(URL('e_default','static/js/pygal-tooltips.min.js'))
response.headers['Content-Type']='image/svg+xml'
custom_style = Style(
background='transparent',
plot_background='transparent',
foreground='#53E89B',
foreground_strong='#53A0E8',
foreground_subtle='#630C0D',
opacity='.6',
opacity_hover='.9',
transition='400ms ease-in',
colors=('#E853A0', '#E8537A', '#E95355', '#E87653', '#E89B53')
)
data = db(db.sleep).select()

if data:
 gauge = pygal.SolidGauge(inner_radius=0.70)
 percent_formatter = lambda x: '{:.10g}Hrs'.format(x)
gauge.value_formatter = percent_formatter

 gauge.add('Awake', [{'value':[i.awake for i in data][-1], 
'max_value': 24}])
 gauge.add('Light Sleep', [{'value':[i.light_sleep for i in 
data][-1], 'max_value': 24}])
 gauge.add('Deep Sleep', [{'value':[i.deep_sleep for i in 
data][-1], 'max_value': 24}])
return gauge.render()





El martes, 19 de marzo de 2019, 14:57:35 (UTC-4), Maurice Waka escribió:
>
> I have a code that works OK except when there is no data in the database.
> Here is the code, using MongoDB.
> model code:
>
> db.define_table('sleep',
> Field('awake','double',default=0),
> Field('light_sleep','double',default=0),
> Field('deep_sleep','double',default=0),
> Field('author', 'reference auth_user', 
> default=auth.user_id, readable=False, writable=False),
> common_filter = lambda query: db.sleep.author == 
> auth.user_id)
>
> def sleep_chart():
> 
> response.files.append(URL('e_default','static/js/pygal-tooltips.min.js'))
> response.headers['Content-Type']='image/svg+xml'
> custom_style = Style(
> background='transparent',
> plot_background='transparent',
> foreground='#53E89B',
> foreground_strong='#53A0E8',
> foreground_subtle='#630C0D',
> opacity='.6',
> opacity_hover='.9',
> transition='400ms ease-in',
> colors=('#E853A0', '#E8537A', '#E95355', '#E87653', '#E89B53')
> )
> data = db(db.sleep).select()
> gauge = pygal.SolidGauge(inner_radius=0.70)
> percent_formatter = lambda x: '{:.10g}Hrs'.format(x)
> gauge.value_formatter = percent_formatter
>
> gauge.add('Awake', [{'value':[i.awake for i in data][-1], 'max_value': 
> 24}])
> gauge.add('Light Sleep', [{'value':[i.light_sleep for i in data][-1], 
> 'max_value': 24}])
> gauge.add('Deep Sleep', [{'value':[i.deep_sleep for i in data][-1], 
> 'max_value': 24}])
> return gauge.render()
>
> def mySleep():
> chart= URL('default', 'sleep_chart')
> form = SQLFORM(db.sleep, submit_button=T('Submit')).process()
> return dict(chart = chart,form=form)
>
> Here is the problem:
>
> When a new user registers into the system, by default, there is no data 
> recorded in the database, so I get the error(see attached) below.
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
>  Traceback (most recent call last):
>  File "/home/mau/web2py/gluon/restricted.py", line 219, in restricted
>  exec(ccode, environment)
>  File "/home/mau/web2py/applications/Hesty/controllers/e_default.py" 
> 
> , line 708, in 
>  File "/home/mau/web2py/gluon/globals.py", line 421, in 
>  self._caller = lambda f: f()
>  File "/home/mau/web2py/gluon/tools.py", line 3868, in f
>  return action(*a, **b)
>  File "/home/mau/web2py/applications/Hesty/controllers/e_default.py" 
> 
> , line 649, in sleep_chart
>  gauge.add('Awake', [{'value':[i.awake for i in data][-1], 'max_value': 24
> }])
> IndexError: list index out of range
>
>
> Expectation:I want to have a default figure in the database. I have tried 
> having "default=0" but the int only appears in the form text area. So the 
> error persists.
> Is there a way to have a default figure in the database or a way to catch 
> this errors and let the new user to input int figure?
>
>

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


[web2py] How to show log event while form is submitted

2019-03-17 Thread isi_jca
Hi,

I have a form, when I click on submit button it is start processing and 
saving data (events) in table tlogproceso:

Controller

def fprocess ():

form = SQLFORM.factory (Field ('filename', 'upload', uploadfolder = 
os.path.join (request.folder, 'uploads'), label = 'DB file'))
if form.process (). accepted:
   db.tlogprocess.insert (date = datetime.datetime.now (), 
description = 'Start loading the dbf file.')
   ...
...
   db.tlogprocess.insert (date = datetime.datetime.now (), 
description = 'reading dbf file.')
...
...
   db.tlogproceso.insert (date = datetime.datetime.now (), 
description = 'Inserting data.')
...
...
   db.tlogproceso.insert (date = datetime.datetime.now (), 
description = 'Updating data.')
...
...
   db.tlogproceso.insert (date = datetime.datetime.now (), 
description = 'End of the process.')

 return locals ()

def showlogevent ():
 rows = db (db.tlogprocess.pid == 12) .select ()
 return locals ()

-- -

View (fprocesa.hmtl)

{{extend 'layout.html'}}
 My process 
{{= form}}

 Vitacora 
{{= LOAD ('default', 'showlogevent.load', ajax = True)}}


View (showlogevent.load)

{{for row in rows:}}

  date and time: {{= row.fecha}} {{= row.descripcion}}

{{pass}}


This way only when the process is finished, it shows the data. Is possible 
show data from tlogproceso while form is processing ?.

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: ¿How to show in comment property string from a function?

2018-12-17 Thread isi_jca
Dave:

Dave, thanks for your time. The data is contained in another table and I 
want it to be shown by means of a tooltip. Should I use jquery in this 
case?.

Regards.



El viernes, 14 de diciembre de 2018, 18:37:28 (UTC-5), Dave S escribió:
>
>
>
> On Friday, December 14, 2018 at 1:52:54 PM UTC-8, isi_jca wrote:
>>
>> Hi!
>>
>> Is possible to get data (a string) in this mammer?
>>
>>
>> tpaciente.idarticulo.comment= lambda row : myfunction(row.idarticulo)
>>
>> In the grid form from view, it is show " at 
>> 0x7f604fce2aa0>"
>>
>> Can anybody help me?.
>>
>> Thanks in advanced.
>>
>
> Perhaps you could provide a little more description of what you are trying 
> to do.
>
> Do you want the comment to be displayed after the rest of the page 
> (including the grid) is rendered?
> Then you'd probably want to do a jQuery action.
>
> If the comment is being looked up in a table, and that table is different 
> from the rest of the grid's table, you can probably do a join and use the 
> results of the join in the grid call.
>
> if the string is being computed from user input [perhaps after the grid is 
> rendered], you probably are back to a jQuery action.
>
> /dps
>
> A typical controller function (such as myapp/controllers/default.py ... 
> def index())
> can return a string a basic view will render it as body 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] ¿How to show in comment property string from a function?

2018-12-14 Thread isi_jca
Hi!

Is possible to get data (a string) in this mammer?


tpaciente.idarticulo.comment= lambda row : myfunction(row.idarticulo)

In the grid form from view, it is show " at 
0x7f604fce2aa0>"

Can anybody help me?.

Thanks in advanced.

-- 
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: Connect to Sybase ASE 15.7

2018-11-02 Thread isi_jca
Hi!!!

I get this message when try to connect at sybase (ASE)

Ticket ID

127.0.0.1.2018-11-02.16-39-39.0e1ecf1e-e9a8-4950-893f-e3c2b7a98b0b
 Failure to connect, tried 5 times: 
Traceback (most recent call last): 
File "c:\web2py\gluon\packages\dal\pydal\base.py", line 455, in __init__ 
self._adapter = adapter(**kwargs) 
File "c:\web2py\gluon\packages\dal\pydal\adapters\__init__.py", line 40, in 
__call__ obj = super(AdapterMeta, cls).__call__(*args, **kwargs) 
File "c:\web2py\gluon\packages\dal\pydal\adapters\mssql.py", line 31, in 
__init__ driver_args, adapter_args, do_connect, after_connection) 
File "c:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 369, in 
__init__ super(SQLAdapter, self).__init__(*args, **kwargs) 
File "c:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 53, in 
__init__ self.reconnect() 
File "c:\web2py\gluon\packages\dal\pydal\connection.py", line 152, in 
reconnect self.connection = self.connector() 
File "c:\web2py\gluon\packages\dal\pydal\adapters\mssql.py", line 184, in 
connector return self.driver.connect(self.dsn, **self.driver_args) 
Error: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name 
not found and 
no default driver specified (0) (SQLDriverConnect)')

Version
web2py™ Version 2.17.2-stable+timestamp.2018.10.06.18.54.02


I made this test using:


db = 
DAL('sybase://myuser:Pa$$w0rd@myserver/mydatabase',check_reserved=['all'])
db = 
DAL('sybase://myuser:Pa$$w0rd@myserver:5000/mydatabase',check_reserved=['all'])
db = DAL('sybase://myuser:Pa$$w0rd@/mydatabase',check_reserved=['all'])
db = 
DAL('sybase://myuser:Pa$$w0rd@:5000/mydatabase',check_reserved=['all'])

But in all case web2py show the same message. What is the problem?.

Thanks in advance.

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


Re: [web2py] Re: qrcode

2018-10-25 Thread isi_jca
Hi!!!

I solved the problem 
using reportlab https://www.reportlab.com/docs/reportlab-userguide.pdf

Look at this 
examples, http://www.web2pyslices.com/slice/show/1562/pdf-with-reportlab
http://www.web2pyslices.com/slice/show/1564/pdf-with-reportlab-ii

Regards.

El viernes, 12 de octubre de 2018, 4:27:29 (UTC-3), Jorge Luis Hernández 
Dueñas escribió:
>
> Hi, I have the same error, I try to save a qr image and I have tried it in 
> many ways but it keeps giving me error. Please, if you solved it, it would 
> be very helpful for me.
>
> El sábado, 23 de julio de 2016, 7:05:49 (UTC-5), isi_jca escribió:
>>
>>
>> Hi!!!.
>>>
>>>
>> When I try to print qrcode image to pdf using pyfpdf, I get the next 
>> error:
>>
>>  FPDF error: Unsupported image type: 
>> pilimage object at 0x7f2e82f13a50>
>>
>> Versión
>> web2py™ Version 2.14.5-stable+timestamp.2016.04.14.03.26.16
>> Python Python 2.7.6: /usr/bin/python (prefix: /usr)
>>  
>> Anyone have experience with this topic?
>>
>> 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: Set password to user programmatically

2018-10-17 Thread isi_jca
I was able to solve my problem in this way

  ls_psswrd=db.auth_user.password.validate(ls_password)[0]
  db(db.auth_user.username == ls_user).update(password = ls_psswrd)

I was reading this 
link: https://groups.google.com/forum/#!msg/web2py/8W0zV523HHw/jGRiv9KOISMJ

Regards.


El miércoles, 17 de octubre de 2018, 11:59:15 (UTC-3), isi_jca escribió:
>
> I was reading documentation in this link 
> https://web2py.readthedocs.io/en/latest/_modules/gluon/tools.html#Auth.get_or_create_user
>
> What is wrong?.
>
>
>
>
> El miércoles, 17 de octubre de 2018, 9:02:36 (UTC-4), isi_jca escribió:
>>
>> Dave:
>>
>> Thanks for your time, I was trying with this other script
>>
>> keys = {'username':ls_user,'password':ls_password}
>> ls_result = auth.get_or_create_user(keys)
>>
>> But then when the user try to login It failed.
>>
>> Regards.
>>
>>
>>
>> El martes, 16 de octubre de 2018, 17:09:30 (UTC-4), Dave S escribió:
>>>
>>>
>>>
>>> On Tuesday, October 16, 2018 at 2:00:03 PM UTC-7, isi_jca wrote:
>>>>
>>>> Hello everybody:
>>>>
>>>> Is possible to write this script:
>>>>
>>>> db(db.auth_user.email == ls_user).update(password = 
>>>> db.auth_user.password.validate(ls_password))
>>>>
>>>> ?
>>>>
>>>> I want to set a new password for special user. I don't want to use a 
>>>> form.
>>>>
>>>> Regards, thanks in advanced.
>>>>
>>>
>>> You can start from here, but my results have varied.
>>>
>>> https://groups.google.com/d/msg/web2py/MxOgZIk3avc/0ioJTbTLAAAJ>
>>> (sorry, the linked post has a link to another post)
>>>
>>> /dps
>>>  
>>>
>>

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


[web2py] Re: Set password to user programmatically

2018-10-17 Thread isi_jca
I was reading documentation in this link 
https://web2py.readthedocs.io/en/latest/_modules/gluon/tools.html#Auth.get_or_create_user

What is wrong?.




El miércoles, 17 de octubre de 2018, 9:02:36 (UTC-4), isi_jca escribió:
>
> Dave:
>
> Thanks for your time, I was trying with this other script
>
> keys = {'username':ls_user,'password':ls_password}
> ls_result = auth.get_or_create_user(keys)
>
> But then when the user try to login It failed.
>
> Regards.
>
>
>
> El martes, 16 de octubre de 2018, 17:09:30 (UTC-4), Dave S escribió:
>>
>>
>>
>> On Tuesday, October 16, 2018 at 2:00:03 PM UTC-7, isi_jca wrote:
>>>
>>> Hello everybody:
>>>
>>> Is possible to write this script:
>>>
>>> db(db.auth_user.email == ls_user).update(password = 
>>> db.auth_user.password.validate(ls_password))
>>>
>>> ?
>>>
>>> I want to set a new password for special user. I don't want to use a 
>>> form.
>>>
>>> Regards, thanks in advanced.
>>>
>>
>> You can start from here, but my results have varied.
>>
>> https://groups.google.com/d/msg/web2py/MxOgZIk3avc/0ioJTbTLAAAJ>
>> (sorry, the linked post has a link to another post)
>>
>> /dps
>>  
>>
>

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


[web2py] Re: Set password to user programmatically

2018-10-17 Thread isi_jca
Dave:

Thanks for your time, I was trying with this other script

keys = {'username':ls_user,'password':ls_password}
ls_result = auth.get_or_create_user(keys)

But then when the user try to login It failed.

Regards.



El martes, 16 de octubre de 2018, 17:09:30 (UTC-4), Dave S escribió:
>
>
>
> On Tuesday, October 16, 2018 at 2:00:03 PM UTC-7, isi_jca wrote:
>>
>> Hello everybody:
>>
>> Is possible to write this script:
>>
>> db(db.auth_user.email == ls_user).update(password = 
>> db.auth_user.password.validate(ls_password))
>>
>> ?
>>
>> I want to set a new password for special user. I don't want to use a form.
>>
>> Regards, thanks in advanced.
>>
>
> You can start from here, but my results have varied.
>
> https://groups.google.com/d/msg/web2py/MxOgZIk3avc/0ioJTbTLAAAJ>
> (sorry, the linked post has a link to another post)
>
> /dps
>  
>

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


[web2py] Set password to user programmatically

2018-10-16 Thread isi_jca
Hello everybody:

Is possible to write this script:

db(db.auth_user.email == ls_user).update(password = 
db.auth_user.password.validate(ls_password))

?

I want to set a new password for special user. I don't want to use a form.

Regards, thanks in advanced.

-- 
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] Webservice using JWT

2018-10-03 Thread isi_jca
Hi Everybody!!

I am trying to use webservice and Jason Web Token 


I have this controller: webservice.py

from gluon.tools import AuthJWT
myjwt = AuthJWT(auth, 
secret_key='my_especial_key',algorithm='HS512',user_param="email")
myjwt.verify_expiration = False

def login_take_token():
return myjwt.jwt_token_manager()


@myjwt.allows_jwt()
def call():
session.forget()
return service()

@service.run
def myfuncion(nrodoc,sexo):
   ...
   ...
   return data


1°) cuando invoco a 
https://www.misitio.com.ar/myapp/webservice/login_take_token?email=usuario=12345678

I got a token

2°) How to use a token in
https://www.misitio.com.ar/myapp/webservice/call/run/myfuncion/41414141  ?

Thanks in advanced.

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


[web2py] How to hide parameter in link using url

2018-08-02 Thread isi_jca
Hi

When redirecting using  href=URL('abmpersona','ficha',args=(ls_verificador) 
from a controller

I get this link

https://www.dominio.com.ar/miapp/abmpersona/ficha/8630002323323238310


How can I hide this parameter (8630002323323238310)?. Is there 
another mechanism that I can use?.

Thanks and greetings

-- 
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: Send args from a button in views

2018-05-24 Thread isi_jca


Matthew:

Look at the example in the attached file

Regards




El jueves, 24 de mayo de 2018, 10:46:05 (UTC-3), Matthew J Watts escribió:
>
> Hi all
>
> How do i  send args via a button from views. 
>
> For example, i'd like to send variables to the 'my_collections URL'  {{=A(
> 'Finish',_href=URL('my_collections'),_class="btn btn-primary")}}
>
> I can do something similar from the grid in a controller, however i cant 
> find the right way to it from a button in views
>
> links = [lambda row: A('Select', _class="btn 
> btn-primary",_href=URL('my_collections'),
>  
> vars={'collection_info_id': collection_info_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.
def displaydata():
lid_data =  int(request.vars['id_data'])




def updatefamiliar(row,otherparameter):
li_id = row.id
li_tipodoc   = row.tipodoc
if li_tipodoc < 4 and otherparameter:
btn = A(I(_class='glyphicon glyphicon-retweet',_alt='MyData'),
_title='Data',
_href=URL('default', 
'displaydata',vars={'id_data':li_tipodoc}),
_class='button btn btn-default')
return btn



def my_grid():
...
...
grid=SQLFORM.grid(query,field_id = my.id,...,  links=[lambda r: 
showdata(r,otherparameter)])
...
...
   return locals()


[web2py] Re: it's possible to use Autocomplete widget in SQLFORM.grid ?

2018-05-24 Thread isi_jca
Sandeep:

Look at this link: 
http://web2py.com/books/default/chapter/29/07/forms-and-validators?search=autocomplete#Autocomplete-widget

Regards

El lunes, 21 de mayo de 2018, 9:37:40 (UTC-3), Sandeep Patel escribió:
>
> Hello,
> Can anyone, let me know how to work Autocomplete widget with SQLFROM.grid 
> in the search filed. I have used Autocomplete widget in SQLFROM that's work 
> fine but in the grid, nothing in happen.
>
>
> Please give me some direction how to do that.
>
>
> Thank's
> Sandeep
>
>

-- 
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: Creating a dropdown form for linked tables

2017-06-12 Thread isi_jca
Hi!!!

Look at in this 
link http://www.web2pyslices.com/slice/show/1410/cascading-drop-down-lists

-- 
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: not web2py related but this is free now

2017-05-30 Thread isi_jca
Thanks a lot and best 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-30 Thread isi_jca
T.R.Rajkumar

Try setting this value:

*field_id* must be the field of the table to be used as ID, for example 
db.mytable.id. This is useful when the grid query is a join of several 
tables. Any action button on the grid(add record, view, edit, delete) will 
work over db.mytable.


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: Autocomplete How to search in midle of string

2017-05-12 Thread isi_jca
Hi!!!

Reading in 
http://web2py.readthedocs.io/en/latest/_modules/gluon/sqlhtml.html I 
discovered this parameter "at_beginning" when it is setting in false it is 
possible to search in middle of the string.

Example:

db.tpersona.idprovincia.widget = SQLFORM.widgets.autocomplete(request, 
db.trprovincia.descripcion, id_field=db.trprovincia.id, limitby=(0,20), 
min_length=2, at_beginning = False)

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] Autocomplete How to search in midle of string

2017-05-10 Thread isi_jca
Hi!!!

1°) I am using autocomplete widget in this manner

db.tpersona.idprovincia.widget = SQLFORM.widgets.autocomplete(request, 
db.trprovincia.descripcion,
  id_field=
db.trprovincia.id, limitby=(0,20), min_length=2 )

This works, but I would like searching in midle of string, for example  in 
descripcion= "Santa Cruz" when I am typing 'Cru', the widget would must 
show "Santa Cruz". Any suggestion?

2°) Also I was triying the next receipe: 
http://www.web2pyslices.com/slice/show/1391/jquery-autocomplete-widget

response.files.append(URL(r=request,c='static/jquery-autocomplete',f='jquery.autocomplete.js'))
response.files.append(URL(r=request,c='static/jquery-autocomplete',f='jquery.autocomplete.css'))

def get_items():
itms = []
if request.vars.q and request.vars.table and request.vars.field:
q = request.vars.q
f = request.vars.field
t = request.vars.table
fld = db[t][f]
rows = 
db(fld.upper().like("%"+q.upper()+"%")).select(fld,distinct=True) 
itms = [str(t[f]) for t in rows] 
return '\n'.join(itms)

def autocomplete_widget(f,v):
import uuid

d_id = "autocomplete-" + str(uuid.uuid4())[:8]
get_url = URL(r=request,c='default',f='get_items')
wrapper = DIV(_id=d_id)
inp = SQLFORM.widgets.string.widget(f,v)
scr = SCRIPT('jQuery("#%s 
input").autocomplete("%s",{extraParams:{field:"%s",table:"%s"}});' % \
  (d_id, get_url,f.name,f._tablename))


wrapper.append(inp)
wrapper.append(scr)
return wrapper

def abmpersona():
query = (db.tpersona.id > 0)

db.tpersona.idprovincia.widget = 
autocomplete_widget(db.trprovincia.descripcion,db.trprovincia.id)

grid = SQLFORM.grid(query,field_id = db.tpersona.id)
return locals()


*But I get  ticket:*

Error ticket for "Tester"
Ticket ID
127.0.0.1.2017-05-10.08-44-36.08989307-1cf8-4970-b9d8-632c417c8ab8

 'DIV' object is not callable

Versión
web2py™ Version 2.14.6-stable+timestamp.2016.05.10.00.21.47
Python Python 2.7.13: /usr/bin/python (prefix: /usr)
Rastreo
14.
Traceback (most recent call last):
  File "/home/jalbornoz/web2py/gluon/restricted.py", line 227, in restricted
exec ccode in environment
  File "/home/jalbornoz/web2py/applications/Tester/controllers/default.py", 
line 99, in 
  File "/home/jalbornoz/web2py/gluon/globals.py", line 417, in 
self._caller = lambda f: f()
  File "/home/jalbornoz/web2py/applications/Tester/controllers/default.py", 
line 96, in abmpersona
grid = SQLFORM.grid(query,field_id = db.tpersona.id)
  File "/home/jalbornoz/web2py/gluon/sqlhtml.py", line 2303, in grid
create_form = SQLFORM(table, **sqlformargs)
  File "/home/jalbornoz/web2py/gluon/sqlhtml.py", line 1286, in __init__
inp = field.widget(field, default)
TypeError: 'DIV' object is not callable
Error snapshot  help
('DIV' object is not callable)

Any idea why this error is generated?

*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: Query auth_user over first and last names in one query

2017-03-09 Thread isi_jca
Jim:

In the next expression

query = db((db.auth_user == name) or (db.auth_user == lastname)).select()

Replace "or" by "|" (pipe)

query = db((db.auth_user == name) | (db.auth_user == lastname)).select()

Regards.

El miércoles, 8 de marzo de 2017, 1:00:04 (UTC-3), Jim S escribió:
>
> Hi
>
> I have a search form where the user types in generic search text.  I want 
> to be able to return to them a list of matching users.
>
> Sample Data
>
>   First   Last
> - --  --
> 1 Jim Sanders
> 2 BillVan Der Wall
> 3 JohnSt James
> 4 Peter   Williams
> 5 Jim Hensen
> 6 JohnAdams
> 7 William Tell
> 8 AdamJohnson
>  
>
> Based on the data entered in the search box, these records should be 
> returned
>
>   
>   Search Text  Rows Returned
> -  --
> 1 Jim  1, 5
> 2 John 3, 6, 8
> 3 Adam 6, 8
> 4 Bill 2
> 5 Jim Sanders  1
> 6 Adam John8
> 7 John St James3
>  
>
> I can't seem to come up with a query or anything to make this happen. 
>  With SQL I might to this:
>
> 'SELECT * FROM auth_user WHERE first_name LIKE \'%s*\' OR last_name LIKE 
> \'%s*\' OR concat(first_name, ' ', last_name) LIKE \'%s*\'' % (search_text, 
> search_text, search_text)
>
> But, I want to build this as a query for SQLFORM.grid.  
>
> Anyone have any ideas?
>
> -Jim
>
>

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


Re: [web2py] Re: qrcode

2016-07-23 Thread isi_jca


> Hi!!!.
>
>
When I try to print qrcode image to pdf using pyfpdf, I get the next error:

 FPDF error: Unsupported image type: 
pilimage object at 0x7f2e82f13a50>

Versión
web2py™ Version 2.14.5-stable+timestamp.2016.04.14.03.26.16
Python Python 2.7.6: /usr/bin/python (prefix: /usr)
 
Anyone have experience with this topic?

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.


Re: [web2py] Re: Want to add Confirmation on link in sqlform.grid

2016-07-20 Thread isi_jca
Hi!!!

In this manner, works the link:

links = [lambda row: A('Club call',_onclick="if(confirm('Do you want to 
club this call?')) document.location='%s'; return false;" % 
URL("","Incident",args=[row.id]))]

Regards.


El lunes, 13 de mayo de 2013, 9:11:10 (UTC-3), Pawan Jha escribió:
>
> not working frnd i have done changes as per you are given me its not 
> working
>
>
> On Mon, May 13, 2013 at 5:18 PM, Massimo Di Pierro  > wrote:
>
>> links = [lambda row: A('Club call',_onclick="if(confirm('Do you want to 
>> club this call')) document.location='%s'; return false;' % URL("","
>> Incident",args=[row.id])]
>>
>> On Monday, 13 May 2013 00:56:27 UTC-5, Pawan Jha wrote:
>>>
>>> Hi all 
>>>
>>> I am using this in SQLFORM.grid 
>>>
>>> here is confirm message but on clicking this Message is coming but when 
>>> i am clicking on no the its refresh the pages 
>>>
>>> so please tell me how will i prevent this 
>>>
>>>  links = [lambda row: A('Club call',_onclick="confirm('Do you want to 
>>> club this call')",_href=URL("","Incident",args=[row.id]))]
>>>
>> -- 
>>  
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>
>
> -- 
>
>
>
> *   Thanks  &  RegardsPawan Kr. 
> Pankaj91-9968831967/9540773888**Software 
> Engineer (DOT .Net)*
>  pawan.p an...@agnicient.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: Want to add Confirmation on link in sqlform.grid

2016-07-20 Thread isi_jca


El lunes, 13 de mayo de 2013, 2:56:27 (UTC-3), Pawan Jha escribió:
>
> Hi all 
>
> I am using this in SQLFORM.grid 
>
> here is confirm message but on clicking this Message is coming but when i 
> am clicking on no the its refresh the pages 
>
> so please tell me how will i prevent this 
>
>  links = [lambda row: A('Club call',_onclick="confirm('Do you want to club 
> this call')",_href=URL("","Incident",args=[row.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: How can I keep the user input value in form after user submit the form?

2016-07-06 Thread isi_jca
Hi!!!

http://web2py.com/books/default/chapter/29/07/forms-and-validators#keepvalues


Sometime you want an insert form that, upon submission and after the 
insert, retains the preceding values to help the user insert a new record. 
This can be done:

db=SQLDB('sqlite://db.db')
db.define_table('user', SQLField('name','string'))

And in controller

def test():
form=SQLFORM(db.user)
if form.accepts(request.vars,session,keepvalues=True):
response.flash="record inserted"
return dict(form=form)

Notice the keepvalues=True argument of the accepts method.


http://www.web2py.com/AlterEgo/default/show/46


Regards.

El miércoles, 6 de julio de 2016, 17:38:49 (UTC-3), Jing Lu escribió:
>
> Dear Web2Py developers,
>
> Is there any way that I can keep the user input value in the form using 
> SQLFORM?
>
>
>
> Thanks,
> Jing 
>

-- 
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: reading values from request.vars

2016-07-02 Thread isi_jca
Hi!!!

Try using

ajax('{{=URL('insert_data')}}',['opt1','opt2','opt3','txtt1'],':eval');



Regards


El viernes, 1 de julio de 2016, 17:06:06 (UTC-3), Dave S escribió:
>
>
>
> On Friday, July 1, 2016 at 10:47:22 AM UTC-7, ktesr...@gmail.com wrote:
>>
>> Anthony,
>>
>> can you share if you have any examples. how can I keep track of that 
>> index as I am not finding any example to get count of request.vars
>>
>> vars: > '9'], 'txt1': ['1', '15']}>
>> in this case I have four vars coming from browser which I should insert 
>> to database request.vars.opt1, request.vars.opt2, request.vars.opt3 and 
>> request.vars.txt1
>>
>> when I iterate loop for first time I should insert 3,12,1,1 as one record 
>> and 2nd time it should insert 3,18,9,15 and so on based on data entry form
>>
>> In the above case there are 2 records but sometimes it can be more than 2 
>> like -> vars: > ','21'], 'opt3': ['1', '9','12'], 'txt1': ['1', '15','27']}>
>>
>>
>>
> Can you use len(request.vars["opt1"]) ?
>
> /dps
>
>  
>
>> On Monday, June 6, 2016 at 9:06:10 AM UTC-6, Anthony wrote:
>>
>>> Looks like each set of inputs has the same input names, so you get back 
>>> a list for each variable. I believe browsers preserve the order of input 
>>> values for inputs with the same name, so you should be able to just run a 
>>> loop and do a separate insert for each set of items in the lists (i.e., on 
>>> the first loop, extract element [0] from each list, on the second loop, 
>>> extract element [1], etc.).
>>>
>>> Anthony
>>>
>>> On Sunday, June 5, 2016 at 8:54:47 PM UTC-4, ktesr...@gmail.com wrote:

 I am getting request.vars as shown below when I print it

 vars: >>> ['1', '1'], 'txt1': ['1', '1']}>

 these values are given as input from user interface and it has 2 rows, 
 each row has 3 dropdown and 1 text box

 now how do I read each item and insert into database, in the database 
 there is a table that has 4 columns, as per my requirement now it has to 
 insert 2 records in that table

 On Friday, June 3, 2016 at 2:21:48 PM UTC-6, Anthony wrote:

> On Friday, June 3, 2016 at 12:35:49 PM UTC-4, ktesr...@gmail.com 
> wrote:
>>
>> it is a single select, the values are populated from controller into 
>> a view dynamically in jquery
>>
>
> OK, so what's wrong with your current approach? What are you trying to 
> achieve? Hard to help without seeing your code (e.g., model definitions, 
> etc.). Also, why are you using .getlist for a variable that isn't a list, 
> and then just extracting the first element (which you would get if not 
> using .getlist)?
>
> Anthony
>
>
>> On Friday, June 3, 2016 at 6:32:34 AM UTC-6, Anthony wrote:
>>>
>>> Hard to say because it's not clear (a) what kind of data are in 
>>> opt1, opt2, etc. (are they multi-select widgets producing lists or just 
>>> single selects?) and (b) how the form inputs map to your database 
>>> fields.
>>>
>>> Anthony
>>>
>>> On Thursday, June 2, 2016 at 11:55:13 PM UTC-4, ktesr...@gmail.com 
>>> wrote:

 Anthony

 I wanted to iterate all the values from request.vars these values 
 are passed using ajax function from View, in the View each row will 
 have 3 
 drop downs and 1 textbox to take input from user
 there can be minimum 1 row. I am passing all the control names thru 
 ajax function

 View
 ===
 
 /* jquery that builds html form written here */

 ajax('{{=URL('insert_data')}}',['opt1','opt2','opt3','txtt1'],'target');
  
 // opt1, opt2 and opt3 are dropdown control names and txt1 is the name 
 if 
 textbox control all are html controls dynamically crated using jquery

 
 
 

 Controller
 ==
 def insert_timesheet():
  
  orglist = request.vars.getlist("opt1")
  response.flash = str(orgval)

  ##db.Table.insert(field1=opt1[0],.)
  return locals()



 On Thursday, June 2, 2016 at 7:34:04 PM UTC-6, Anthony wrote:

> Please show some code and explain exactly what you want to do. To 
> get a particular value from request.vars, just do 
> request.vars.name_of_variable.
>
> Anthony
>
> On Thursday, June 2, 2016 at 8:07:13 PM UTC-4, ktesr...@gmail.com 
> wrote:
>>
>> I am getting selected values from View to Controller using 
>> request.vars
>>
>> I can see the values are coming as key value pair but not able to 
>> figure out how to read each value and insert them in DB
>>
>>
>>

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

[web2py] Re: How to use the administrator account to check error for apache + web2py framework?

2016-07-02 Thread isi_jca
Hi!!!

1°) Create an item menu like this:

('Ticket de Errores', URL()==URL('tickets', 'errors'), 
URL('tickets','errors')),


2°) Copy tickets.py in controller

3°) Extract tickets.7z in view

Regards.

El jueves, 30 de junio de 2016, 18:25:19 (UTC-3), Jing Lu escribió:
>
> Dear Web2py developers,
>
> The admin is blocked by the apache config. If I still want to use admin 
> account to check error information, what should I do?
>
>
> Thanks,
> Jing
>

-- 
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.
# -*- coding: utf-8 -*-

import re
from gluon.admin import *
from gluon.fileutils import abspath, read_file, write_file
from gluon.utils import web2py_uuid
from gluon.tools import Config
from gluon.compileapp import find_exposed_functions
from glob import glob
import shutil
import platform

#Parece que es la variable que indica si está logueado o no
is_gae = False
MULTI_USER_MODE = False
try:
import git
if git.__version__ < '0.3.1':
raise ImportError("Your version of git is %s. Upgrade to 0.3.1 or better." % git.__version__)
have_git = True
except ImportError, e:
have_git = False
GIT_MISSING = 'Requires gitpython module, but not installed or incompatible version: %s' % e

from gluon.languages import (read_possible_languages, read_dict, write_dict,
 read_plural_dict, write_plural_dict)
class TRACEBACK(object):
""" Generate the traceback """

def __init__(self, text):
""" TRACEBACK constructor """

self.s = make_links(CODE(text).xml())

def xml(self):
""" Returns the xml """

return self.s

def get_app(name=None):
app = name or request.args(0)
if (app and os.path.exists(apath(app, r=request)) and
(not MULTI_USER_MODE or is_manager() or
 db(db.app.name == app)(db.app.owner == auth.user.id).count())):
return app
session.flash = T('App does not exist or you are not authorized')
redirect(URL('site'))

def make_link(path):
""" Create a link from a path """
tryFile = path.replace('\\', '/')

if os.path.isabs(tryFile) and os.path.isfile(tryFile):
(folder, filename) = os.path.split(tryFile)
(base, ext) = os.path.splitext(filename)
app = get_app()

editable = {'controllers': '.py', 'models': '.py', 'views': '.html'}
for key in editable.keys():
check_extension = folder.endswith("%s/%s" % (app, key))
if ext.lower() == editable[key] and check_extension:
return A('"' + tryFile + '"',
 _href=URL(r=request,
 f='edit/%s/%s/%s' % (app, key, filename))).xml()
return ''



def make_links(traceback):
""" Make links using the given traceback """

lwords = traceback.split('"')

# Making the short circuit compatible with <= python2.4
result = (len(lwords) != 0) and lwords[0] or ''

i = 1

while i < len(lwords):
link = make_link(lwords[i])

if link == '':
result += '"' + lwords[i]
else:
result += link

if i + 1 < len(lwords):
result += lwords[i + 1]
i = i + 1

i = i + 1

return result

def ticket():
""" Ticket handler """

if len(request.args) != 2:
session.flash = T('invalid ticket')
redirect(URL('site'))

app = get_app()
myversion = request.env.web2py_version
ticket = request.args[1]
e = RestrictedError()
e.load(request, app, ticket)

return dict(app=app,
ticket=ticket,
output=e.output,
traceback=(e.traceback and TRACEBACK(e.traceback)),
snapshot=e.snapshot,
code=e.code,
layer=e.layer,
myversion=myversion)

def errors():
""" Error handler """
import operator
import os
import pickle
import hashlib

app = get_app(request.application)
if is_gae:
method = 'dbold' if ('old' in
 (request.args(1) or '')) else 'dbnew'
else:
method = request.args(1) or 'new'
db_ready = {}
db_ready['status'] = get_ticket_storage(app)
db_ready['errmessage'] = T(
"No ticket_storage.txt found under /private folder")
db_ready['errlink'] = "http://web2py.com/books/default/chapter/29/13#Collecting-tickets;

if method == 'new':
errors_path = apath('%s/errors' % app, r=request)

delete_hashes = []
for item in request.vars:
if item[:7] == 'delete_':

Re: [web2py] Re: Querying data using admin

2016-06-09 Thread isi_jca
Ramos:

Other posibility is create a form using grid and then choose columns you 
want to show, for example:

def query_venta():
query = (db.tventa.id >= 3)  &  (db.tventa.id <= 7)

columns = [db.tventa.fecha, db.tventa.monto]]
grid=SQLFORM.grid(query,field_id = db.tventa.id,fields=columns)


query_venta.html

{{=grid}}


Regards

El jueves, 9 de junio de 2016, 12:08:39 (UTC-3), Ramos escribió:
>
> Yes it works now.
>
> Too bad that i cannot only return some of the columns. It would be perfect 
> because i have many columns and i have to scroll to the right a lot.
>
> 2016-06-09 14:55 GMT+01:00 isi_jca <juliocesa...@gmail.com >:
>
>> Hello!!!
>>
>> Try using Parenthesis, for example:
>>
>> (db.tventa.id >= 3)  &  (db.tventa.id <= 7)
>>
>>
>> Result Set
>> tventa.id 
>> <http://127.0.0.1:8000/Cascada/appadmin/select/db?orderby=tventa.id>
>> tventa.fecha 
>> <http://127.0.0.1:8000/Cascada/appadmin/select/db?orderby=tventa.fecha>
>> tventa.vendedor 
>> <http://127.0.0.1:8000/Cascada/appadmin/select/db?orderby=tventa.vendedor>
>> tventa.monto 
>> <http://127.0.0.1:8000/Cascada/appadmin/select/db?orderby=tventa.monto>
>> 3 <http://127.0.0.1:8000/Cascada/appadmin/update/db/tventa/3> 2016-05-04 
>> Pedro 900.00
>> 4 <http://127.0.0.1:8000/Cascada/appadmin/update/db/tventa/4> 2016-05-05 
>> Andrés 1050.00
>> 5 <http://127.0.0.1:8000/Cascada/appadmin/update/db/tventa/5> 2016-06-08 
>> Pepe 123.31
>> 6 <http://127.0.0.1:8000/Cascada/appadmin/update/db/tventa/6> 2016-06-09 
>> Pepe 52.36
>> 7 <http://127.0.0.1:8000/Cascada/appadmin/update/db/tventa/7> 2016-06-10 
>> Maria 12.36
>> Regards.
>>
>>
>> El jueves, 9 de junio de 2016, 6:29:39 (UTC-3), Ramos escribió:
>>>
>>> hello 
>>> how can i, via admin query a table using in the input box more than 1 
>>> field to query?
>>>
>>> i tried
>>> db.amostras.n==203027 & db.amostras.estante1=="_E_000"  - >error
>>> db.amostras.n==203027 and db.amostras.estante1=="_E_000" -> no error but 
>>> seems to search only the second field (db.amostras.estante1=="_E_000)
>>>
>>> how can i query based on 2 fields?
>>>
>>> Regards
>>> António
>>>
>>> -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

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


[web2py] Re: Querying data using admin

2016-06-09 Thread isi_jca
Hello!!!

Try using Parenthesis, for example:

(db.tventa.id >= 3)  &  (db.tventa.id <= 7)


Result Set
tventa.id 

tventa.fecha 

tventa.vendedor 

tventa.monto 

3  2016-05-04 
Pedro 900.00
4  2016-05-05 
Andrés 1050.00
5  2016-06-08 
Pepe 123.31
6  2016-06-09 
Pepe 52.36
7  2016-06-10 
Maria 12.36
Regards.

El jueves, 9 de junio de 2016, 6:29:39 (UTC-3), Ramos escribió:
>
> hello 
> how can i, via admin query a table using in the input box more than 1 
> field to query?
>
> i tried
> db.amostras.n==203027 & db.amostras.estante1=="_E_000"  - >error
> db.amostras.n==203027 and db.amostras.estante1=="_E_000" -> no error but 
> seems to search only the second field (db.amostras.estante1=="_E_000)
>
> how can i query based on 2 fields?
>
> Regards
> António
>
>

-- 
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: Ajax load function div with incorrect data and duplicates elements of the page

2016-06-06 Thread isi_jca
Hi!!!

I commented that you can solve the problem by doing the following:

1°) Modifying the function as follows

def fgetlocalidad():
idprovincia = 0
result=''
idprovincia = int(request.vars.idprovincia)
localidad_rows = 
db(db.trlocalidad.idprovincia==idprovincia).select(orderby=db.trlocalidad.localidad_cp)
result = 'Localidad: '
result += ' '
for item in localidad_rows:
result += '' + item.localidad_cp 
+ ''  
result += ''
return XML(result)

2°) In the function def abmpersona():

define the url like this:

url=URL(c='persona',f='fgetlocalidad')

Modify the line where you call the function like this:

TR(TD( (LABEL("Provincia:",_class='control-label 
col-sm-3',_id='label_provincia'),
  
SELECT(_id="idprovincia",_class="idprovincia",_name="idprovincia",*[OPTION(i['descripcion'],
 
   _value=str(i['id'])) for i in 
provincia_row])),_onchange="ajax('%s' , ['idprovincia'], 'ciudad');" % 
url)),

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: how do I call stored procedure containing parameters?

2016-06-01 Thread isi_jca
Charles:

You can use this expression:

status = db.executesql("exec mystored @adt_time = ?, @ai_usrid= 
?",placeholders = (ldt_time, auth.user_id)) 

In this case the stored procedure has two arguments.

Greeting.


El miércoles, 1 de junio de 2016, 8:05:53 (UTC-3), Charles tenorio escribió:
>
> hi I like Call stored procedure containing parameters?
> 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 remove class date/datetime

2016-05-12 Thread isi_jca
Hello!!!

In my particular case, I wrote this code in my view:



jQuery('input#tmatrizlaboral_fecingreso').removeClass('date form-control'); 


Greetings.

El jueves, 12 de mayo de 2016, 9:45:07 (UTC-3), isi_jca escribió:
>
> Hi!!!
>
> Is possible to remove class date/datetime from form Grid?.
>
> 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] Grid remove class date/datetime

2016-05-12 Thread isi_jca
Hi!!!

Is possible to remove class date/datetime from form Grid?.

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: After user login, I need to verify validity password.

2016-04-27 Thread isi_jca
Leonel :

That was only a value of example.

El miércoles, 27 de abril de 2016, 8:05:58 (UTC-3), Leonel Câmara escribió:
>
> Why are you forcing your users to change passwords every 100 days?
>

-- 
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: After user login, I need to verify validity password.

2016-04-27 Thread isi_jca
Massimo:

Also I can make a trigger on auth_user table in the database when the 
password is changed and update lastchangepassword field. Althrougth I know 
is lost portability.

Best regards.

El martes, 26 de abril de 2016, 17:59:42 (UTC-3), isi_jca escribió:
>
> Massimo:
>
> Thanks for you answer.  Now is working, but when the user change password; 
> it is necesary to update lastchangepassword field at the auth_user table. 
> Must I to customize change_password controller?
>
> Thanks regards.
>
>
>
> El martes, 26 de abril de 2016, 15:15:32 (UTC-3), Massimo Di Pierro 
> escribió:
>>
>> at the bottom of db.py you can put:
>>
>> if auth.user and request.function!='user' 
>> and (request.now_lastchargepasswrod).days>100:
>>  redirect(URL('user/change_password'))
>>
>>
>> On Tuesday, 26 April 2016 08:37:56 UTC-5, isi_jca wrote:
>>>
>>> Hi!!!
>>>
>>> After user login, I want to check validity password, I added extra 
>>> fields (lastchangepassword and valitiypassword) at the auth_user table. 
>>> Where must I trigger a function to check this fields and then force at the 
>>> user to change password when password expire?
>>>
>>> Thanks in advanced.
>>>
>>

-- 
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: After user login, I need to verify validity password.

2016-04-26 Thread isi_jca
Massimo:

Thanks for you answer.  Now is working, but when the user change password; 
it is necesary to update lastchangepassword field at the auth_user table. 
Must I to customize change_password controller?

Thanks regards.



El martes, 26 de abril de 2016, 15:15:32 (UTC-3), Massimo Di Pierro 
escribió:
>
> at the bottom of db.py you can put:
>
> if auth.user and request.function!='user' 
> and (request.now_lastchargepasswrod).days>100:
>  redirect(URL('user/change_password'))
>
>
> On Tuesday, 26 April 2016 08:37:56 UTC-5, isi_jca wrote:
>>
>> Hi!!!
>>
>> After user login, I want to check validity password, I added extra fields 
>> (lastchangepassword and valitiypassword) at the auth_user table. Where must 
>> I trigger a function to check this fields and then force at the user to 
>> change password when password expire?
>>
>> Thanks in advanced.
>>
>

-- 
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] After user login, I need to verify validity password.

2016-04-26 Thread isi_jca
Hi!!!

After user login, I want to check validity password, I added extra fields 
(lastchangepassword and valitiypassword) at the auth_user table. Where must 
I trigger a function to check this fields and then force at the user to 
change password when password expire?

Thanks in advanced.

-- 
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: Form created using helper - load image

2016-02-01 Thread isi_jca
Hello Comunity!!!

I found the next link 
http://www.web2pyslices.com/slice/show/1370/modify-form-elements-and-attributes,
 
so I can load the images in this way:


strings = form.elements(_id='loadfoto1')
for s in strings:
s['_src'] = URL('default','download', args=item.foto1)

Best regards.




El viernes, 29 de enero de 2016, 20:39:28 (UTC-3), isi_jca escribió:
>
> Hi!!!
>
> I have a form created using Helper HTML, It is has manye field
>
> form = FORM(TABLE(
>
> TR(TD(LABEL("Foto 1:",_class="label_foto5"),
> INPUT(_class="upload",_id="foto5",_name="foto5", _type="file",
> 
> _onchange="leerarchivobin('foto5','loadfoto5')")),
>   TD(LABEL("Foto 
> 2:",_class="label_foto6"),INPUT(_class="upload",_id="foto6",_name="foto6", 
> _type="file",
> 
> _onchange="leerarchivobin('foto6','loadfoto6')")),
>   TD(LABEL("Foto 
> 3:",_class="label_foto7"),INPUT(_class="upload",_id="foto7",_name="foto7", 
> _type="file",
> 
> _onchange="leerarchivobin('foto7','loadfoto7')")),
>   TD(LABEL("Foto 
> 4:",_class="label_foto8"),INPUT(_class="upload",_id="foto8",_name="foto8", 
> _type="file",
> 
> _onchange="leerarchivobin('foto8','loadfoto8')")),),
> 
>TR(TD(IMG(_id="loadfoto5")),
> TD(IMG(_id="loadfoto6",_height="300px")),
> TD(IMG(_id="loadfoto7")),
> TD(IMG(_id="loadfoto8"))
> )))
>
>
> When I retrieve data from database I set data in the form this manner.
>
> form.vars.campo_1 = item.campo_1
> 
> 
> form.vars.campo_n = item.campo_n
>
> ¿How do I to set image in field type upload?.  For example, in my table I 
> have next definition:
>
> Field('foto1', 'upload',label=T('Foto 1 - Cliente'))
>
> 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] Form created using helper - load image

2016-01-29 Thread isi_jca
Hi!!!

I have a form created using Helper HTML, It is has manye field

form = FORM(TABLE(

TR(TD(LABEL("Foto 1:",_class="label_foto5"),
INPUT(_class="upload",_id="foto5",_name="foto5", _type="file",

_onchange="leerarchivobin('foto5','loadfoto5')")),
  TD(LABEL("Foto 
2:",_class="label_foto6"),INPUT(_class="upload",_id="foto6",_name="foto6", 
_type="file",

_onchange="leerarchivobin('foto6','loadfoto6')")),
  TD(LABEL("Foto 
3:",_class="label_foto7"),INPUT(_class="upload",_id="foto7",_name="foto7", 
_type="file",

_onchange="leerarchivobin('foto7','loadfoto7')")),
  TD(LABEL("Foto 
4:",_class="label_foto8"),INPUT(_class="upload",_id="foto8",_name="foto8", 
_type="file",

_onchange="leerarchivobin('foto8','loadfoto8')")),),

   TR(TD(IMG(_id="loadfoto5")),
TD(IMG(_id="loadfoto6",_height="300px")),
TD(IMG(_id="loadfoto7")),
TD(IMG(_id="loadfoto8"))
)))


When I retrieve data from database I set data in the form this manner.

form.vars.campo_1 = item.campo_1


form.vars.campo_n = item.campo_n

¿How do I to set image in field type upload?.  For example, in my table I 
have next definition:

Field('foto1', 'upload',label=T('Foto 1 - Cliente'))

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: class 'sqlite3.integrityerror' foreign key constraint failed

2015-05-04 Thread isi_jca
RUTMARYS:

*¿Qué tipo de formulario estas usando para insertar los datos, en que base 
de datos estas trabajando?, el mensaje te esta indicando que estas tratando 
de insertar en la columna ente o *
*nomodelo un valor inexistente en las tablas  ente o modelo, revisa como 
esta definida la relación dentro de la base de datos.*
*Si puedes sube una versión reducida de tu aplicación conteniendo el 
modelo, *
*el controlador y la vista para ver si se puede reproducir el error. Por mi 
parte te comento que hice una carga usando un formulario de tipo grid y no 
tuve *
*el problema que comentas e usado labase de datos sqlite.*

*Saludos cordiales.*

*Saludos.*




El martes, 28 de abril de 2015, 16:26:23 (UTC-3), RUTMARYS TRUJILLO 
escribió:

 Hola tengo un problema, cada vez que introduzco los registros en el 
 formulario de la tabla proyecto sale el error class 
 'sqlite3.integrityerror' foreign key constraint failed 

 no se que hacer... por favor agradecería su ayuda

 este es el modelo:

db.define_table(ente,

 Field(ente, string, default=None))

 db.define_table(modelo,

 Field(nommodelo, string, default=None),

 Field(etapac, string, default=None))

 db.define_table(proyecto,

 Field(codigop, integer, default=None),

 Field(ente, 'reference ente'),

 Field(nommodelo, 'reference modelo'),

 Field(nombrep, string, default=None),

 Field(tipo, string, default=None),

 Field(estatus, string, default=None),

 Field(fechai, date, default=None),

 Field(fechaf, date, default=None),

 Field(meta, integer, default=None),

 Field(nomrep, string, default=None),

 Field(aperep, string, default=None),

 Field(telefono, default=None),

 Field(email, string, default=None),

 Field(estado, string, default=None),

 Field(municipio, string, default=None),

 Field(parroquia, string, default=None))

  

  Relations between tables (remove fields you don't need from 
 requires) 

 db.proyecto.ente.requires=IS_IN_DB( db, 'ente.id', ' %(ente)s')

 db.proyecto.nommodelo.requires=IS_IN_DB( db, 'modelo.id', ' 
 %(nommodelo)s')


 *Error ticket for PROGRAMA*

 *Ticket ID*

 127.0.0.1.2015-04-27.12-55-08.a4f7ea63-a2dc-40ca-9885-d63027a5b13e

 *class 'sqlite3.IntegrityError' foreign key constraint failed*

 *Versión*
   
 *web2py™*
  
 Version 2.9.12-stable+timestamp.2015.02.15.23.04.25
   
 *Python*
  
 Python 2.7.9: C:\Users\RUTMARYS\Documents\mi pasantia\web2py\web2py.exe 
 (prefix: C:\Python27)
   
 *Rastreo*
   
 1.
 2.
 3.
 4.
 5.
 6.
 7.
 8.
 9.
 10.
 11.
 12.
 13.
 14.
 15.
 16.
  
 Traceback *(*most recent call last
 *):   *File C:\Users\RUTMARYS\Documents\mi 
 pasantia\web2py\gluon\restricted.py*, *line 224*, **in *restricted
 *exec *ccode *in *environment
   File C:/Users/RUTMARYS/Documents/mi 
 pasantia/web2py/applications/PROGRAMA/controllers/appadmin.py 
 http://127.0.0.1:8000/admin/default/edit/PROGRAMA/controllers/appadmin.py*, 
 *line 654*, **in ***module
 *   *File C:\Users\RUTMARYS\Documents\mi 
 pasantia\web2py\gluon\globals.py*, *line 393*, **in lambda*
 * **self**.*_caller *= **lambda *f*: *f
 *()   *File C:/Users/RUTMARYS/Documents/mi 
 pasantia/web2py/applications/PROGRAMA/controllers/appadmin.py 
 http://127.0.0.1:8000/admin/default/edit/PROGRAMA/controllers/appadmin.py*, 
 *line 152*, **in *insert
 *if *form*.*accepts*(*request*.*vars*, *session
 *):   *File C:\Users\RUTMARYS\Documents\mi 
 pasantia\web2py\gluon\sqlhtml.py*, *line 1677*, **in *accepts
 *self**.*vars*.*id *= **self**.*table*.*insert*(***fields
 *)   *File C:\Users\RUTMARYS\Documents\mi 
 pasantia\web2py\gluon\packages\dal\pydal\objects.py*, *line 737*, **in *
 insert
 ret *=  **self**.*_db*.*_adapter*.*insert*(**self**, **self**.*
 _listify*(*fields
 *))   *File C:\Users\RUTMARYS\Documents\mi 
 pasantia\web2py\gluon\packages\dal\pydal\adapters\base.py*, *line 719*, **in 
 *insert
 *raise *e
 IntegrityError*: *foreign key constraint failed
   
 *Error snapshot* *[image: help]* 
 http://127.0.0.1:8000/admin/default/ticket/PROGRAMA/127.0.0.1.2015-04-27.12-55-08.a4f7ea63-a2dc-40ca-9885-d63027a5b13e

 class 'sqlite3.IntegrityError'(foreign key constraint failed)

  


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

[web2py] Re: Links to referencing records - type 'exceptions.AttributeError' 'str' object has no attribute 'ignore_common_filters'

2012-01-17 Thread isi_jca
Hi!!!

I made a modifications in my script:
def list_records():
expresion = 'list_records'
table = request.args(0)
query = request.vars.query
pos = query.find(expresion)

if pos = 0:
pos = pos + len(expresion)
query= query[pos:]
q = db(query)
records = q.select()
else:
records = T('record does not exist')
return dict(records=records,table=pos,query=query)

But I get the same error:

type 'exceptions.AttributeError' 'str' object has no attribute
'ignore_common_filters'

Is there other posibility to implement a relation master-detail?.
Thanks for your time.


On 14 ene, 20:16, Alan Etkin spame...@gmail.com wrote:
  def list_records():
    table = request.args(0)
    query = request.vars.query
   records= db(query).select(db[table])
    return dict(records=records,table=table,query=query)

 the fourth line passes a string to the db instance call that expects a
 query object as those created with this statement:

 q = db.mytable.myfield.id == number

 Maybe you can do new_query = eval(q) to create the normal db call
 input. The admin interface does something similar (i don't know if it
 uses eval) as it processes queries sent by browser user input.


[web2py] Re: Links to referencing records - type 'exceptions.AttributeError' 'str' object has no attribute 'ignore_common_filters'

2012-01-17 Thread isi_jca
Ok, Thanks a lot.


On 17 ene, 11:00, Anthony abasta...@gmail.com wrote:
  I made a modifications in my script:
  def list_records():
      expresion = 'list_records'
      table = request.args(0)
      query = request.vars.query
      pos = query.find(expresion)

      if pos = 0:
          pos = pos + len(expresion)
          query= query[pos:]
          q = db(query)
          records = q.select()
      else:
          records = T('record does not exist')
      return dict(records=records,table=pos,query=query)

  But I get the same error:

  type 'exceptions.AttributeError' 'str' object has no attribute
  'ignore_common_filters'

 Same problem -- in db(query), query must be a Query object, but in your
 case it is just a string. You would have to do something like
 db(eval(query)), but that would be a security risk because you don't know
 what is in query. Instead, it's probably safer to parse the query itself
 and look for the table and id in the query -- confirm the table exists in
 db, and then build the actual query yourself.

 Anthony


[web2py] Re: Links to referencing records - type 'exceptions.AttributeError' 'str' object has no attribute 'ignore_common_filters'

2012-01-14 Thread isi_jca
Anthony:

I'm reading web2py book about Links to referencing records and I
pasted the examples, so
in my application has the following components:

Models

db.define_table('person',
   Field('name','string'),
   Field('surname','string'),
   Field('image_filename'),
   Field('image', 'upload'))

db.define_table('dog',
   Field('owner', db.person),
   Field('name', requires=IS_NOT_EMPTY()))

Controllers

def display_form():
   record = db.person(request.args(0))
   url = URL('download')
   link = URL('list_records')
   form = SQLFORM(db.person, record, deletable=True,
 upload=url, linkto=link)
   if form.process().accepted:
   response.flash = 'form accepted'
   elif form.errors:
  response.flash = 'form has errors'
   return dict(form=form)

def list_records():
   table = request.args(0)
   query = request.vars.query
   records = db(query).select(db[table])
   return dict(records=records,table=table,query=query)

def download():
   return response.download(request, db)

Views

display_form.html
{{extend 'layout.html'}}
h5Display Form/h5
{{=form}}

list_records.html
{{extend 'layout.html'}}
{{=records}}

Sorry for my English. Thanks you very much for answers.

On 13 ene, 17:39, Anthony abasta...@gmail.com wrote:
 On Friday, January 13, 2012 12:52:26 PM UTC-5, isi_jca wrote:

  Thanks for your answers. I made a correction, but the error persist. I
  was reading about this error in

 https://groups.google.com/group/web2py/browse_thread/thread/11835a3c9

 What is the relevance of that issue? Where do you set that query?


[web2py] Links to referencing records - type 'exceptions.AttributeError' 'str' object has no attribute 'ignore_common_filters'

2012-01-13 Thread isi_jca
Hello!!!

I am a beginner and get the next ticket. Anybody Can I Help me?. Thanks in 
advance.

Ticket ID 

127.0.0.1.2012-01-12.14-09-56.3407b807-6bc6-4428-a7f2-0173a5473524
type 'exceptions.AttributeError' 'str' object has no attribute 
'ignore_common_filters' Version  web2py™ (1, 99, 4, datetime.datetime(2011, 
12, 14, 14, 46, 14), 'stable')  Python Python 2.7.2+: /usr/bin/python  
Traceback 

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

Traceback (most recent call last):
  File /home/jalbornoz/web2py/gluon/restricted.py, line 204, in restricted
exec ccode in environment
  File /home/jalbornoz/web2py/applications/ExpedienteX/controllers/default.py 
http://127.0.0.1:8000/admin/default/edit/ExpedienteX/controllers/default.py, 
line 135, in module
  File /home/jalbornoz/web2py/gluon/globals.py, line 172, in lambda
self._caller = lambda f: f()
  File /home/jalbornoz/web2py/applications/ExpedienteX/controllers/default.py 
http://127.0.0.1:8000/admin/default/edit/ExpedienteX/controllers/default.py, 
line 80, in list_records
records = db(query).select(db[table].ALL)
  File /home/jalbornoz/web2py/gluon/dal.py, line 6333, in select
return self.db._adapter.select(self.query,fields,attributes)
  File /home/jalbornoz/web2py/gluon/dal.py, line 1274, in select
sql = self._select(query, fields, attributes)
  File /home/jalbornoz/web2py/gluon/dal.py, line 1155, in _select
if query and not query.ignore_common_filters:
AttributeError: 'str' object has no attribute 'ignore_common_filters'

 Error snapshot [image: help]  

type 'exceptions.AttributeError'('str' object has no attribute 
'ignore_common_filters') 

inspect attributes 
 Frames 
   
   -  
   
   *File /home/jalbornoz/web2py/gluon/restricted.py in restricted at line 
   204* code arguments variables 
-  
   
   *File 
   /home/jalbornoz/web2py/applications/ExpedienteX/controllers/default.py in 
   module at line 135* code arguments variables 
-  
   
   *File /home/jalbornoz/web2py/gluon/globals.py in lambda at line 172* 
   code arguments variables 
-  
   
   *File 
   /home/jalbornoz/web2py/applications/ExpedienteX/controllers/default.py in 
   list_records at line 80* code arguments variables 
-  
   
   *File /home/jalbornoz/web2py/gluon/dal.py in select at line 6333* code 
   arguments variables 
-  
   
   *File /home/jalbornoz/web2py/gluon/dal.py in select at line 1274* code 
   arguments variables 
-  
   
   *File /home/jalbornoz/web2py/gluon/dal.py in _select at line 1155* code 
   arguments variables 
Function argument list 
   
   (self=gluon.dal.MySQLAdapter object, query='dog.owner=5', 
   fields=[gluon.dal.Field object, gluon.dal.Field object, 
   gluon.dal.Field object], attributes={})
Code listing 
   
   1150.
   1151.
   1152.
   1153.
   1154.
   1155.
   
   1156.
   1157.
   1158.
   1159.
   
   else:
   new_fields.append(item)
   fields = new_fields
   tablenames = self.tables(query)
   
   if query and not query.ignore_common_filters:
   
   query = self.common_filter(query,tablenames)
   
   if not fields:
   for table in tablenames:
   
Variables  query 'dog.owner=5'  query.ignore_common_filters undefined  

 Context 

locals request session response 
 In file: 
/home/jalbornoz/web2py/applications/ExpedienteX/controllers/default.py 

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
96.
97.
98.
99.
100.
101.
102.
103.
104.
105.
106.
107.
108.
109.
110.
111.
112.
113.
114.
115.
116.
117.
118.
119.
120.
121.
122.
123.
124.
125.
126.
127.
128.
129.
130.
131.
132.
133.
134.
135.
136.

# -*- coding: utf-8 -*-
# this file is released under public domain and you can use without limitations

#
## This is a samples controller
## - index is the default action of any application
## - user is required for authentication and authorization
## - download is for downloading files uploaded in the db (does streaming)
## - call exposes all registered services (none by default)
#
@auth.requires_login()
def index():

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

   #response.flash = Test Your English
elemento = db().select(db.menu.ALL)
return dict(items=elemento)
# Permite realizar el ABM de las tablas de la aplicación, es llamada desde 
setting.html
def menu():
grid=SQLFORM 

[web2py] Re: Links to referencing records - type 'exceptions.AttributeError' 'str' object has no attribute 'ignore_common_filters'

2012-01-13 Thread isi_jca
Thanks for your answers. I made a correction, but the error persist. I
was reading about this error in
https://groups.google.com/group/web2py/browse_thread/thread/11835a3c9c1aeda3/68c0c35d7fe29b54?hl=eslnk=gstq=Links+to+referencing+records#68c0c35d7fe29b54.


On 13 ene, 11:10, Anthony abasta...@gmail.com wrote:
 Looks like somewhere you have a query 'dog.owner=5'. Instead, that should
 be:

 dog.owner == 5

 Note, no surrounding quotes, and use of == (to test equality) instead of =
 (used for assignment).

 Anthony







 On Friday, January 13, 2012 6:20:58 AM UTC-5, isi_jca wrote:

  Hello!!!

  I am a beginner and get the next ticket. Anybody Can I Help me?. Thanks in
  advance.

  Ticket ID

  127.0.0.1.2012-01-12.14-09-56.3407b807-6bc6-4428-a7f2-0173a5473524
  type 'exceptions.AttributeError' 'str' object has no attribute
  'ignore_common_filters' Version  web2py™ (1, 99, 4,
  datetime.datetime(2011, 12, 14, 14, 46, 14), 'stable')  Python Python
  2.7.2+: /usr/bin/python  Traceback

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

  Traceback (most recent call last):
    File /home/jalbornoz/web2py/gluon/restricted.py, line 204, in restricted
      exec ccode in environment
    File 
  /home/jalbornoz/web2py/applications/ExpedienteX/controllers/default.py 
  http://127.0.0.1:8000/admin/default/edit/ExpedienteX/controllers/defa..., 
  line 135, in module
    File /home/jalbornoz/web2py/gluon/globals.py, line 172, in lambda
      self._caller = lambda f: f()
    File 
  /home/jalbornoz/web2py/applications/ExpedienteX/controllers/default.py 
  http://127.0.0.1:8000/admin/default/edit/ExpedienteX/controllers/defa..., 
  line 80, in list_records
      records = db(query).select(db[table].ALL)
    File /home/jalbornoz/web2py/gluon/dal.py, line 6333, in select
      return self.db._adapter.select(self.query,fields,attributes)
    File /home/jalbornoz/web2py/gluon/dal.py, line 1274, in select
      sql = self._select(query, fields, attributes)
    File /home/jalbornoz/web2py/gluon/dal.py, line 1155, in _select
      if query and not query.ignore_common_filters:
  AttributeError: 'str' object has no attribute 'ignore_common_filters'

   Error snapshot [image: help]

  type 'exceptions.AttributeError'('str' object has no attribute
  'ignore_common_filters')

  inspect attributes
   Frames

     -

     *File /home/jalbornoz/web2py/gluon/restricted.py in restricted at line
     204* code arguments variables
      -

     *File
     /home/jalbornoz/web2py/applications/ExpedienteX/controllers/default.py in
     module at line 135* code arguments variables
      -

     *File /home/jalbornoz/web2py/gluon/globals.py in lambda at line 172*
     code arguments variables
      -

     *File
     /home/jalbornoz/web2py/applications/ExpedienteX/controllers/default.py in
     list_records at line 80* code arguments variables
      -

     *File /home/jalbornoz/web2py/gluon/dal.py in select at line 6333* code
     arguments variables
      -

     *File /home/jalbornoz/web2py/gluon/dal.py in select at line 1274* code
     arguments variables
      -

     *File /home/jalbornoz/web2py/gluon/dal.py in _select at line 1155* code
     arguments variables
      Function argument list

     (self=gluon.dal.MySQLAdapter object, query='dog.owner=5',
     fields=[gluon.dal.Field object, gluon.dal.Field object,
     gluon.dal.Field object], attributes={})
      Code listing

     1150.
     1151.
     1152.
     1153.
     1154.
     1155.

     1156.
     1157.
     1158.
     1159.

                 else:
                     new_fields.append(item)
             fields = new_fields
             tablenames = self.tables(query)

             if query and not query.ignore_common_filters:

                 query = self.common_filter(query,tablenames)

             if not fields:
                 for table in tablenames:

      Variables  query 'dog.owner=5'  query.ignore_common_filters undefined

   Context

  locals request session response
   In file:
  /home/jalbornoz/web2py/applications/ExpedienteX/controllers/default.py

  1.
  2.
  3.
  4.
  5.
  6.
  7.
  8.
  9.
  10.
  11.
  12.
  13.
  14.
  15.
  16.
  17.
  18.
  19.
  20.
  21.
  22.
  23.
  24.
  25.
  26.
  27.
  28.
  29.
  30.
  31.
  32.
  33.
  34.
  35.
  36.
  37.
  38.
  39.
  40.
  41.
  42.
  43.
  44.
  45.
  46.
  47.
  48.
  49.
  50.
  51.
  52.
  53.
  54.
  55.
  56.
  57.
  58.
  59.
  60.
  61.
  62.
  63.
  64.
  65.
  66.
  67.
  68.
  69.
  70.
  71.
  72.
  73.
  74.
  75.
  76.
  77.
  78.
  79.
  80.
  81.
  82.
  83.
  84.
  85.
  86.
  87.
  88.
  89.
  90.
  91.
  92.
  93.
  94.
  95.
  96.
  97.
  98.
  99.
  100.
  101.
  102.
  103.
  104.
  105.
  106.
  107.
  108.
  109.
  110.
  111.
  112.
  113.
  114.
  115.
  116.
  117.
  118.
  119.
  120.
  121.
  122.
  123.
  124.
  125.
  126.
  127.
  128.
  129.
  130.
  131.
  132.
  133.
  134.
  135.
  136.

  # -*- coding: utf-8 -*-
  # this file