[web2py] Re: edit or delete child or detail table on SQLFORM.grid with left join

2017-03-20 Thread 黄祥
could anyone give an example to custom button in grid that does an ajax 
query?

another question is oot :
what is the best practice to define table for transaction that separated 
for header and detail? 
when use header and detail it good for normalisation but not good in 
operational, in case want to edit or delete it, when using 1 table for 
header and detail, the data is for header is repeated in the rows.

thanks and best regards,
stifan

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


Re: [web2py] Access DB2/400 from IBM i (AS/400) PASE environment

2017-03-20 Thread Jim Steil
I've got 2.7 in my space even though it is labeled 3.4.4.

[image: Inline image 1]

and you can use the python3 command to get into python3

[image: Inline image 2]

-Jim


On Mon, Mar 20, 2017 at 5:16 PM, 'DenesL' via web2py-users <
web2py@googlegroups.com> wrote:

> Litmis only has Python-3.4.4
>
>
> On Monday, March 20, 2017 at 10:08:07 AM UTC-4, Jim S wrote:
>>
>> Are you familiar with Aaron Bartell's work and litmis spaces?
>> spaces.litmis.com
>>
>> There you can get a free PASE session on their boxes.  Use the code BETA
>> when signing up.  Let me know if you have any questions.
>>
>> -Jim
>>
>> On Mon, Mar 20, 2017 at 8:56 AM, 'DenesL' via web2py-users wrote:
>>
>>>
>>> Last summer uh? Not keeping up with i news lately...
>>>
>>> I looked it up as soon as I saw your post today, that is why I said it
>>> seems to need a modified adapter to map things thru ibm_db.
>>> It might be fairly easy and I would like to help but the lack of a newer
>>> i box to test with doesn't help.
>>>
>>> Denes
>>>
>>> On Monday, March 20, 2017 at 9:31:04 AM UTC-4, Jim S wrote:

 Yes, support became available for Python 2 and Python 3 last summer.
 Came out in Technology Refreshes.  They still have a long way to go getting
 more packages supported, but base support is there.  They also have a local
 dbapi connector to connect to a DB2/400 database which is what I'm trying
 to connect to with the DAL.

 I don't know where to begin modifying an adapter, looking for help.

 -Jim

 On Monday, March 20, 2017 at 8:18:41 AM UTC-5, DenesL wrote:
>
> Hi Jim
>
> Python officially supported on i, finally!!
> I wish this had happened a while back.
>
> It seems that this would require a modified adapter in web2py,
> sadly I have no access to a current 7.x box to test.
>
> Denes
>
> On Saturday, March 18, 2017 at 11:11:34 AM UTC-4, Jim S wrote:
>>
>> In this example he is connecting using a DB2 connector.  However, I'm
>> hoping to use the ibm_db_dbi connector and don't know how to specify it 
>> on
>> the dal connection.  He is using:
>>
>> db = DAL('db2://DSN=MYDSN;UID=x;PWD=x', migrate_enabled=False)
>>
>>
>> I'm not sure what to put in place of the db2://DSN...
>>
>> Anyone?
>>
>> -Jim
>>
>>
>> On Fri, Mar 17, 2017 at 7:38 PM, António Ramos wrote:
>>
>>> maybe
>>> http://www.web2pyslices.com/slice/show/1474/calling-remote-
>>> program-on-db2-from-pythonweb2py
>>>
>>>
>>>
>>>
>>> <#m_-4783883769032414716_CAERBpoCHvvgNfbffSKAFcDFZTik10ACs69rAY__7rG7whA_5wA@mail.gmail.com_m_-7554748344480484208_269cefbd-24e0-4f4b-98ec-bed31dff4d60@googlegroups.com_c78e0319-5078-4af6-9a39-37e920755dac@googlegroups.com_CAERBpoCttAv9kGK=rqf1z1TiNvGQS-h99VwVWD9JJZ3ZAVeMaw@mail.gmail.com_m_-838279669736982895_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>>>
>>> 2017-03-17 21:06 GMT+00:00 Jim S :
>>>
 Hi

 In a former (and somewhat current) life I was an AS/400 guy.  Our
 shop still uses the platform though most of my time is spent on Python 
 and
 web2py now.

 Recently Python became available and officially supported on IBM i
 and I'm trying to get web2py running there accessing the local DB2/400
 database.  Using the local python on the system I can create a database
 connection to the local database doing this:

 import ibm_db_dbi as db

 conn = db.connect(database='*LOCAL')

 I'm hoping to find an easy way to convert this into a connectstring
 for the DAL so I can have my database created there.  The SQL-flavor it
 should use would be the same as ODBC-flavored SQL.

 Can anyone give me a clue how to modify the DAL code to connect to
 my db?  Any pointers to other articles or links would really be
 appreciated.  It would be exciting for me to get this working since I 
 could
 then show RPG developers how easy it would be to get an application on 
 the
 web from the AS/400 using python/web2py.

 -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 a topic in the
>>> Google Groups "web2py-users" group.
>>> To unsubscribe from this topic, visit https://groups.google.com/d/to
>>> pic/web2py/qrlN5TSSBgs/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> web2py+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
> Resources:
> - 

Re: [web2py] Access DB2/400 from IBM i (AS/400) PASE environment

2017-03-20 Thread 'DenesL' via web2py-users
Thanks Ramos. Python 2.7.11 at pub400.

Can you guys provide a save file to FTP to pub400? they are running v7r3m0.

Denes


On Monday, March 20, 2017 at 10:23:34 AM UTC-4, Ramos wrote:
>
> Iseries 7.x in the cloud
>
> http://pub400.com/
>
> tutorial about iseries using pub400
>
> https://www.youtube.com/watch?v=vTOC0YXs9Ts
>
> 2017-03-20 14:07 GMT+00:00 Jim Steil :
>
>> Are you familiar with Aaron Bartell's work and litmis spaces?  
>> spaces.litmis.com
>>
>> There you can get a free PASE session on their boxes.  Use the code BETA 
>> when signing up.  Let me know if you have any questions.
>>
>> -Jim
>>
>> On Mon, Mar 20, 2017 at 8:56 AM, 'DenesL' via web2py-users <
>> web2py@googlegroups.com> wrote:
>>
>>>
>>> Last summer uh? Not keeping up with i news lately...
>>>
>>> I looked it up as soon as I saw your post today, that is why I said it 
>>> seems to need a modified adapter to map things thru ibm_db.
>>> It might be fairly easy and I would like to help but the lack of a newer 
>>> i box to test with doesn't help.
>>>
>>> Denes 
>>>
>>> On Monday, March 20, 2017 at 9:31:04 AM UTC-4, Jim S wrote:

 Yes, support became available for Python 2 and Python 3 last summer.  
 Came out in Technology Refreshes.  They still have a long way to go 
 getting 
 more packages supported, but base support is there.  They also have a 
 local 
 dbapi connector to connect to a DB2/400 database which is what I'm trying 
 to connect to with the DAL.

 I don't know where to begin modifying an adapter, looking for help.

 -Jim

 On Monday, March 20, 2017 at 8:18:41 AM UTC-5, DenesL wrote:
>
> Hi Jim
>
> Python officially supported on i, finally!!
> I wish this had happened a while back.
>
> It seems that this would require a modified adapter in web2py,
> sadly I have no access to a current 7.x box to test.
>
> Denes
>
> On Saturday, March 18, 2017 at 11:11:34 AM UTC-4, Jim S wrote:
>>
>> In this example he is connecting using a DB2 connector.  However, I'm 
>> hoping to use the ibm_db_dbi connector and don't know how to specify it 
>> on 
>> the dal connection.  He is using:
>>
>> db = DAL('db2://DSN=MYDSN;UID=x;PWD=x', migrate_enabled=False)
>>
>>
>> I'm not sure what to put in place of the db2://DSN...
>>
>> Anyone?
>>
>> -Jim
>>
>>
>> On Fri, Mar 17, 2017 at 7:38 PM, António Ramos wrote:
>>
>>> maybe
>>>
>>> http://www.web2pyslices.com/slice/show/1474/calling-remote-program-on-db2-from-pythonweb2py
>>>
>>>
>>>
>>>
>>> <#CAEM0BxP54xTLcQR9-+P+_wF0xYhSEY8_XhVUjcimaf8c7f_CwA@mail.gmail.com_m_8440901031396165177_m_-7554748344480484208_269cefbd-24e0-4f4b-98ec-bed31dff4d60@googlegroups.com_c78e0319-5078-4af6-9a39-37e920755dac@googlegroups.com_CAERBpoCttAv9kGK=rqf1z1TiNvGQS-h99VwVWD9JJZ3ZAVeMaw@mail.gmail.com_m_-838279669736982895_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>>>
>>> 2017-03-17 21:06 GMT+00:00 Jim S :
>>>
 Hi

 In a former (and somewhat current) life I was an AS/400 guy.  Our 
 shop still uses the platform though most of my time is spent on Python 
 and 
 web2py now.

 Recently Python became available and officially supported on IBM i 
 and I'm trying to get web2py running there accessing the local DB2/400 
 database.  Using the local python on the system I can create a 
 database 
 connection to the local database doing this:

 import ibm_db_dbi as db

 conn = db.connect(database='*LOCAL')

 I'm hoping to find an easy way to convert this into a connectstring 
 for the DAL so I can have my database created there.  The SQL-flavor 
 it 
 should use would be the same as ODBC-flavored SQL.  

 Can anyone give me a clue how to modify the DAL code to connect to 
 my db?  Any pointers to other articles or links would really be 
 appreciated.  It would be exciting for me to get this working since I 
 could 
 then show RPG developers how easy it would be to get an application on 
 the 
 web from the AS/400 using python/web2py.

 -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 a topic in the 
>>> Google Groups "web2py-users" group.
>>> To unsubscribe from this topic, visit 
>>> https://groups.google.com/d/topic/web2py/qrlN5TSSBgs/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to 
>>> web2py+unsubscr...@googlegroups.com.
>>> For 

Re: [web2py] Access DB2/400 from IBM i (AS/400) PASE environment

2017-03-20 Thread 'DenesL' via web2py-users
Litmis only has Python-3.4.4 


On Monday, March 20, 2017 at 10:08:07 AM UTC-4, Jim S wrote:
>
> Are you familiar with Aaron Bartell's work and litmis spaces?  
> spaces.litmis.com
>
> There you can get a free PASE session on their boxes.  Use the code BETA 
> when signing up.  Let me know if you have any questions.
>
> -Jim
>
> On Mon, Mar 20, 2017 at 8:56 AM, 'DenesL' via web2py-users wrote:
>
>>
>> Last summer uh? Not keeping up with i news lately...
>>
>> I looked it up as soon as I saw your post today, that is why I said it 
>> seems to need a modified adapter to map things thru ibm_db.
>> It might be fairly easy and I would like to help but the lack of a newer 
>> i box to test with doesn't help.
>>
>> Denes 
>>
>> On Monday, March 20, 2017 at 9:31:04 AM UTC-4, Jim S wrote:
>>>
>>> Yes, support became available for Python 2 and Python 3 last summer.  
>>> Came out in Technology Refreshes.  They still have a long way to go getting 
>>> more packages supported, but base support is there.  They also have a local 
>>> dbapi connector to connect to a DB2/400 database which is what I'm trying 
>>> to connect to with the DAL.
>>>
>>> I don't know where to begin modifying an adapter, looking for help.
>>>
>>> -Jim
>>>
>>> On Monday, March 20, 2017 at 8:18:41 AM UTC-5, DenesL wrote:

 Hi Jim

 Python officially supported on i, finally!!
 I wish this had happened a while back.

 It seems that this would require a modified adapter in web2py,
 sadly I have no access to a current 7.x box to test.

 Denes

 On Saturday, March 18, 2017 at 11:11:34 AM UTC-4, Jim S wrote:
>
> In this example he is connecting using a DB2 connector.  However, I'm 
> hoping to use the ibm_db_dbi connector and don't know how to specify it 
> on 
> the dal connection.  He is using:
>
> db = DAL('db2://DSN=MYDSN;UID=x;PWD=x', migrate_enabled=False)
>
>
> I'm not sure what to put in place of the db2://DSN...
>
> Anyone?
>
> -Jim
>
>
> On Fri, Mar 17, 2017 at 7:38 PM, António Ramos wrote:
>
>> maybe
>>
>> http://www.web2pyslices.com/slice/show/1474/calling-remote-program-on-db2-from-pythonweb2py
>>
>>
>>
>>
>> <#CAERBpoCHvvgNfbffSKAFcDFZTik10ACs69rAY__7rG7whA_5wA@mail.gmail.com_m_-7554748344480484208_269cefbd-24e0-4f4b-98ec-bed31dff4d60@googlegroups.com_c78e0319-5078-4af6-9a39-37e920755dac@googlegroups.com_CAERBpoCttAv9kGK=rqf1z1TiNvGQS-h99VwVWD9JJZ3ZAVeMaw@mail.gmail.com_m_-838279669736982895_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>>
>> 2017-03-17 21:06 GMT+00:00 Jim S :
>>
>>> Hi
>>>
>>> In a former (and somewhat current) life I was an AS/400 guy.  Our 
>>> shop still uses the platform though most of my time is spent on Python 
>>> and 
>>> web2py now.
>>>
>>> Recently Python became available and officially supported on IBM i 
>>> and I'm trying to get web2py running there accessing the local DB2/400 
>>> database.  Using the local python on the system I can create a database 
>>> connection to the local database doing this:
>>>
>>> import ibm_db_dbi as db
>>>
>>> conn = db.connect(database='*LOCAL')
>>>
>>> I'm hoping to find an easy way to convert this into a connectstring 
>>> for the DAL so I can have my database created there.  The SQL-flavor it 
>>> should use would be the same as ODBC-flavored SQL.  
>>>
>>> Can anyone give me a clue how to modify the DAL code to connect to 
>>> my db?  Any pointers to other articles or links would really be 
>>> appreciated.  It would be exciting for me to get this working since I 
>>> could 
>>> then show RPG developers how easy it would be to get an application on 
>>> the 
>>> web from the AS/400 using python/web2py.
>>>
>>> -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 a topic in the 
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/web2py/qrlN5TSSBgs/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

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

[web2py] Re: Trying to use Field.represent for 'blob' type in SQLFORM.grid (works in appadmin?)

2017-03-20 Thread Massimo Di Pierro
It is a bug in grid. I just pushed a new version on github that allows you 
to do SQLFORM.grid(...,showblob=True)

On Monday, 20 March 2017 13:52:53 UTC-5, Jordan Myers wrote:
>
> Hello,
>
> I am trying to display a Field that has type 'blob' in a SQLFORM.grid. The 
> data is NOT user-uploaded, thus I cannot use the typical uploadfield + 
> request.download pattern. I am using blob because I need to store important 
> algorithm-generated data that is too large to fit in the 'text' field type. 
> I would like it to display a link to a handler.
>
> I tried a simple test case model
>
>
> db.define_table('blob_test',
> Field('blob_field', 'blob', readable=True,
>   represent=lambda value, row: A('link', 
> _href=URL('handler', args=[row.id]))
>   )
> )
>
>
> #and in the controller:
>
> def blob_grid():
> response.view = 'generic.html'
> grid = SQLFORM.grid(db.blob_test.id > 0)
> return dict(grid=grid)
>
>
> The result is that the controller does not display the link, and indeed the 
> entire column is overtaken by the default view/edit/delete buttons provided 
> by grid.
>
>
> 
>
>
> Interestingly, the appadmin display of the table does have the represent link 
> as intended. 
>
>
> 
>
>
>
>
> How can I have this representation work for SQLFORM.grid? 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: Retrieve other fields from the LDAP database

2017-03-20 Thread Dave S


On Monday, March 20, 2017 at 6:40:04 AM UTC-7, John Freking wrote:
>
> I have used LDAP login with MS Active Directory and I added the extra 
> fields for names and emails to the AUTH_USER table. 
>
> [ldap_auth(mode='ad', 
> manage_user=True, 
> user_firstname_attrib = 'givenName', 
> user_lastname_attrib = 'sn', 
> user_mail_attrib = 'mail', 
>
> This code works fine but I want to retrieve more fields from the LDAP 
>
database.  Is it possible to get more than these these fields? 
>
> Thanks, 
> John 
>




The book has a quick paragraph at

 


which refers to the "documentation in the file 
[webpydir]/gluon/contrib/login_methods/ldap_auth.py".
And it looks like if you scroll down to where manage_user is mentioned, you 
may get some help (around line #116 in the 2.14.6 stable version).

A quick google doesn't show an answer that's specific to your question; 
most of the ldap posts are about getting the connection to one or another 
type of service.

/dps

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


Re: [web2py] Retrieve other fields from the LDAP database during login

2017-03-20 Thread Dave S
Duplicate.  See 


/dps


On Monday, March 20, 2017 at 6:38:44 AM UTC-7, John Freking wrote:
>
> I'm using LDAP AUTH with MS Active Directory and I added three extra 
> fields for names and email. The three fields are. 
>
> user_firstname_attrib 
> user_lastname_attrib 
> user_mail_attrib 
>
> This code works fine but I want to retrieve other fields from the LDAP 
> database.  Is it possible to get more than these these fields?  I 
> would like to find the manager of the user. 
>
> Thanks, 
> John 
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the 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: server rocket

2017-03-20 Thread Dave S


On Monday, March 20, 2017 at 7:39:23 AM UTC-7, Елена Серебрянникова wrote:
>
> Hello. Necessary remote admin via the rocket. Please tell me.
>

 You either need to set up Rocket to handle https (which involves telling 
it about your certificates, otherwise it sends a default list that clients 
barf on), or using SSL port redirect.

I thought there was more in the book about the https requirement, but I'm 
not looking in the right place.  This is close:
http://web2py.com/books/default/chapter/29/03/overview#More-on-appadmin>

One of the posts about port redirect is at


(My notes aren't cleaned up yet, but I've done this a couple of times.)

/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] Trying to use Field.represent for 'blob' type in SQLFORM.grid (works in appadmin?)

2017-03-20 Thread Jordan Myers
Hello,

I am trying to display a Field that has type 'blob' in a SQLFORM.grid. The 
data is NOT user-uploaded, thus I cannot use the typical uploadfield + 
request.download pattern. I am using blob because I need to store important 
algorithm-generated data that is too large to fit in the 'text' field type. 
I would like it to display a link to a handler.

I tried a simple test case model


db.define_table('blob_test',
Field('blob_field', 'blob', readable=True,
  represent=lambda value, row: A('link', 
_href=URL('handler', args=[row.id]))
  )
)


#and in the controller:

def blob_grid():
response.view = 'generic.html'
grid = SQLFORM.grid(db.blob_test.id > 0)
return dict(grid=grid)


The result is that the controller does not display the link, and indeed the 
entire column is overtaken by the default view/edit/delete buttons provided by 
grid.




Interestingly, the appadmin display of the table does have the represent link 
as intended. 






How can I have this representation work for SQLFORM.grid? 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: Not able to connect to a database other than admin in mongodb using authorization

2017-03-20 Thread Massimo Di Pierro
This may not be a web2py/pydal issuer. Can you connect using pymongo with a 
password?

On Monday, 20 March 2017 08:41:28 UTC-5, vikas mittal wrote:
>
> I am trying to connect to the mongodb/
> mongodb has three databases as of now admin, local and another one i 
> created with the name vikdata using the no authorization first.
> i am able to connect via db.py if I use this 
>
> db = DAL('mongodb://admin:mongodbpass/localhost:27017/admin')
>
> but not with this
>
> db = DAL('mongodb://localadmin:mongodbpass/localhost:27017/local')
>
> and not with this
>
> db = DAL('mongodb://user01:mongodbpass/localhost:27017/vikdata')
>
>
> I am able to connect without authorization though
>
> db = DAL('mongodb://localhost:27017/vikdata')
>
>
> Can you please help why so.
>
> I am very new to all this. 
>
>
> Sincere Thanks.
>
> Vikas 
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the 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 add header in soap request using pysimple soap

2017-03-20 Thread Massimo Di Pierro
I would recommend you ask to the pysimplesoap authors.


On Monday, 20 March 2017 08:37:06 UTC-5, Aafak Mohammad wrote:
>
> Hi i am using pysimplesoap latest api with python 2.6 just want to add 
> header in my request how i can do that?
> following is my code i am trying 
>
> client = SoapClient(wsdl='mcsdk10.wsdl',
> location="https://10.10.11.164:9443/services/mcsdk10;,
> trace=True,
> ns=True,
> sessions=True,
> exceptions=True,
> )
>
> soap_header = {
> 'axis2:ServiceGroupId': result['return']['name'],
> 'wsa:To': 'https://10.136.12.230:9443/services/mcsdk10',
> 'wsa:MessageID': result['return']['name'],
> 'wsa:Action': 'urn:getProfileInfo'
> }
> *client['headers']= soap_header*
>
>
> result = client.getProfileInfo(args0={'description': "/p1", 'name': 'p1', 
> 'value':'p1'})
>
>
> also i have tried following
>
> ServiceGroupId = SimpleXMLElement('', namespace=namespace, 
> prefix=ns)
> ServiceGroupId['axis2']='http://ws.apache.org/namespaces/axis2'
> ServiceGroupId.marshall('axis2:ServiceGroupId',result['return']['name'])
> ServiceGroupId.marshall('wsa:To','https://10.136.12.230:9443/services/mcsdk10')
> ServiceGroupId.marshall('wsa:MessageID', result['return']['name'])
> ServiceGroupId.marshall('wsa:Action', 'urn:getProfileInfo')
> *client['headers']=ServiceGroupId*
>
> Both the way it is not working
> it is always sending the request with empty header
>
> DEBUG:pysimplesoap.client: encoding="UTF-8"?>http://sdk10.mc.avamar.com; 
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/;>
> **
> http://sdk10.mc.avamar.com;>http://sdk10.mc.avamar.com/xsd;>/p1http://sdk10.mc.avamar.com/xsd;>p1http://sdk10.mc.avamar.com/xsd
> ">p1
>
>
> I just want to pass tp achieve following request
>
> 
>
> http://www.w3.org/2003/05/soap-envelope;>
>
> http://www.w3.org/2005/08/addressing;>
>
>   
>
> http://ws.apache.org/namespaces/axis2; wsa:IsReferenceParameter="true">
> urn:uuid:F2BB85C670F832B7A71489646820629   
> 
> https://Avamar_Server_IP:9443/services/mcsdk10 >
>
> 
> urn:uuid:D9DD8A6C7B1FAB9CA61489646819241
>
> urn:getProfileInfo
>
> 
>
> 
>
> http://sdk10.mc.avamar.com;>
>
> http://sdk10.mc.avamar.com/xsd; xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance; xsi:type="ns3:ProfileMoref">
>
> 
> /UniqueProfileName
>
> 
> UniqueProfileName
>
> 
> 1489646817758
>
> 
>
> 
>
> 
>
> 
>
>
>
> I am able to pass body, but not header
>
> 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: Unable to start a server

2017-03-20 Thread Massimo Di Pierro
My guess is you have previuosly run web2py with sudo or installed web2py 
sudo.

rm /home/www-data/web2py/parameters_8000.py

it is exists and make sure the user starting web2py has permission to read 
and write the web2py folder.

Massimo

On Monday, 20 March 2017 08:36:19 UTC-5, Rasmus Kreiner wrote:
>
> Hi All,
>
>
> I keep getting this error when I try start web2 py: 
>
>
> *-*
>
>
> *pi@FoyerAfspiller_1*:*/home/www-data/web2py $* python web2py.py -a 'xxx' 
> -i 192.168.0.10 -p 8000
>
> web2py Web Framework
>
> Created by Massimo Di Pierro, Copyright 2007-2017
>
> Version 2.14.6-stable+timestamp.2016.05.10.00.21.47
>
> Database drivers available: sqlite3, imaplib, pymysql, pg8000
>
>
> please visit:
>
> http://192.168.0.10:8000/
>
> use "kill -SIGTERM 1105" to shutdown the web2py server
>
>
>
> Traceback (most recent call last):
>
>   File "web2py.py", line 32, in 
>
> gluon.widget.start(cron=True)
>
>   File "/home/www-data/web2py/gluon/widget.py", line 1313, in start
>
> interfaces=options.interfaces)
>
>   File "/home/www-data/web2py/gluon/main.py", line 741, in __init__
>
> save_password(password, port)
>
>   File "/home/www-data/web2py/gluon/main.py", line 596, in save_password
>
> fp = open(password_file, 'w')
>
> IOError: [Errno 13] Permission denied: 
> '/home/www-data/web2py/parameters_8000.py'
>
> *-*
>
> Im running of a raspberry pi with the latest jessie software, and used 
> this recipe to install web2py: 
> https://github.com/web2py/web2py/blob/master/scripts/setup-web2py-ubuntu.sh
> .
>
> 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: UnboundLocalError: local variable 'books' referenced before assignment

2017-03-20 Thread Mirek Zvolský
This has nothing with Web2py but with Python.

Try this:
>>> a = 5
>>> def f():
if False:
a = 3
return a
>>> f()
UnboundLocalError: local variable 'a' referenced before assignment

And this is exactly what you have in vote_callback() with variable books.
Python can with variables from outer scope work and use them readonly.
However here Python will determine that 'books' (or 'a') is readwrite - and 
you haven't set it yet (if condition 'vars and auth_user' is False) and you 
want get its value (in 'return' command).



On Monday, 20 March 2017 14:38:38 UTC+1, Joe Dunst wrote:
>
>
> I'm trying to make a "vote up" and "vote down" feature in my program, like 
> the one in reddit.com. But I've been receiving tickets from 2 different 
> errors. (I solved the first one but I want to 
> First, I received a "UnboundLocalError: local variable 'books' referenced 
> before assignment"
> This was my code at the time when I had that error.
> *CONTROLLER: *
> def vote_callback():
> vars = request.post_vars
> if vars and auth_user:
> *id = vars.id *
> direction = +1 if vars.direction == 'up' else -1
> *books = db.books(id)*
> if books:
> votes = db.votes(post=id, created_by=auth.user.id)
> if not votes:
> books.update_record(vote_book=books.book_vote+direction)
> db.votes.insert(post=id,score=direction)
> elif votes.score!=direction:
> books.update_record(vote_book=books.book_vote+direction)
> votes.update_record(score=direction)
> else:
> pass
> print books.book_vote
> return str(books.book_vote)
>
>
> *VIEW:*
> 
> https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js
> ">
>
> 
> 
>
> This is the default/list_books_by_vote.html template
>
> {{if request.function=='list_books_by_vote':}}
> {{=A('sort by datetime', _class='btn', 
> _href=URL('list_books_by_datetime'))}}
>
> {{elif request.function=="list_books_by_datetime":}}
> {{=A('sort by votes', _class='btn', _href=URL('list_books_by_vote'))}}
>
> {{else:}}
> 
> {{=author(user_id)}}
> 
> {{pass}}
>
> {{for post in rows:}}
> 
> 
> http://post.id>}}"*>
> 
> 
> Remove vote
> 
>  
> 
> 
> *{{=post.book_vote}}*
> 
>  
> 
>  style="margin-left:5px;margin-right:5px;">
> I referenced this!
> 
> 
> 
> {{=A(post.book_title, 
> _href=URL('show_specific_user', args=post.id))}}
> 
> 
> 
> {{=author(post.modified_by)}}
> 
> 
> 
> 
> 
> {{pass}}
>
> **
> *function do_ajax_vote(t, direction) {*
> *var id = jQuery(t).closest('tr').attr('data-id');*
> *jQuery.ajax({method:'post',url:'{{=URL('vote_callback')}}',*
> * data:{'id':id,'direction':direction},*
> * success: function(data){*
> *
>  jQuery(t).closest('tr').find('.votes').html(data);*
> *} });*
> *}*
>
> *jQuery(function() {*
> *jQuery('[data-direction=up]').click(function(){do_ajax_vote(this, 
> 'up');});*
> *
> jQuery('[data-direction=down]').click(function(){do_ajax_vote(this, 
> 'down');});*
> *});*
> **
> 
>
>
> *Model:*
> db.define_table('books',
> Field('book_title', 'string', 
> requires=(IS_NOT_IN_DB(db,'books.book_title'), IS_NOT_EMPTY()), 
> label='Thesis Title'),
> Field('book_subtitle', 'string', label='Thesis Subtitle 
> (Optional)'),
> Field('book_date', type='date', requires=IS_DATE(), 
> label='Publish Date' ),
> Field('book_abstract', type='text', 
> requires=IS_NOT_EMPTY() , label='Thesis Abstract' ),
> Field('book_school', requires=IS_IN_SET(['AMA Computer 
> College - Naga Campus', 'Ateneo de Naga University', 'Naga College 
> Foundation', 'Computer Communication Development Institute', 'University of 
> Nueva Caceres']), label='Orginating School' ),
> Field('book_location', requires=IS_IN_SET(['AMA Computer 
> College - Naga Campus', 'Ateneo de Naga University', 'Naga College 
> Foundation', 'Computer Communication Development Institute', 'University of 
> Nueva Caceres']), label='Location' ),
> Field('book_proponents', requires=IS_NOT_EMPTY(), 
> label='Thesis Proponents' ),
> Field('book_category', requires=IS_IN_SET(['Education, 
> Science and Teacher Training', 'Fine and Applied Arts', 'Humanities', 
> 'Religion and Theology', 'Social Behavioral Sciences', 'Business 
> Administration and Related', 'Law and Jurispusence', 'Natural Science', 
> 'Mathematics', 'IT-Related 

[web2py] Re: UnboundLocalError: local variable 'books' referenced before assignment

2017-03-20 Thread Anthony
Show the full traceback and indicate the line of code actually throwing the 
error.

On Monday, March 20, 2017 at 9:38:38 AM UTC-4, Joe Dunst wrote:
>
>
> I'm trying to make a "vote up" and "vote down" feature in my program, like 
> the one in reddit.com. But I've been receiving tickets from 2 different 
> errors. (I solved the first one but I want to 
> First, I received a "UnboundLocalError: local variable 'books' referenced 
> before assignment"
> This was my code at the time when I had that error.
> *CONTROLLER: *
> def vote_callback():
> vars = request.post_vars
> if vars and auth_user:
> *id = vars.id *
> direction = +1 if vars.direction == 'up' else -1
> *books = db.books(id)*
> if books:
> votes = db.votes(post=id, created_by=auth.user.id)
> if not votes:
> books.update_record(vote_book=books.book_vote+direction)
> db.votes.insert(post=id,score=direction)
> elif votes.score!=direction:
> books.update_record(vote_book=books.book_vote+direction)
> votes.update_record(score=direction)
> else:
> pass
> print books.book_vote
> return str(books.book_vote)
>
>
> *VIEW:*
> 
> https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js
> ">
>
> 
> 
>
> This is the default/list_books_by_vote.html template
>
> {{if request.function=='list_books_by_vote':}}
> {{=A('sort by datetime', _class='btn', 
> _href=URL('list_books_by_datetime'))}}
>
> {{elif request.function=="list_books_by_datetime":}}
> {{=A('sort by votes', _class='btn', _href=URL('list_books_by_vote'))}}
>
> {{else:}}
> 
> {{=author(user_id)}}
> 
> {{pass}}
>
> {{for post in rows:}}
> 
> 
> http://post.id>}}"*>
> 
> 
> Remove vote
> 
>  
> 
> 
> *{{=post.book_vote}}*
> 
>  
> 
>  style="margin-left:5px;margin-right:5px;">
> I referenced this!
> 
> 
> 
> {{=A(post.book_title, 
> _href=URL('show_specific_user', args=post.id))}}
> 
> 
> 
> {{=author(post.modified_by)}}
> 
> 
> 
> 
> 
> {{pass}}
>
> **
> *function do_ajax_vote(t, direction) {*
> *var id = jQuery(t).closest('tr').attr('data-id');*
> *jQuery.ajax({method:'post',url:'{{=URL('vote_callback')}}',*
> * data:{'id':id,'direction':direction},*
> * success: function(data){*
> *
>  jQuery(t).closest('tr').find('.votes').html(data);*
> *} });*
> *}*
>
> *jQuery(function() {*
> *jQuery('[data-direction=up]').click(function(){do_ajax_vote(this, 
> 'up');});*
> *
> jQuery('[data-direction=down]').click(function(){do_ajax_vote(this, 
> 'down');});*
> *});*
> **
> 
>
>
> *Model:*
> db.define_table('books',
> Field('book_title', 'string', 
> requires=(IS_NOT_IN_DB(db,'books.book_title'), IS_NOT_EMPTY()), 
> label='Thesis Title'),
> Field('book_subtitle', 'string', label='Thesis Subtitle 
> (Optional)'),
> Field('book_date', type='date', requires=IS_DATE(), 
> label='Publish Date' ),
> Field('book_abstract', type='text', 
> requires=IS_NOT_EMPTY() , label='Thesis Abstract' ),
> Field('book_school', requires=IS_IN_SET(['AMA Computer 
> College - Naga Campus', 'Ateneo de Naga University', 'Naga College 
> Foundation', 'Computer Communication Development Institute', 'University of 
> Nueva Caceres']), label='Orginating School' ),
> Field('book_location', requires=IS_IN_SET(['AMA Computer 
> College - Naga Campus', 'Ateneo de Naga University', 'Naga College 
> Foundation', 'Computer Communication Development Institute', 'University of 
> Nueva Caceres']), label='Location' ),
> Field('book_proponents', requires=IS_NOT_EMPTY(), 
> label='Thesis Proponents' ),
> Field('book_category', requires=IS_IN_SET(['Education, 
> Science and Teacher Training', 'Fine and Applied Arts', 'Humanities', 
> 'Religion and Theology', 'Social Behavioral Sciences', 'Business 
> Administration and Related', 'Law and Jurispusence', 'Natural Science', 
> 'Mathematics', 'IT-Related Disciplines', 'Engineering and Tech', 'Medical 
> and Allied', 'Trade, Craft and Industrial', 'Architecture and Town 
> Planning', 'Agriculture, Forestry, Fisheries', 'Home Economics', 'Service 
> Trades', 'Mass Communication and Documentation', 'Maritime', 'General', 
> 'Other Disciplines']), label='Thesis Category' ),
> Field('book_level', requires=IS_IN_SET(['Undergraduate', 
> 'Masteral']), label='Thesis Level' ),
>  

Re: [web2py] Re: Comparar hash dinamicamente em uma consulta

2017-03-20 Thread Rodrigo attique santana
Sorry me, I did not know I was in the international group. My question is
this, I have the structure below:

Clients = db.define_table('clients'
   ,Field('name')
   ,Field('document',unique=True)
   ,Field('email_login','string')
   ,Field('passwd','string')
   ,Field('telephone','list:string')
   ,Field('address','list:string')
   ,Field('status')
  )
I need made a validation to this client, because other micro througth web
sent me a hash witch the data: email_login, passwd and document each. So,
on the controller I compare this data to the database, because on the
database the data is not criptografed.
See example:

A micro from the external network will send me a hash with the document,
email_login and passwd encrypted, separately. I need to make a query so
that I can encrypt this data in the database to buy it, something like:



cliente = db(hashlib.md5(
  (Clientes.senha).hexdigest()==request.args(0)) |
(Clientes.documento).hexdigest()==request.args(0))
|  (Clientes.email_login).hexdigest()==request.args(0)).select()

select * from clientes where md5(email_login) = argumento_hash or 

Em 19 de março de 2017 19:11, Marlysson Silva 
escreveu:

> Aqui é o grupo internacional , sugeriria postar a pergunta em inglês
> também.
>
> Ou então postar no grupo pt-br do web2py, lá o pessoal ajuda também.
> https://groups.google.com/forum/#!forum/web2py-users-brazil
>
> Mas o que está querendo é validar o login do usuário?
>
> Here it the web2py international group , would sugest you post the ask in
> english too.
>
> Or so to post in portuguese group's web2py , there are person help too.
>
> But what you want to do is validate the user login?
>
> Em sábado, 18 de março de 2017 15:57:05 UTC-3, Rodrigo attique santana
> escreveu:
>>
>> Olá meus amigos.
>> Estou postando esta dúvida aqui pois não encontrei nada na net e acredito
>> que possa ser de utilidade para muitos.
>>
>> Tenho a seguinte estrutura:
>> Clientes = db.define_table('clientes'
>>,Field('nome')
>>,Field('documento',unique=True)
>>,Field('email_login','string')
>>,Field('senha','string')
>>,Field('telefone','list:string')
>>,Field('endereco','list:string')
>>,Field('status')
>>   )
>>
>> Eu preciso fazer uma validação para este cliente pois o sistema externo
>> me enviará um hash com um campo aleatório, email_login, senha, documento.
>> No banco de dados estes campos não estão criptografados eu preciso
>> criptografá-los em tempo de consulta. Como em:
>>
>> cliente = db(hashlib.md5(
>>   (Clientes.senha).hexdigest()==request.args(0)) |
>> (Clientes.documento).hexdigest()==request.args(0)) |
>>  (Clientes.email_login).hexdigest()==request.args(0)).select()
>>
>> Tipo, ele tem que converter em md5 no memento da consulta. Como ein:
>>
>> select * from clientes where md5(email_login) = argumento_hash or 
>>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/web2py/vEEU4dkL8sI/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
ATT
Rodrigo Attique - Programador Desenvolvedor
9 8203.4651 / 9 9151.8339 (whatsapp)
www.attiquetecnologia.com.br

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the 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: Smartrgrid verify old value on record before update

2017-03-20 Thread Anthony


> def is_bigger(form):
> idUpdate = request.args(3).first
>

What is .first supposed to do?
 

> r = db(db.t_myTable.f_quantity==idUpdate.id).select()
>

The above returns a Rows object -- you need to extract the Row from it -- 
so, use .select().first().

Anthony

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


[web2py] Re: RuntimeError: no driver available ('pymongo',) - Windows 8.1

2017-03-20 Thread Anthony
You are responsible for installing the drivers for any databases you want 
to use (with the exception of SQLite, as the Python standard library 
includes its own interface). For PyMongo, see 
http://api.mongodb.com/python/current/installation.html.

Anthony

On Monday, March 20, 2017 at 9:41:33 AM UTC-4, vikas mittal wrote:
>
> Hi All,
>
> I am getting the following issue when I am trying to connect web2py with 
> mongoDB. 
> Can someone help what I am missing and how to make the pymongo driver 
> available on my windows 8.1 on which I am running web2py.
> Sincere Thanks. 
>
>
>
>
> Error ticket for "images"
> Ticket ID
> 127.0.0.1.2017-03-08.16-24-27.5afd0b41-a763-4964-b42b-42d53e6de99a
>
>  Failure to connect, tried 5 times: 
> Traceback (most recent call last): File 
> "C:\Users\web2py\web2py001\gluon\packages\dal\pydal\base.py", line 446, in 
> __init__ self._adapter = ADAPTERS[self._dbname](**kwargs) File 
> "C:\Users\web2py\web2py001\gluon\packages\dal\pydal\adapters\base.py", line 
> 60, in __call__ obj = super(AdapterMeta, cls).__call__(*args, **kwargs) 
> File 
> "C:\Users\web2py\web2py001\gluon\packages\dal\pydal\adapters\mongo.py", 
> line 83, in __init__ self.find_driver(adapter_args) File 
> "C:\Users\web2py\web2py001\gluon\packages\dal\pydal\adapters\base.py", line 
> 192, in find_driver raise RuntimeError("no driver available %s" % 
> str(self.drivers)) RuntimeError: no driver available ('pymongo',)
>
> Version
> web2py™ Version 2.14.6-stable+timestamp.2016.05.10.00.21.47
>
> Traceback
>
> Traceback (most recent call last):
>   File "C:\Users\web2py\web2py001\gluon\restricted.py", line 227, in 
> restricted
> exec ccode in environment
>   File "C:/Users/web2py/web2py001/applications/images/models/db.py", line 
> 1, in 
> db = DAL('mongodb://wuser001:mongodb@localhost:27017/wikiweb')
>   File "C:\Users\web2py\web2py001\gluon\packages\dal\pydal\base.py", line 
> 174, in __call__
> obj = super(MetaDAL, cls).__call__(*args, **kwargs)
>   File "C:\Users\web2py\web2py001\gluon\packages\dal\pydal\base.py", line 
> 473, in __init__
> "Failure to connect, tried %d times:\n%s" % (attempts, tb)
> RuntimeError: Failure to connect, tried 5 times:
> Traceback (most recent call last):
>   File "C:\Users\web2py\web2py001\gluon\packages\dal\pydal\base.py", line 
> 446, in __init__
> self._adapter = ADAPTERS[self._dbname](**kwargs)
>   File 
> "C:\Users\web2py\web2py001\gluon\packages\dal\pydal\adapters\base.py", line 
> 60, in __call__
> obj = super(AdapterMeta, cls).__call__(*args, **kwargs)
>   File 
> "C:\Users\web2py\web2py001\gluon\packages\dal\pydal\adapters\mongo.py", 
> line 83, in __init__
> self.find_driver(adapter_args)
>   File 
> "C:\Users\web2py\web2py001\gluon\packages\dal\pydal\adapters\base.py", line 
> 192, in find_driver
> raise RuntimeError("no driver available %s" % str(self.drivers))
> RuntimeError: no driver available ('pymongo',)
>
> In file: C:\Users\web2py\web2py001\applications\images\models\db.py
>
> db = DAL('mongodb://wuser001:mongodb@localhost:27017/wikiweb')
>
> db.define_table('image',
> Field('title', unique=True),
> Field('file', 'upload'),
> format = '%(title)s')
>
> db.define_table('post',
> Field('image_id', 'reference image'),
> Field('author'),
> Field('email'),
> Field('body', 'text'))
>
> db.image.title.requires = IS_NOT_IN_DB(db, db.image.title)
> db.post.image_id.requires = IS_IN_DB(db, db.image.id, '%(title)s')
> db.post.author.requires = IS_NOT_EMPTY()
> db.post.email.requires = IS_EMAIL()
> db.post.body.requires = IS_NOT_EMPTY()
>
> db.post.image_id.writable = db.post.image_id.readable = False
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the 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: SQLFORM() as input to create query for SQLFORM.Grid

2017-03-20 Thread Anthony
query = ((db.paymenttype.id 

 
== request.vars.paymenttype) &
 (db.tariffrate.rate < request.vars.tariffrate) &
 [more conditions based on request.vars] &
 [conditions joining various tables involved in above queries])
grid = SQLFORM.grid(query)

Probably you need to review the documentation on queries 

 
and joins. 

 
Also, note that request.vars is a dictionary-like Storage object, so it is 
request.vars.variable_name, not request.vars(variable_name).

Anthony

On Monday, March 20, 2017 at 9:42:01 AM UTC-4, ross mclean wrote:
>
> Hi All,
>
> newbie in python and stuck on creating a query from a sqlform() suitable 
> to use for querying multiple table and returning in a datagrid.
>
>
>
> Each drop down is connected to a unique table -> I would like on submit to 
> used the request.vars and pass these in a query to return the data grid 
> like -
>
> select * from paymenttype, supplier, tariff, tariffrate 
> where
> paymenttype.id 
> 
>  
> = request.vars(paymenttype) and tariffrate.rate
> Any pointers / ideas?
>
> Cheers
>
> Ross
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the 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: Insert record with dynamic multiples fields

2017-03-20 Thread Anthony
db_handle.MYTAB.insert(**wFields)

Anthony

On Monday, March 20, 2017 at 9:42:38 AM UTC-4, dicolla wrote:
>
> I'd like to convert this static INSERT command:
>
> db_handle.MYTAB.insert(date='1212121', time='99' )
>
> in a dynamic command like this:
>
> wFields=[]
> wFields.append( {'date':'1212121'} )
> wFields.append( {'time':'99'} )
> db_handle.MYTAB.insert(wFields)
>
> but I got an error:
>
> Error processing ..., insert() takes exactly 1 argument (2 given)
>
> If I use: 
>
>   db_handle.MYTAB.insert(*wFields)
>
> I got the error:
>
> Error processing ..., insert() takes exactly 1 argument (3 given)
>
>
> So, how can I build dynamically the set of parameters when calling the 
> function INSERT of WEB2PY ?
>
>
> I use this way to create a TABLE with dynamic FIELDS and this works with 
> no problem:
>
>wFields = []
>
> for key, pos,  in template_fields:
> wName = str(key)
> wFields.append(Field( wName ))
>
> db_handle.define_table('IISLOG', *wFields )
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the 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: Quick few questions

2017-03-20 Thread Anthony
On Monday, March 20, 2017 at 9:38:00 AM UTC-4, paul...@gmail.com wrote:
>
> Howdy. I have a task with web2py. This is my first experience. My 
> background is in Flask/Django. Here are a few quick questions:
>
> 1. I have an image in the a database. The model is defined like this: 
>
> Field('Image', "upload", requires=[ 
> IS_NOT_EMPTY()], autodelete=True, uploadfolder='uploads/', notnull=False, 
> label=T('Images'), 
> represent=lambda x, row: x and A('%s' % 
> (db.package.Images.retrieve(x)[0]), 
> _href=URL( 
> 'default', 'template/viewer.html', args=x), 
> _target="_blank", 
> _title=T("Open Image"), 
> _class='file-reference') 
> or ''),
>
> Can someone explain what this does conceptually? 
> db.package.Images.retrieve(x)[0]
>

The .store and .retrieve methods are explained here: 
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#More-on-uploads.

When a file is stored, it is renamed, and its original name is encoded in 
the new name. The .retrieve() method returns a tuple, including the 
original name (decoded from the new name) and the open file stream itself. 
So., .retrieve(x)[0] is simply the original file name.

Note, the above code would likely generate an exception, because the actual 
field name is "Image", but the code refers to db.package.Images (note 
"Images" rather than "Image").

Anthony

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


[web2py] inner join taking too long

2017-03-20 Thread 'John Philip' via web2py-users
Hi there,

I have two tables that I have queried using an inner join the query outputs 
about 50,000 + records this is no problem on sqlite however it does not 
seem to load on web2py. Is there something I am doing wrong?


import json
def get_dpc():
rows = 
db(db.plf.PLF_NAME==db.pcf.PCF_NAME).select(db.plf.PLF_NAME,db.pcf.PCF_DESCR).as_list()
return dict(dpc_list=gluon.contrib.simplejson.dumps(rows))



any help would be greatly appreciated.

regards,

John

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the 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: edit or delete child or detail table on SQLFORM.grid with left join

2017-03-20 Thread Fabiano Almeida
Thanks Massimo, I will try this.

2017-03-20 11:41 GMT-03:00 Massimo Di Pierro :

> Unfortunately not out of the box. You need a custom button that does a
> ajax query.
>
>
> On Friday, 3 March 2017 17:52:30 UTC-6, 黄祥 wrote:
>>
>> is it possible to edit or delete child or detail table on SQLFORM.grid
>> with left join?
>> i've tried before it seems the edit is for the first table (parent or
>> header), the child or detail table cannot be edited or deleted with left
>> join in SQLFORM.grid.
>> *e.g.*
>> def report_production_result():
>> table_header = db.production_result_header
>> table_detail = db.production_result_detail
>>
>> orderby = ~table_header.id
>> left = table_detail.on(table_header.id == table_detail.production_result
>> _no)
>> fields = [
>>  # header
>>  table_header.id, table_header.production_result_no,
>> table_header.production_result_date,
>>  table_header.shift, table_header.origin, table_header.status,
>>  # detail
>>  table_detail.stock, table_detail.quantity]
>> grid = SQLFORM.grid(table_header, fields = fields, left = left, orderby =
>> orderby)
>> return locals()
>>
>> thanks and best regards,
>> stifan
>>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the 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: Smartrgrid verify old value on record before update

2017-03-20 Thread Santiago Cartasegna
I have made a workarround.

if (request.args[1] == 'edit'):
#obtenemos el id del campo a modificar
idUpdate = request.args[3]


El lunes, 20 de marzo de 2017, 10:40:23 (UTC-3), Santiago Cartasegna 
escribió:
>
> Hello,
>
> I am trying to do some validation before updating a record. My idea is to 
> verify that the new value of a field is bigger than the old one.
>
> However I am not getting how to do it:
>
>
> table definition:
>
>
> db.define_table('t_myTable',
> Field('f_year', type='integer',
>   label=T('Año')),
> Field('f_quantity', type='integer',
>   label=T('cantidad')),
> Field('f_user', type='reference auth_user',
>   label=T('Cargo'),default=auth.user_id,writable=False),
> auth.signature,
> format='%(f_year)s',
> migrate=settings.migrate)
>
>
> On my controller:
>
>
> # -*- coding: utf-8 -*-
> @auth.requires_login()
> def viewTable():
> form = SQLFORM.smartgrid(db.t_myTable,onupdate=auth.archive,deletable=
> False,csv=False,details=False,searchable=False
> ,onvalidation=is_bigger)
> return locals()
>
>
> def is_bigger(form):
> idUpdate = request.args(3).first
> r = db(db.t_myTable.f_quantity==idUpdate.id).select()
> if r.f_quantity < form.vars.f_quantity:
> form.errors.f_quantity = 'Some error message ' % (r.f_quantity)
>
>
> I am not getting the way of get the OLD row value before update
>

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


Re: [web2py] Re: web2py + apache2 can't load Theano (Ubuntu Server 14.04)

2017-03-20 Thread Jordan Myers
Thank you for the reply. Apparently the issue was only when I tried to
import theano in a controller. This worked with the rocket server, but not
with Apache for some reason. Moving the code to a module and only invoking
it with my web2py_scheduler service solved the issue (an immediate response
is not required for this application).

On Mon, Mar 20, 2017 at 9:43 AM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> How is theano installed? Could it be apache2 is using a different
> pythonversion? In any case, I recommend you use Nginx over Apache.
>
>
> On Monday, 6 March 2017 14:17:10 UTC-6, Jordan Myers wrote:
>>
>> Hello
>>
>> I've migrated my code to start using Apache2 after successful setup just
>> using built-in Rocket server, but now for some reason loading Theano leads
>> to import error. I thought maybe the issue was with Cython or something,
>> but it will successfully import NumPy, Scipy, Gensim, and other libraries
>> that are compiled to c. Again, Theano worked fine in old Rocket setup.
>>
>> Does anyone have an idea of what the issue is? If it helps, I once got a
>> different error that Theano complained about not having access to write
>> compile logs, but I then corrected that issue by modifying permissions in
>> the applicable folder and the error just goes back to being a normal
>> "cannot import module applications.[myapp].modules.theano" Theano is
>> installed in /usr/*local*/lib/python2.7/dist-packages/ (verified by
>> running help('theano') in python prompt) instead of
>> /usr/lib/python2.7/dist-packages/ in case that's relevant.
>>
>> Thanks for any suggestions,
>> -Jordan
>>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/web2py/A-Jzv3WM0t8/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


[web2py] Re: Radius Authentication

2017-03-20 Thread Massimo Di Pierro
Does this help?

web2py/gluon/contrib/login_methods/loginradius_account.py 

On Tuesday, 14 March 2017 15:31:22 UTC-5, Fabiano Almeida wrote:
>
> Hi All!
>
> Is it possible to authenticate web2py users through the freeradius server?
>
> Thx
>

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


[web2py] Re: edit or delete child or detail table on SQLFORM.grid with left join

2017-03-20 Thread Massimo Di Pierro
Unfortunately not out of the box. You need a custom button that does a ajax 
query. 


On Friday, 3 March 2017 17:52:30 UTC-6, 黄祥 wrote:
>
> is it possible to edit or delete child or detail table on SQLFORM.grid 
> with left join?
> i've tried before it seems the edit is for the first table (parent or 
> header), the child or detail table cannot be edited or deleted with left 
> join in SQLFORM.grid.
> *e.g.*
> def report_production_result():
> table_header = db.production_result_header
> table_detail = db.production_result_detail
>
> orderby = ~table_header.id
> left = table_detail.on(table_header.id == 
> table_detail.production_result_no)
> fields = [
>  # header
>  table_header.id, table_header.production_result_no, 
> table_header.production_result_date, 
>  table_header.shift, table_header.origin, table_header.status, 
>  # detail
>  table_detail.stock, table_detail.quantity]
> grid = SQLFORM.grid(table_header, fields = fields, left = left, orderby = 
> orderby)
> return locals()
>
> thanks and best regards,
> stifan
>

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


[web2py] Re: web2py + apache2 can't load Theano (Ubuntu Server 14.04)

2017-03-20 Thread Massimo Di Pierro
How is theano installed? Could it be apache2 is using a different 
pythonversion? In any case, I recommend you use Nginx over Apache.


On Monday, 6 March 2017 14:17:10 UTC-6, Jordan Myers wrote:
>
> Hello
>
> I've migrated my code to start using Apache2 after successful setup just 
> using built-in Rocket server, but now for some reason loading Theano leads 
> to import error. I thought maybe the issue was with Cython or something, 
> but it will successfully import NumPy, Scipy, Gensim, and other libraries 
> that are compiled to c. Again, Theano worked fine in old Rocket setup. 
>
> Does anyone have an idea of what the issue is? If it helps, I once got a 
> different error that Theano complained about not having access to write 
> compile logs, but I then corrected that issue by modifying permissions in 
> the applicable folder and the error just goes back to being a normal 
> "cannot import module applications.[myapp].modules.theano" Theano is 
> installed in /usr/*local*/lib/python2.7/dist-packages/ (verified by 
> running help('theano') in python prompt) instead of 
> /usr/lib/python2.7/dist-packages/ in case that's relevant.
>
> Thanks for any suggestions,
> -Jordan
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the 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] server rocket

2017-03-20 Thread Елена Серебрянникова
Hello. Necessary remote admin via the rocket. Please tell me.

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


[web2py] wiki demo local variable 'gid' referenced before assignment

2017-03-20 Thread Arthur Gilbert
Just started web2py.
I got the above error at http://127.0.0.1:8000/wikidemo/default/index.
What am I doing wrong?



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the 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] Access DB2/400 from IBM i (AS/400) PASE environment

2017-03-20 Thread António Ramos
Iseries 7.x in the cloud

http://pub400.com/

tutorial about iseries using pub400

https://www.youtube.com/watch?v=vTOC0YXs9Ts

2017-03-20 14:07 GMT+00:00 Jim Steil :

> Are you familiar with Aaron Bartell's work and litmis spaces?
> spaces.litmis.com
>
> There you can get a free PASE session on their boxes.  Use the code BETA
> when signing up.  Let me know if you have any questions.
>
> -Jim
>
> On Mon, Mar 20, 2017 at 8:56 AM, 'DenesL' via web2py-users <
> web2py@googlegroups.com> wrote:
>
>>
>> Last summer uh? Not keeping up with i news lately...
>>
>> I looked it up as soon as I saw your post today, that is why I said it
>> seems to need a modified adapter to map things thru ibm_db.
>> It might be fairly easy and I would like to help but the lack of a newer
>> i box to test with doesn't help.
>>
>> Denes
>>
>> On Monday, March 20, 2017 at 9:31:04 AM UTC-4, Jim S wrote:
>>>
>>> Yes, support became available for Python 2 and Python 3 last summer.
>>> Came out in Technology Refreshes.  They still have a long way to go getting
>>> more packages supported, but base support is there.  They also have a local
>>> dbapi connector to connect to a DB2/400 database which is what I'm trying
>>> to connect to with the DAL.
>>>
>>> I don't know where to begin modifying an adapter, looking for help.
>>>
>>> -Jim
>>>
>>> On Monday, March 20, 2017 at 8:18:41 AM UTC-5, DenesL wrote:

 Hi Jim

 Python officially supported on i, finally!!
 I wish this had happened a while back.

 It seems that this would require a modified adapter in web2py,
 sadly I have no access to a current 7.x box to test.

 Denes

 On Saturday, March 18, 2017 at 11:11:34 AM UTC-4, Jim S wrote:
>
> In this example he is connecting using a DB2 connector.  However, I'm
> hoping to use the ibm_db_dbi connector and don't know how to specify it on
> the dal connection.  He is using:
>
> db = DAL('db2://DSN=MYDSN;UID=x;PWD=x', migrate_enabled=False)
>
>
> I'm not sure what to put in place of the db2://DSN...
>
> Anyone?
>
> -Jim
>
>
> On Fri, Mar 17, 2017 at 7:38 PM, António Ramos wrote:
>
>> maybe
>> http://www.web2pyslices.com/slice/show/1474/calling-remote-p
>> rogram-on-db2-from-pythonweb2py
>>
>>
>>
>>
>> <#m_8440901031396165177_m_-7554748344480484208_269cefbd-24e0-4f4b-98ec-bed31dff4d60@googlegroups.com_c78e0319-5078-4af6-9a39-37e920755dac@googlegroups.com_CAERBpoCttAv9kGK=rqf1z1TiNvGQS-h99VwVWD9JJZ3ZAVeMaw@mail.gmail.com_m_-838279669736982895_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>>
>> 2017-03-17 21:06 GMT+00:00 Jim S :
>>
>>> Hi
>>>
>>> In a former (and somewhat current) life I was an AS/400 guy.  Our
>>> shop still uses the platform though most of my time is spent on Python 
>>> and
>>> web2py now.
>>>
>>> Recently Python became available and officially supported on IBM i
>>> and I'm trying to get web2py running there accessing the local DB2/400
>>> database.  Using the local python on the system I can create a database
>>> connection to the local database doing this:
>>>
>>> import ibm_db_dbi as db
>>>
>>> conn = db.connect(database='*LOCAL')
>>>
>>> I'm hoping to find an easy way to convert this into a connectstring
>>> for the DAL so I can have my database created there.  The SQL-flavor it
>>> should use would be the same as ODBC-flavored SQL.
>>>
>>> Can anyone give me a clue how to modify the DAL code to connect to
>>> my db?  Any pointers to other articles or links would really be
>>> appreciated.  It would be exciting for me to get this working since I 
>>> could
>>> then show RPG developers how easy it would be to get an application on 
>>> the
>>> web from the AS/400 using python/web2py.
>>>
>>> -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 a topic in the
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit https://groups.google.com/d/to
>> pic/web2py/qrlN5TSSBgs/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to 

[web2py] Re: Quick few questions

2017-03-20 Thread Jim S
I'm not sure about questions 1 and 2, but for 3 and 4...

3.  Look at SQLFORM.grid in the book 
- 
http://web2py.com/books/default/chapter/29/07/forms-and-validators#SQLFORM-grid
4.  You wouldn't add them to 'membership' admin, but to 'group' admin. 
 Something like db.auth_membership.insert(userid=999, group_id=1234)  where 
999 is the id of the user and 1234 is the id of the Admin group.  See here: 
 
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#insert
 
 for more info on inserting records and 
here: 
http://web2py.com/books/default/chapter/29/09/access-control#Authorization 
 for more info on authentication and authorization.

-Jim


On Monday, March 20, 2017 at 8:38:00 AM UTC-5, pau...@gmail.com wrote:
>
> Howdy. I have a task with web2py. This is my first experience. My 
> background is in Flask/Django. Here are a few quick questions:
>
> 1. I have an image in the a database. The model is defined like this: 
>
> Field('Image', "upload", requires=[ 
> IS_NOT_EMPTY()], autodelete=True, uploadfolder='uploads/', notnull=False, 
> label=T('Images'), 
> represent=lambda x, row: x and A('%s' % 
> (db.package.Images.retrieve(x)[0]), 
> _href=URL( 
> 'default', 'template/viewer.html', args=x), 
> _target="_blank", 
> _title=T("Open Image"), 
> _class='file-reference') 
> or ''),
>
> Can someone explain what this does conceptually? 
> db.package.Images.retrieve(x)[0]
>
> If I understand, this will look in the package table, in the Image field, 
> and it will retrieve the image that matches x (which is the value of x in 
> this table). What I'm not sure, is it matches x and pulls the first 
> element. I'm probably going to wipe this code and not use it (it doesn't 
> work) but I'm curious what it was attempting to do. 
>
> 2. How can I display the image and have it clickable (I have it to show 
> the text currently). I see the images get uploaded to 'uploads/'.  I'm 
> having trouble finding exactly how retrieve() works in the docs, perhaps 
> I've been looking in the wrong place.
>
> 3. I want to build a basic CRUD admin interface to manage a table defined 
> in the model. Any two cents on where I can start here? I've gone through 
> some of the docs.
>
> 4. How do I add a user to a membership 'admin' ? 
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the 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] Access DB2/400 from IBM i (AS/400) PASE environment

2017-03-20 Thread Jim Steil
Are you familiar with Aaron Bartell's work and litmis spaces?
spaces.litmis.com

There you can get a free PASE session on their boxes.  Use the code BETA
when signing up.  Let me know if you have any questions.

-Jim

On Mon, Mar 20, 2017 at 8:56 AM, 'DenesL' via web2py-users <
web2py@googlegroups.com> wrote:

>
> Last summer uh? Not keeping up with i news lately...
>
> I looked it up as soon as I saw your post today, that is why I said it
> seems to need a modified adapter to map things thru ibm_db.
> It might be fairly easy and I would like to help but the lack of a newer i
> box to test with doesn't help.
>
> Denes
>
> On Monday, March 20, 2017 at 9:31:04 AM UTC-4, Jim S wrote:
>>
>> Yes, support became available for Python 2 and Python 3 last summer.
>> Came out in Technology Refreshes.  They still have a long way to go getting
>> more packages supported, but base support is there.  They also have a local
>> dbapi connector to connect to a DB2/400 database which is what I'm trying
>> to connect to with the DAL.
>>
>> I don't know where to begin modifying an adapter, looking for help.
>>
>> -Jim
>>
>> On Monday, March 20, 2017 at 8:18:41 AM UTC-5, DenesL wrote:
>>>
>>> Hi Jim
>>>
>>> Python officially supported on i, finally!!
>>> I wish this had happened a while back.
>>>
>>> It seems that this would require a modified adapter in web2py,
>>> sadly I have no access to a current 7.x box to test.
>>>
>>> Denes
>>>
>>> On Saturday, March 18, 2017 at 11:11:34 AM UTC-4, Jim S wrote:

 In this example he is connecting using a DB2 connector.  However, I'm
 hoping to use the ibm_db_dbi connector and don't know how to specify it on
 the dal connection.  He is using:

 db = DAL('db2://DSN=MYDSN;UID=x;PWD=x', migrate_enabled=False)


 I'm not sure what to put in place of the db2://DSN...

 Anyone?

 -Jim


 On Fri, Mar 17, 2017 at 7:38 PM, António Ramos wrote:

> maybe
> http://www.web2pyslices.com/slice/show/1474/calling-remote-
> program-on-db2-from-pythonweb2py
>
>
>
>
> <#m_-7554748344480484208_269cefbd-24e0-4f4b-98ec-bed31dff4d60@googlegroups.com_c78e0319-5078-4af6-9a39-37e920755dac@googlegroups.com_CAERBpoCttAv9kGK=rqf1z1TiNvGQS-h99VwVWD9JJZ3ZAVeMaw@mail.gmail.com_m_-838279669736982895_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>
> 2017-03-17 21:06 GMT+00:00 Jim S :
>
>> Hi
>>
>> In a former (and somewhat current) life I was an AS/400 guy.  Our
>> shop still uses the platform though most of my time is spent on Python 
>> and
>> web2py now.
>>
>> Recently Python became available and officially supported on IBM i
>> and I'm trying to get web2py running there accessing the local DB2/400
>> database.  Using the local python on the system I can create a database
>> connection to the local database doing this:
>>
>> import ibm_db_dbi as db
>>
>> conn = db.connect(database='*LOCAL')
>>
>> I'm hoping to find an easy way to convert this into a connectstring
>> for the DAL so I can have my database created there.  The SQL-flavor it
>> should use would be the same as ODBC-flavored SQL.
>>
>> Can anyone give me a clue how to modify the DAL code to connect to my
>> db?  Any pointers to other articles or links would really be appreciated.
>> It would be exciting for me to get this working since I could then show 
>> RPG
>> developers how easy it would be to get an application on the web from the
>> AS/400 using python/web2py.
>>
>> -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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/web2py/qrlN5TSSBgs/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [web2py] Access DB2/400 from IBM i (AS/400) PASE environment

2017-03-20 Thread 'DenesL' via web2py-users

Last summer uh? Not keeping up with i news lately...

I looked it up as soon as I saw your post today, that is why I said it 
seems to need a modified adapter to map things thru ibm_db.
It might be fairly easy and I would like to help but the lack of a newer i 
box to test with doesn't help.

Denes 

On Monday, March 20, 2017 at 9:31:04 AM UTC-4, Jim S wrote:
>
> Yes, support became available for Python 2 and Python 3 last summer.  Came 
> out in Technology Refreshes.  They still have a long way to go getting more 
> packages supported, but base support is there.  They also have a local 
> dbapi connector to connect to a DB2/400 database which is what I'm trying 
> to connect to with the DAL.
>
> I don't know where to begin modifying an adapter, looking for help.
>
> -Jim
>
> On Monday, March 20, 2017 at 8:18:41 AM UTC-5, DenesL wrote:
>>
>> Hi Jim
>>
>> Python officially supported on i, finally!!
>> I wish this had happened a while back.
>>
>> It seems that this would require a modified adapter in web2py,
>> sadly I have no access to a current 7.x box to test.
>>
>> Denes
>>
>> On Saturday, March 18, 2017 at 11:11:34 AM UTC-4, Jim S wrote:
>>>
>>> In this example he is connecting using a DB2 connector.  However, I'm 
>>> hoping to use the ibm_db_dbi connector and don't know how to specify it on 
>>> the dal connection.  He is using:
>>>
>>> db = DAL('db2://DSN=MYDSN;UID=x;PWD=x', migrate_enabled=False)
>>>
>>>
>>> I'm not sure what to put in place of the db2://DSN...
>>>
>>> Anyone?
>>>
>>> -Jim
>>>
>>>
>>> On Fri, Mar 17, 2017 at 7:38 PM, António Ramos wrote:
>>>
 maybe

 http://www.web2pyslices.com/slice/show/1474/calling-remote-program-on-db2-from-pythonweb2py




 <#269cefbd-24e0-4f4b-98ec-bed31dff4d60@googlegroups.com_c78e0319-5078-4af6-9a39-37e920755dac@googlegroups.com_CAERBpoCttAv9kGK=rqf1z1TiNvGQS-h99VwVWD9JJZ3ZAVeMaw@mail.gmail.com_m_-838279669736982895_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

 2017-03-17 21:06 GMT+00:00 Jim S :

> Hi
>
> In a former (and somewhat current) life I was an AS/400 guy.  Our shop 
> still uses the platform though most of my time is spent on Python and 
> web2py now.
>
> Recently Python became available and officially supported on IBM i and 
> I'm trying to get web2py running there accessing the local DB2/400 
> database.  Using the local python on the system I can create a database 
> connection to the local database doing this:
>
> import ibm_db_dbi as db
>
> conn = db.connect(database='*LOCAL')
>
> I'm hoping to find an easy way to convert this into a connectstring 
> for the DAL so I can have my database created there.  The SQL-flavor it 
> should use would be the same as ODBC-flavored SQL.  
>
> Can anyone give me a clue how to modify the DAL code to connect to my 
> db?  Any pointers to other articles or links would really be appreciated. 
>  
> It would be exciting for me to get this working since I could then show 
> RPG 
> developers how easy it would be to get an application on the web from the 
> AS/400 using python/web2py.
>
> -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] Access DB2/400 from IBM i (AS/400) PASE environment

2017-03-20 Thread Jim Steil
Ok, last summer in the US.  I think it was in July of 2016 but not sure.

On Mon, Mar 20, 2017 at 8:39 AM, José Ricardo Borba 
wrote:

> Last summer? We are in summer!
>
> 2017-03-20 10:31 GMT-03:00 Jim S :
>
>> Yes, support became available for Python 2 and Python 3 last summer.
>> Came out in Technology Refreshes.  They still have a long way to go getting
>> more packages supported, but base support is there.  They also have a local
>> dbapi connector to connect to a DB2/400 database which is what I'm trying
>> to connect to with the DAL.
>>
>> I don't know where to begin modifying an adapter, looking for help.
>>
>> -Jim
>>
>>
>> On Monday, March 20, 2017 at 8:18:41 AM UTC-5, DenesL wrote:
>>>
>>> Hi Jim
>>>
>>> Python officially supported on i, finally!!
>>> I wish this had happened a while back.
>>>
>>> It seems that this would require a modified adapter in web2py,
>>> sadly I have no access to a current 7.x box to test.
>>>
>>> Denes
>>>
>>> On Saturday, March 18, 2017 at 11:11:34 AM UTC-4, Jim S wrote:

 In this example he is connecting using a DB2 connector.  However, I'm
 hoping to use the ibm_db_dbi connector and don't know how to specify it on
 the dal connection.  He is using:

 db = DAL('db2://DSN=MYDSN;UID=x;PWD=x', migrate_enabled=False)


 I'm not sure what to put in place of the db2://DSN...

 Anyone?

 -Jim


 On Fri, Mar 17, 2017 at 7:38 PM, António Ramos wrote:

> maybe
> http://www.web2pyslices.com/slice/show/1474/calling-remote-p
> rogram-on-db2-from-pythonweb2py
>
>
>
>
> <#m_3528030319647504909_m_-4614400319505947091_c78e0319-5078-4af6-9a39-37e920755dac@googlegroups.com_CAERBpoCttAv9kGK=rqf1z1TiNvGQS-h99VwVWD9JJZ3ZAVeMaw@mail.gmail.com_m_-838279669736982895_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>
> 2017-03-17 21:06 GMT+00:00 Jim S :
>
>> Hi
>>
>> In a former (and somewhat current) life I was an AS/400 guy.  Our
>> shop still uses the platform though most of my time is spent on Python 
>> and
>> web2py now.
>>
>> Recently Python became available and officially supported on IBM i
>> and I'm trying to get web2py running there accessing the local DB2/400
>> database.  Using the local python on the system I can create a database
>> connection to the local database doing this:
>>
>> import ibm_db_dbi as db
>>
>> conn = db.connect(database='*LOCAL')
>>
>> I'm hoping to find an easy way to convert this into a connectstring
>> for the DAL so I can have my database created there.  The SQL-flavor it
>> should use would be the same as ODBC-flavored SQL.
>>
>> Can anyone give me a clue how to modify the DAL code to connect to my
>> db?  Any pointers to other articles or links would really be appreciated.
>> It would be exciting for me to get this working since I could then show 
>> RPG
>> developers how easy it would be to get an application on the web from the
>> AS/400 using python/web2py.
>>
>> -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.
>>
>
>
>
> --
> José Ricardo Borba
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/web2py/qrlN5TSSBgs/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [web2py] real name of auth tables

2017-03-20 Thread Richard Vézina
Hello,

I can't say for sure, but I don't see why rname wouldn't work with
auth_table if you customize them, at least it should work with the old way
of customizing as you use define_table to do so and rname is an attribute
of it :

http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#define_table-signature

Richard

On Mon, Mar 13, 2017 at 8:21 AM, Kristján Valur Jónsson 
wrote:

> I see that database tables now have a "rname" field so it is possible to
> add schema addressing to them.
> However, the auth tables don't support it.
> I propose adding auth.settings.table_user_rname etc. attributes
> (defaulting to None) so that one can specify the real table name separately
> from the logical table name.
> Any thoughts?
> K
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the 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] Insert record with dynamic multiples fields

2017-03-20 Thread dicolla
I'd like to convert this static INSERT command:

db_handle.MYTAB.insert(date='1212121', time='99' )

in a dynamic command like this:

wFields=[]
wFields.append( {'date':'1212121'} )
wFields.append( {'time':'99'} )
db_handle.MYTAB.insert(wFields)

but I got an error:

Error processing ..., insert() takes exactly 1 argument (2 given)

If I use: 

  db_handle.MYTAB.insert(*wFields)

I got the error:

Error processing ..., insert() takes exactly 1 argument (3 given)


So, how can I build dynamically the set of parameters when calling the 
function INSERT of WEB2PY ?


I use this way to create a TABLE with dynamic FIELDS and this works with no 
problem:

   wFields = []

for key, pos,  in template_fields:
wName = str(key)
wFields.append(Field( wName ))

db_handle.define_table('IISLOG', *wFields )


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the 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: We do not delete posts

2017-03-20 Thread 'ross mclean' via web2py-users
I've made 2 post put neither appear to have been published, assuming this 
is due to me being a new member. If possible please could one of the 
moderators review and approve. Ross

On Monday, July 20, 2015 at 9:08:57 AM UTC+1, Massimo Di Pierro wrote:
>
> We never delete posts from users, unless the users ask (because they 
> accidentally post the server password, for example). Yet first posts are 
> moderated to avoid spam. Usually when a post is on hold for moderation it 
> is approved within 24 hours or less.
>
> There are some glitches in the process. 
> - Occasionally some posts have disappeared on their own. We attributed 
> this to a Google glitch. It has not happened recently. 
> - Some times Google requires moderation even for posts from people that 
> have been whitelisted. This is not our policy and we do not know why it 
> happens, but it does. 
> - Some posts have erroneously been flagged as spam by moderators. We can 
> fix this.
> - Some times it takes longer then 24 hrs for a post to be moderated, but 
> never more than 48 hrs.
> These problems are very very rare.
>
> If your first post does not show up, then it is moderated. Just wait. Do 
> not post 10 more copies of it. That just calls for trouble and more work 
> for all of us. If your post does not show up in 24 hours, email me 
> personally and I will take a look.
>
> We could use some more moderators, so feel free to volunteer by emailing 
> me.
>
> Fun fact: 90% of spam posts are job announcements about Java.
>
> Massimo
>
>
>

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


[web2py] SQLFORM() as input to create query for SQLFORM.Grid

2017-03-20 Thread 'ross mclean' via web2py-users
Hi All,

newbie in python and stuck on creating a query from a sqlform() suitable to 
use for querying multiple table and returning in a datagrid.



Each drop down is connected to a unique table -> I would like on submit to 
used the request.vars and pass these in a query to return the data grid 
like -

select * from paymenttype, supplier, tariff, tariffrate 
where
paymenttype.id = request.vars(paymenttype) and 
tariffrate.rate

[web2py] Re: problem with ldap authentication

2017-03-20 Thread Santiago Cartasegna
Have you tried to check conectivity between servers without Web2py in the 
middle? 

For example, try to do a ldapsearch to see if it works.




El martes, 7 de marzo de 2017, 12:32:42 (UTC-3), Carlos Cesar Caballero 
escribió:
>
> Hi, I am trying to include ldap authentication to my app, and for this, i 
> am using this code:
>
> auth.settings.login_methods.append(ldap_auth(
> mode='uid',
> server='10.6.xx.xx',
> base_dn='dc=comp',
> filterstr='&(objectClass=inetOrgPerson)',
> logging_level='debug'))
>
> (note: The Original server and base_dn values are changed in this example. 
> I also have tried with and without the filterstr option)
>
> But I can't login with any ldap user, and the logs only say:
>
> DEBUG:web2py.auth.ldap_auth:mode: [uid] manage_user: [False] custom_scope: 
> [subtree] manage_groups: [False]
> INFO:web2py.auth.ldap_auth:[10.6.28.93] Initialize ldap connection
>
> I Debug the ladp_auth module, and for some reason it hangs on the line 314 
> ( con.simple_bind_s(dn, password)) without throw any error.
>
> If it helps, I also have tried this code and works as expected returning 
> the ldap user data:
>
> import ldap
> ldap_server="10.6.xx.xx"
> username = "auser"
> base_dn = "dc=comp"
>
> query = "(uid=%s)" % username
> con = ldap.initialize('ldap://'+ldap_server)
>
> result = con.search_s(base_dn, ldap.SCOPE_SUBTREE, query)
> print result
>
>
> Any help or idea?
>
> 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] RuntimeError: no driver available ('pymongo',) - Windows 8.1

2017-03-20 Thread vymy
Hi All,

I am getting the following issue when I am trying to connect web2py with 
mongoDB. 
Can someone help what I am missing and how to make the pymongo driver 
available on my windows 8.1 on which I am running web2py.
Sincere Thanks. 




Error ticket for "images"
Ticket ID
127.0.0.1.2017-03-08.16-24-27.5afd0b41-a763-4964-b42b-42d53e6de99a

 Failure to connect, tried 5 times: 
Traceback (most recent call last): File 
"C:\Users\web2py\web2py001\gluon\packages\dal\pydal\base.py", line 446, in 
__init__ self._adapter = ADAPTERS[self._dbname](**kwargs) File 
"C:\Users\web2py\web2py001\gluon\packages\dal\pydal\adapters\base.py", line 
60, in __call__ obj = super(AdapterMeta, cls).__call__(*args, **kwargs) 
File 
"C:\Users\web2py\web2py001\gluon\packages\dal\pydal\adapters\mongo.py", 
line 83, in __init__ self.find_driver(adapter_args) File 
"C:\Users\web2py\web2py001\gluon\packages\dal\pydal\adapters\base.py", line 
192, in find_driver raise RuntimeError("no driver available %s" % 
str(self.drivers)) RuntimeError: no driver available ('pymongo',)

Version
web2py™ Version 2.14.6-stable+timestamp.2016.05.10.00.21.47

Traceback

Traceback (most recent call last):
  File "C:\Users\web2py\web2py001\gluon\restricted.py", line 227, in 
restricted
exec ccode in environment
  File "C:/Users/web2py/web2py001/applications/images/models/db.py", line 
1, in 
db = DAL('mongodb://wuser001:mongodb@localhost:27017/wikiweb')
  File "C:\Users\web2py\web2py001\gluon\packages\dal\pydal\base.py", line 
174, in __call__
obj = super(MetaDAL, cls).__call__(*args, **kwargs)
  File "C:\Users\web2py\web2py001\gluon\packages\dal\pydal\base.py", line 
473, in __init__
"Failure to connect, tried %d times:\n%s" % (attempts, tb)
RuntimeError: Failure to connect, tried 5 times:
Traceback (most recent call last):
  File "C:\Users\web2py\web2py001\gluon\packages\dal\pydal\base.py", line 
446, in __init__
self._adapter = ADAPTERS[self._dbname](**kwargs)
  File 
"C:\Users\web2py\web2py001\gluon\packages\dal\pydal\adapters\base.py", line 
60, in __call__
obj = super(AdapterMeta, cls).__call__(*args, **kwargs)
  File 
"C:\Users\web2py\web2py001\gluon\packages\dal\pydal\adapters\mongo.py", 
line 83, in __init__
self.find_driver(adapter_args)
  File 
"C:\Users\web2py\web2py001\gluon\packages\dal\pydal\adapters\base.py", line 
192, in find_driver
raise RuntimeError("no driver available %s" % str(self.drivers))
RuntimeError: no driver available ('pymongo',)

In file: C:\Users\web2py\web2py001\applications\images\models\db.py

db = DAL('mongodb://wuser001:mongodb@localhost:27017/wikiweb')

db.define_table('image',
Field('title', unique=True),
Field('file', 'upload'),
format = '%(title)s')

db.define_table('post',
Field('image_id', 'reference image'),
Field('author'),
Field('email'),
Field('body', 'text'))

db.image.title.requires = IS_NOT_IN_DB(db, db.image.title)
db.post.image_id.requires = IS_IN_DB(db, db.image.id, '%(title)s')
db.post.author.requires = IS_NOT_EMPTY()
db.post.email.requires = IS_EMAIL()
db.post.body.requires = IS_NOT_EMPTY()

db.post.image_id.writable = db.post.image_id.readable = False

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the 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] Retrieve other fields from the LDAP database

2017-03-20 Thread John Freking
I have used LDAP login with MS Active Directory and I added the extra
fields for names and emails to the AUTH_USER table.

[ldap_auth(mode='ad',
manage_user=True,
user_firstname_attrib = 'givenName',
user_lastname_attrib = 'sn',
user_mail_attrib = 'mail',

This code works fine but I want to retrieve more fields from the LDAP
database.  Is it possible to get more than these these fields?

Thanks,
John

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the 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] Smartrgrid verify old value on record before update

2017-03-20 Thread Santiago Cartasegna
Hello,

I am trying to do some validation before updating a record. My idea is to 
verify that the new value of a field is bigger than the old one.

However I am not getting how to do it:


table definition:


db.define_table('t_myTable',
Field('f_year', type='integer',
  label=T('Año')),
Field('f_quantity', type='integer',
  label=T('cantidad')),
Field('f_user', type='reference auth_user',
  label=T('Cargo'),default=auth.user_id,writable=False),
auth.signature,
format='%(f_year)s',
migrate=settings.migrate)


On my controller:


# -*- coding: utf-8 -*-
@auth.requires_login()
def viewTable():
form = SQLFORM.smartgrid(db.t_myTable,onupdate=auth.archive,deletable=
False,csv=False,details=False,searchable=False
,onvalidation=is_bigger)
return locals()


def is_bigger(form):
idUpdate = request.args(3).first
r = db(db.t_myTable.f_quantity==idUpdate.id).select()
if r.f_quantity < form.vars.f_quantity:
form.errors.f_quantity = 'Some error message ' % (r.f_quantity)


I am not getting the way of get the OLD row value before update

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the 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] real name of auth tables

2017-03-20 Thread Kristján Valur Jónsson
I see that database tables now have a "rname" field so it is possible to 
add schema addressing to them.
However, the auth tables don't support it.
I propose adding auth.settings.table_user_rname etc. attributes (defaulting 
to None) so that one can specify the real table name separately from the 
logical table name.
Any thoughts?
K

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


[web2py] Re: problem with ldap authentication

2017-03-20 Thread Vincent Borghi

Hi,

I do not know if this is your case, but in my case I was apparently obliged 
to implement this setting:
ldap.set_option(ldap.OPT_X_TLS_NEWCTX, 0)
in order to work around the problem discussed here:

http://stackoverflow.com/questions/27669285/global-options-in-python-ldap/27713355#27713355

Vincent Borghi

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the 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] Filter data based on clicked images

2017-03-20 Thread Scorpa

Hello folks!

I'm struggling with this idea -
page have several images, user can click on it, then controller must be 
called with selected id of the image as param.
in controller i'm doing db.select based on this id. 
User can click another one adding its id to variables list.

So the question is - how to pass list of variables to controller ? and how 
to add new variable to URL without page refreshing ?

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: 'Column table.id not found (SQLTABLE)'

2017-03-20 Thread Santiago Cartasegna
Are you trying to use a table that you have defined in your database and 
not in web2py? 
If it is the case you must add an id field with autoincremental

El domingo, 12 de marzo de 2017, 20:27:08 (UTC-3), LoveWeb2py escribió:
>
> Keep getting this error for all of my tables!! What is going on?
>
> What information would be helpful for me to post to get help?
>

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


[web2py] Retrieve other fields from the LDAP database during login

2017-03-20 Thread John Freking
I'm using LDAP AUTH with MS Active Directory and I added three extra
fields for names and email. The three fields are.

user_firstname_attrib
user_lastname_attrib
user_mail_attrib

This code works fine but I want to retrieve other fields from the LDAP
database.  Is it possible to get more than these these fields?  I
would like to find the manager of the user.

Thanks,
John

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the 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] UnboundLocalError: local variable 'books' referenced before assignment

2017-03-20 Thread Joe Dunst

I'm trying to make a "vote up" and "vote down" feature in my program, like 
the one in reddit.com. But I've been receiving tickets from 2 different 
errors. (I solved the first one but I want to 
First, I received a "UnboundLocalError: local variable 'books' referenced 
before assignment"
This was my code at the time when I had that error.
*CONTROLLER: *
def vote_callback():
vars = request.post_vars
if vars and auth_user:
*id = vars.id*
direction = +1 if vars.direction == 'up' else -1
*books = db.books(id)*
if books:
votes = db.votes(post=id, created_by=auth.user.id)
if not votes:
books.update_record(vote_book=books.book_vote+direction)
db.votes.insert(post=id,score=direction)
elif votes.score!=direction:
books.update_record(vote_book=books.book_vote+direction)
votes.update_record(score=direction)
else:
pass
print books.book_vote
return str(books.book_vote)


*VIEW:*

https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js";>




This is the default/list_books_by_vote.html template

{{if request.function=='list_books_by_vote':}}
{{=A('sort by datetime', _class='btn', 
_href=URL('list_books_by_datetime'))}}

{{elif request.function=="list_books_by_datetime":}}
{{=A('sort by votes', _class='btn', _href=URL('list_books_by_vote'))}}

{{else:}}

{{=author(user_id)}}

{{pass}}

{{for post in rows:}}





Remove vote

 


*{{=post.book_vote}}*

 


I referenced this!



{{=A(post.book_title, 
_href=URL('show_specific_user', args=post.id))}}



{{=author(post.modified_by)}}





{{pass}}

**
*function do_ajax_vote(t, direction) {*
*var id = jQuery(t).closest('tr').attr('data-id');*
*jQuery.ajax({method:'post',url:'{{=URL('vote_callback')}}',*
* data:{'id':id,'direction':direction},*
* success: function(data){*
*
 jQuery(t).closest('tr').find('.votes').html(data);*
*} });*
*}*

*jQuery(function() {*
*jQuery('[data-direction=up]').click(function(){do_ajax_vote(this, 
'up');});*
*
jQuery('[data-direction=down]').click(function(){do_ajax_vote(this, 
'down');});*
*});*
**



*Model:*
db.define_table('books',
Field('book_title', 'string', 
requires=(IS_NOT_IN_DB(db,'books.book_title'), IS_NOT_EMPTY()), 
label='Thesis Title'),
Field('book_subtitle', 'string', label='Thesis Subtitle 
(Optional)'),
Field('book_date', type='date', requires=IS_DATE(), 
label='Publish Date' ),
Field('book_abstract', type='text', requires=IS_NOT_EMPTY() 
, label='Thesis Abstract' ),
Field('book_school', requires=IS_IN_SET(['AMA Computer 
College - Naga Campus', 'Ateneo de Naga University', 'Naga College 
Foundation', 'Computer Communication Development Institute', 'University of 
Nueva Caceres']), label='Orginating School' ),
Field('book_location', requires=IS_IN_SET(['AMA Computer 
College - Naga Campus', 'Ateneo de Naga University', 'Naga College 
Foundation', 'Computer Communication Development Institute', 'University of 
Nueva Caceres']), label='Location' ),
Field('book_proponents', requires=IS_NOT_EMPTY(), 
label='Thesis Proponents' ),
Field('book_category', requires=IS_IN_SET(['Education, 
Science and Teacher Training', 'Fine and Applied Arts', 'Humanities', 
'Religion and Theology', 'Social Behavioral Sciences', 'Business 
Administration and Related', 'Law and Jurispusence', 'Natural Science', 
'Mathematics', 'IT-Related Disciplines', 'Engineering and Tech', 'Medical 
and Allied', 'Trade, Craft and Industrial', 'Architecture and Town 
Planning', 'Agriculture, Forestry, Fisheries', 'Home Economics', 'Service 
Trades', 'Mass Communication and Documentation', 'Maritime', 'General', 
'Other Disciplines']), label='Thesis Category' ),
Field('book_level', requires=IS_IN_SET(['Undergraduate', 
'Masteral']), label='Thesis Level' ),
Field('book_course', requires=IS_IN_SET(['Bachelor of 
Science in Information Technology', 'Bachelor of Science in Computer 
Science']), label='Proponent\'s Course' ),
   * Field('book_vote', 'integer', default=0, readable=True, 
writable=True),*
auth.signature
)

*db.define_table('votes',*
*Field('books', 'reference books'),*
*Field('score', 'integer', default=+1),*
*

[web2py] How to import google-api-python-client in web2py?

2017-03-20 Thread Peter Weicher
Hello, 

I am trying to use web2py to build an application that requests data from 
various google APIs.

Using my local install of Python 3 or Python 2, I am able to import the 
necessary modules and query the api. 

I have tried the following, restarting the webserver between each action:

1) copying google-api-python-client modules 
into C:\web2py\web2py\site-packages

   - This does not work, I get  'module' 
   object has no attribute 'DEFAULT_MAX_REDIRECTS'
   - package httplib2 definitely has a value called 'DEFAULT_MAX_REDIRECTS'
   - see Traceback #1

2) delete files and then cmd: python -m pip install --target= 
google-api-python-client

   - same result as first action
   - see Traceback #1

3) Copy or pip files to C:\web2py\web2py\applications\ping\modules


   - This does not work either, I get error:  cannot import name discovery
   - See Traceback #2


Has anyone successfully imported google-api-python-client into a web2py 
local instance?
Is there a setup step I am missing?

Full list of modules I am talking about is below, and the google 
instructions are here: 
https://developers.google.com/api-client-library/python/start/installation


Thank you!

Peter

___

Traceback #1

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

from apiclient import discovery
  File "C:\web2py\web2py\gluon\custom_import.py", line 74, in custom_importer
return NATIVE_IMPORTER(oname, globals, locals, fromlist, level)
  File "C:\web2py\web2py\site-packages\apiclient\__init__.py", line 19, in 

from googleapiclient import discovery
  File "C:\web2py\web2py\gluon\custom_import.py", line 74, in custom_importer
return NATIVE_IMPORTER(oname, globals, locals, fromlist, level)
  File "C:\web2py\web2py\site-packages\googleapiclient\discovery.py", line 56, 
in 
from googleapiclient import _auth
  File "C:\web2py\web2py\gluon\custom_import.py", line 74, in custom_importer
return NATIVE_IMPORTER(oname, globals, locals, fromlist, level)
  File "C:\web2py\web2py\site-packages\googleapiclient\_auth.py", line 27, in 

import oauth2client.client
  File "C:\web2py\web2py\gluon\custom_import.py", line 74, in custom_importer
return NATIVE_IMPORTER(oname, globals, locals, fromlist, level)
  File "C:\web2py\web2py\site-packages\oauth2client\client.py", line 39, in 

from oauth2client import transport
  File "C:\web2py\web2py\gluon\custom_import.py", line 74, in custom_importer
return NATIVE_IMPORTER(oname, globals, locals, fromlist, level)
  File "C:\web2py\web2py\site-packages\oauth2client\transport.py", line 255, in 

redirections=httplib2.DEFAULT_MAX_REDIRECTS,
AttributeError: 'module' object has no attribute 'DEFAULT_MAX_REDIRECTS'




Traceback #2

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

from apiclient import discovery
  File "C:\web2py\web2py\gluon\custom_import.py", line 95, in custom_importer
return base_importer(pname, globals, locals, fromlist, level)
  File "applications\ping\modules\apiclient\__init__.py", line 19, in 
from googleapiclient import discovery
ImportError: cannot import name discovery


List of Modules

03/14/2017  11:57 AM  apiclient
03/14/2017  11:57 AM  googleapiclient
03/14/2017  11:57 AM 
 google_api_python_client-1.6.2.dist-info
03/14/2017  11:57 AM  httplib2
03/14/2017  11:57 AM  httplib2-0.10.3-py2.7.egg-info
03/14/2017  11:57 AM  oauth2client
03/14/2017  11:57 AM  oauth2client-4.0.0.dist-info
03/14/2017  11:57 AM  pyasn1
03/14/2017  11:57 AM  pyasn1-0.2.3.dist-info
03/14/2017  11:57 AM  pyasn1_modules
03/14/2017  11:57 AM  pyasn1_modules-0.0.8.dist-info
03/14/2017  11:57 AM  rsa
03/14/2017  11:57 AM  rsa-3.4.2.dist-info
03/14/2017  11:57 AM  six-1.10.0.dist-info
03/14/2017  11:49 AM30,098 six.py
03/14/2017  11:57 AM  tests
03/14/2017  11:57 AM  uritemplate
03/14/2017  11:57 AM  uritemplate-3.0.0.dist-info

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, 

[web2py] What is the path for the file where I can edit SQLFORM.grid.

2017-03-20 Thread Joe Dunst
I need to put some jQuery on the source file of the SQL.grid so I can have 
an autocomplete feature in the search bar of tthe grid.
If somebody could provide me with the code for this, it will be deeply 
appreciated.
I tried searching the net like Whoosh, web2py apps, stackoverflow, web2py 
slices; sadly, none worked for me.
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] Quick few questions

2017-03-20 Thread paulgxo
Howdy. I have a task with web2py. This is my first experience. My 
background is in Flask/Django. Here are a few quick questions:

1. I have an image in the a database. The model is defined like this: 

Field('Image', "upload", requires=[ 
IS_NOT_EMPTY()], autodelete=True, uploadfolder='uploads/', notnull=False, 
label=T('Images'), 
represent=lambda x, row: x and A('%s' % (db.package.Images.retrieve(x)[0]), 
_href=URL( 
'default', 'template/viewer.html', args=x), 
_target="_blank", 
_title=T("Open Image"), 
_class='file-reference') 
or ''),

Can someone explain what this does conceptually? 
db.package.Images.retrieve(x)[0]

If I understand, this will look in the package table, in the Image field, 
and it will retrieve the image that matches x (which is the value of x in 
this table). What I'm not sure, is it matches x and pulls the first 
element. I'm probably going to wipe this code and not use it (it doesn't 
work) but I'm curious what it was attempting to do. 

2. How can I display the image and have it clickable (I have it to show the 
text currently). I see the images get uploaded to 'uploads/'.  I'm having 
trouble finding exactly how retrieve() works in the docs, perhaps I've been 
looking in the wrong place.

3. I want to build a basic CRUD admin interface to manage a table defined 
in the model. Any two cents on where I can start here? I've gone through 
some of the docs.

4. How do I add a user to a membership 'admin' ? 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the 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 get human readable format string for a many to many join not the Ids in the junction table

2017-03-20 Thread Frek
 The field leave_type in the leave_requests  table is joined to the 
leave_allocations table.  The drop down in the leave_requests SQLFORM shows 
only the primary ids in the dropdown.   This is not what I need. I need the 
format strings to be human readable.   

Here is now the tables are joined.

###
# leave_types # 
###---<># ##   

# leave_allocations #<>---# leave_requests #
###---<># ##
#  auth_user  #  
###

Here is the requires code for the field
db.leave_requests.leave_type.requires =  IS_IN_DB(db, 
'leave_allocations.id', '%(leave_type)s %(employee_id)s')

The SQLFORM drop down displays the numeric ids for leave_types and 
auth_user, but I want to display format sting from the leave_types table and 
the registration_id from the auth_user table. How do I set the format 
strings for  tables not directly joined? 

Below are the tables from my model. 

db.define_table(
'leave_types',
Field('leave_type'),
Field('unlimited','boolean'),
Field('is_active','boolean'),
format = '%(leave_type)s'
)

db.leave_types.leave_type.requires = IS_NOT_EMPTY()

db.define_table(
'leave_allocations',
Field('leave_type'),
Field('duration','integer'),
Field('employee_id' )
format = '%(leave_type)s %(employee_id)s'
)

db.leave_allocations.leave_type.requires  =  IS_IN_DB(db, 
db.leave_types.id, '%(leave_type)s')
db.leave_allocations.employee_id.requires =  IS_IN_DB(db, 'auth_user.id', 
'%(registration_id)s')

db.define_table(
'leave_requests',
Field('employee'),
Field('description'),
Field('leave_type'),
Field('start_date','date'),
Field('end_date','date'),
Field('duration','integer'),
Field('status'),
Field('manager_comment')
)


db.leave_requests.leave_type.requires =  IS_IN_DB(db, 
'leave_allocations.id', '%(leave_type)s %(employee_id)s')
db.leave_requests.employee.requires =  IS_IN_DB(db, 'auth_user.id', 
'%(registration_id)s')
db.leave_requests.duration.requires = [IS_NOT_EMPTY(), IS_INT_IN_RANGE(0, 
30)]
db.leave_requests.start_date.requires = [IS_DATE(), IS_NOT_EMPTY()]
db.leave_requests.end_date.requires = [IS_DATE(), IS_NOT_EMPTY()]
db.leave_requests.description.requires = IS_NOT_EMPTY()

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the 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] Virtual fields use in an autocomplete widget: error and solution

2017-03-20 Thread Simone Genta
Hi,
I'm posting this in the hope it could be useful for someone.

I've the need to use a virtual field in an autocomplete widget, to show 
hierarchy of a reference, something like
Field.Virtual('fv_full_name',lambda row,alt=None : row.t_table.f_name if not 
row.t_table.f_parent else row.t_table.f_parent.fl_full_name + " -> " + row.
t_table.f_name) 


I've found that virtual field in sqlhtml.py autocomplete widget are not 
working (web2py version 2.14.6-stable+timestamp.2016.05.10.00.21.47).

In particular the line
rows = Rows(self.db, records, table_rows.colnames, compact=table_rows.
compact) 
give an error * global name 'Rows' is not 
defined*
and count is limited to 10, regardless the limitby value.

I've managed to work with the following change:
def callback(self):
if self.keyword in self.request.vars:
field = self.fields[0]
if type(field) is Field.Virtual:
records = []
table_rows = self.db(self.db[field.tablename]).select(
orderby=self.orderby)
count = 0
for row in table_rows:
if self.at_beginning:
if row[field.name].lower().startswith(self.request.
vars[self.keyword]):
count += 1
records.append(row)
else:
if self.request.vars[self.keyword] in row[field.name
].lower():
count += 1
records.append(row)
if count == self.limitby[1]: # ADDED LIMITBY 
break
rows = (table_rows.__class__)(self.db, records, table_rows.
colnames, compact=table_rows.compact) # << CHANGED ROWS CONSTRUCTOR


I'm using (table_rows.__class__) as a way to initialize the *Rows* class.
I don't know there is a better way.

Bye.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the 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 add header in soap request using pysimple soap

2017-03-20 Thread Aafak Mohammad
Hi i am using pysimplesoap latest api with python 2.6 just want to add 
header in my request how i can do that?
following is my code i am trying 

client = SoapClient(wsdl='mcsdk10.wsdl',
location="https://10.10.11.164:9443/services/mcsdk10;,
trace=True,
ns=True,
sessions=True,
exceptions=True,
)

soap_header = {
'axis2:ServiceGroupId': result['return']['name'],
'wsa:To': 'https://10.136.12.230:9443/services/mcsdk10',
'wsa:MessageID': result['return']['name'],
'wsa:Action': 'urn:getProfileInfo'
}
*client['headers']= soap_header*


result = client.getProfileInfo(args0={'description': "/p1", 'name': 'p1', 
'value':'p1'})


also i have tried following

ServiceGroupId = SimpleXMLElement('', namespace=namespace, prefix=ns)
ServiceGroupId['axis2']='http://ws.apache.org/namespaces/axis2'
ServiceGroupId.marshall('axis2:ServiceGroupId',result['return']['name'])
ServiceGroupId.marshall('wsa:To','https://10.136.12.230:9443/services/mcsdk10')
ServiceGroupId.marshall('wsa:MessageID', result['return']['name'])
ServiceGroupId.marshall('wsa:Action', 'urn:getProfileInfo')
*client['headers']=ServiceGroupId*

Both the way it is not working
it is always sending the request with empty header

DEBUG:pysimplesoap.client:http://sdk10.mc.avamar.com; 
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/;>
**
http://sdk10.mc.avamar.com;>http://sdk10.mc.avamar.com/xsd;>/p1http://sdk10.mc.avamar.com/xsd;>p1http://sdk10.mc.avamar.com/xsd
">p1


I just want to pass tp achieve following request



http://www.w3.org/2003/05/soap-envelope;>

http://www.w3.org/2005/08/addressing;>

  

http://ws.apache.org/namespaces/axis2; wsa:IsReferenceParameter="true">
urn:uuid:F2BB85C670F832B7A71489646820629   

https://Avamar_Server_IP:9443/services/mcsdk10https://avamar_server_ip:9443/services/mcsdk10%3c/wsa:To>>


urn:uuid:D9DD8A6C7B1FAB9CA61489646819241

urn:getProfileInfo





http://sdk10.mc.avamar.com;>

http://sdk10.mc.avamar.com/xsd; xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance; xsi:type="ns3:ProfileMoref">


/UniqueProfileName


UniqueProfileName


1489646817758











I am able to pass body, but not header

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] Unable to start a server

2017-03-20 Thread Rasmus Kreiner


Hi All,


I keep getting this error when I try start web2 py: 


*-*


*pi@FoyerAfspiller_1*:*/home/www-data/web2py $* python web2py.py -a 'xxx' 
-i 192.168.0.10 -p 8000

web2py Web Framework

Created by Massimo Di Pierro, Copyright 2007-2017

Version 2.14.6-stable+timestamp.2016.05.10.00.21.47

Database drivers available: sqlite3, imaplib, pymysql, pg8000


please visit:

http://192.168.0.10:8000/

use "kill -SIGTERM 1105" to shutdown the web2py server



Traceback (most recent call last):

  File "web2py.py", line 32, in 

gluon.widget.start(cron=True)

  File "/home/www-data/web2py/gluon/widget.py", line 1313, in start

interfaces=options.interfaces)

  File "/home/www-data/web2py/gluon/main.py", line 741, in __init__

save_password(password, port)

  File "/home/www-data/web2py/gluon/main.py", line 596, in save_password

fp = open(password_file, 'w')

IOError: [Errno 13] Permission denied: 
'/home/www-data/web2py/parameters_8000.py'

*-*

Im running of a raspberry pi with the latest jessie software, and used 
this recipe to install web2py: 
https://github.com/web2py/web2py/blob/master/scripts/setup-web2py-ubuntu.sh.

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] Deployment design and CAS

2017-03-20 Thread Pot
Hi all,

I am very new to web2py, I am building an accounting system for internal 
use and a ticketing system for end user. Below are my questions:

1) Should i create 2 web2py applications or 1 application with different 
controllers to separate the access of accounting and ticketing functions? 
It seems to be a deployment design question, i do want to know the pros and 
cons from the experts.

2) If the recommendation is to create 2 web2py applications, I certainly 
don't want to have user data (customer, staff) being stored in 2 similar 
tables (auth_user with extra fields). So i tried CAS out of the web2py box 
creating a CAS 'provider' application for authentication purpose only, I 
could see the CAS login page 
http://127.0.0.1:8000/provider/default/user/cas/login?service=http://127.0.0.1:8000/tests/default/user/login,
 
but when I tried to SIGN UP from LOG IN menu on top right corner, I only 
could see this http://127.0.0.1:8000/provider/default/user/register. When I 
tried to sign up, it went successfully, but obviously it didn't redirect me 
back to the consumer page. What did I miss?

3) The ticketing application needs to implement membership / permission to 
separate end user and staff access, I read some forum saying web2py CAS 
doesn't send membership information between provider and consumer 
applications, how should I address this requirement?

4) Any user created for the accounting / ticketing application, it should 
associate with a company, so I add an extra field in db.py and an 
application specific table 'customer' in db_accounting.py of consumer 
'accounting' application. It didn't work with error - 'Cannot resolve 
reference customer in auth_user definition', though it didn't happen when I 
didn't use CAS. Any pointers and help is much appreciated.

db.define_table('customer', auth.signature) # in db_accounting.py of consumer 
accounting app

auth.settings.extra_fields['auth_user']= [  # in db.py of consumer accounting 
app

  Field('customer', 'reference customer')]

All the attempts and issues I encountered which makes me think whether i 
should just put all the authentication, accounting and ticketing functions 
in a single environment / web2py application. Apologize for the long 
questions, and 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: 'Column table.id not found (SQLTABLE)'

2017-03-20 Thread Peter Weicher
@LoveWeb2py

Two questions:

1) Are you running web2py from windows distribution binary or source?
2) can you view ANY other tables besides my_table in that application?

I have seen this error too, and my steps to reproduce are below. Still 
analyzing the root cause.

Here is how I reproduced this error:

1) bad install of web2py source from git. See Exhibit A. 
2) Create an application and then use signup form to add a user to the 
auth_user table.
3) try to view any table after that, I get the same KeyError citing that 
column auth_user.id does not exist in table. 
4) try the same steps from windows compiled distribution of web2py and 
everything works fine. 

I am guessing that there is some missing or misversioned library that 
creates a bad insert statement screwing up the db. 

Thanks, 
Peter 


Exhibit A - my install from source had problems.

Here is how I installed web2py from source. Because the git submodule 
update --init --recursive failed (still researching why), I instead pip'd 
pydal in and got the server running.

*Windows Command Prompt*

Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.

C:\>c:\python27\python.exe c:\web2py-master\web2py.py
Traceback (most recent call last):
  File "c:\web2py-master\web2py.py", line 21, in 
import gluon.widget
  File "c:\web2py-master\gluon\__init__.py", line 31, in 
"You can also download a complete copy from http://www.web2py.com.;
RuntimeError: web2py depends on pydal, which apparently you have not 
installed.
Probably you cloned the repository using git without '--recursive'
To fix this, please run (from inside your web2py folder):

 git submodule update --init --recursive

You can also download a complete copy from http://www.web2py.com.

C:\>cd c:\web2py-master

c:\web2py-master>git submodule update --init --recursive
fatal: 'submodule' appears to be a git command, but we were not
able to execute it. Maybe git-submodule is broken?

c:\web2py-master>c:\python27\python.exe -m pip install pydal
Collecting pydal
  Using cached pyDAL-17.3-py2.py3-none-any.whl
Installing collected packages: pydal
Successfully installed pydal-17.3

On Sunday, March 12, 2017 at 6:27:08 PM UTC-5, LoveWeb2py wrote:
>
> Keep getting this error for all of my tables!! What is going on?
>
> What information would be helpful for me to post to get help?
>

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


Re: [web2py] Access DB2/400 from IBM i (AS/400) PASE environment

2017-03-20 Thread Jim S
Yes, support became available for Python 2 and Python 3 last summer.  Came 
out in Technology Refreshes.  They still have a long way to go getting more 
packages supported, but base support is there.  They also have a local 
dbapi connector to connect to a DB2/400 database which is what I'm trying 
to connect to with the DAL.

I don't know where to begin modifying an adapter, looking for help.

-Jim

On Monday, March 20, 2017 at 8:18:41 AM UTC-5, DenesL wrote:
>
> Hi Jim
>
> Python officially supported on i, finally!!
> I wish this had happened a while back.
>
> It seems that this would require a modified adapter in web2py,
> sadly I have no access to a current 7.x box to test.
>
> Denes
>
> On Saturday, March 18, 2017 at 11:11:34 AM UTC-4, Jim S wrote:
>>
>> In this example he is connecting using a DB2 connector.  However, I'm 
>> hoping to use the ibm_db_dbi connector and don't know how to specify it on 
>> the dal connection.  He is using:
>>
>> db = DAL('db2://DSN=MYDSN;UID=x;PWD=x', migrate_enabled=False)
>>
>>
>> I'm not sure what to put in place of the db2://DSN...
>>
>> Anyone?
>>
>> -Jim
>>
>>
>> On Fri, Mar 17, 2017 at 7:38 PM, António Ramos wrote:
>>
>>> maybe
>>>
>>> http://www.web2pyslices.com/slice/show/1474/calling-remote-program-on-db2-from-pythonweb2py
>>>
>>>
>>>
>>>
>>> <#c78e0319-5078-4af6-9a39-37e920755dac@googlegroups.com_CAERBpoCttAv9kGK=rqf1z1TiNvGQS-h99VwVWD9JJZ3ZAVeMaw@mail.gmail.com_m_-838279669736982895_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>>>
>>> 2017-03-17 21:06 GMT+00:00 Jim S :
>>>
 Hi

 In a former (and somewhat current) life I was an AS/400 guy.  Our shop 
 still uses the platform though most of my time is spent on Python and 
 web2py now.

 Recently Python became available and officially supported on IBM i and 
 I'm trying to get web2py running there accessing the local DB2/400 
 database.  Using the local python on the system I can create a database 
 connection to the local database doing this:

 import ibm_db_dbi as db

 conn = db.connect(database='*LOCAL')

 I'm hoping to find an easy way to convert this into a connectstring for 
 the DAL so I can have my database created there.  The SQL-flavor it should 
 use would be the same as ODBC-flavored SQL.  

 Can anyone give me a clue how to modify the DAL code to connect to my 
 db?  Any pointers to other articles or links would really be appreciated.  
 It would be exciting for me to get this working since I could then show 
 RPG 
 developers how easy it would be to get an application on the web from the 
 AS/400 using python/web2py.

 -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] Access DB2/400 from IBM i (AS/400) PASE environment

2017-03-20 Thread 'DenesL' via web2py-users
Hi Jim

Python officially supported on i, finally!!
I wish this had happened a while back.

It seems that this would require a modified adapter in web2py,
sadly I have no access to a current 7.x box to test.

Denes

On Saturday, March 18, 2017 at 11:11:34 AM UTC-4, Jim S wrote:
>
> In this example he is connecting using a DB2 connector.  However, I'm 
> hoping to use the ibm_db_dbi connector and don't know how to specify it on 
> the dal connection.  He is using:
>
> db = DAL('db2://DSN=MYDSN;UID=x;PWD=x', migrate_enabled=False)
>
>
> I'm not sure what to put in place of the db2://DSN...
>
> Anyone?
>
> -Jim
>
>
> On Fri, Mar 17, 2017 at 7:38 PM, António Ramos wrote:
>
>> maybe
>>
>> http://www.web2pyslices.com/slice/show/1474/calling-remote-program-on-db2-from-pythonweb2py
>>
>>
>>
>>
>> <#CAERBpoCttAv9kGK=rqf1z1TiNvGQS-h99VwVWD9JJZ3ZAVeMaw@mail.gmail.com_m_-838279669736982895_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>>
>> 2017-03-17 21:06 GMT+00:00 Jim S :
>>
>>> Hi
>>>
>>> In a former (and somewhat current) life I was an AS/400 guy.  Our shop 
>>> still uses the platform though most of my time is spent on Python and 
>>> web2py now.
>>>
>>> Recently Python became available and officially supported on IBM i and 
>>> I'm trying to get web2py running there accessing the local DB2/400 
>>> database.  Using the local python on the system I can create a database 
>>> connection to the local database doing this:
>>>
>>> import ibm_db_dbi as db
>>>
>>> conn = db.connect(database='*LOCAL')
>>>
>>> I'm hoping to find an easy way to convert this into a connectstring for 
>>> the DAL so I can have my database created there.  The SQL-flavor it should 
>>> use would be the same as ODBC-flavored SQL.  
>>>
>>> Can anyone give me a clue how to modify the DAL code to connect to my 
>>> db?  Any pointers to other articles or links would really be appreciated.  
>>> It would be exciting for me to get this working since I could then show RPG 
>>> developers how easy it would be to get an application on the web from the 
>>> AS/400 using python/web2py.
>>>
>>> -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.


[web2py] column "worker_stats__tmp" is of type json

2017-03-20 Thread António Ramos
any help? I´m hosting with webfaction and they moved my app to another
server
 column "worker_stats__tmp" is of type
json but expression is of type text LINE 1: UPDATE scheduler_worker SET
worker_stats__tmp=worker_stats; ^ HINT: You will need to rewrite or cast
the expression.Versão
web2py™ Version 2.14.6-stable+timestamp.2016.05.10.00.21.47
Python Python 2.7.5: /home/ramstein74/webapps/new2py/bin/uwsgi (prefix:
/usr)Traceback

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

Traceback (most recent call last):
  File "/home/ramstein74/webapps/new2py/web2py/gluon/restricted.py",
line 227, in restricted
exec ccode in environment
  File 
"/home/ramstein74/webapps/new2py/web2py/applications/fileit/models/db1.py"
, line
127, in 
scheduler=Scheduler(db)
  File "/home/ramstein74/webapps/new2py/web2py/gluon/scheduler.py",
line 567, in __init__
self.define_tables(db, migrate=migrate)
  File "/home/ramstein74/webapps/new2py/web2py/gluon/scheduler.py",
line 659, in define_tables
migrate=self.__get_migrate('scheduler_worker', migrate)
  File 
"/home/ramstein74/webapps/new2py/web2py/gluon/packages/dal/pydal/base.py",
line 834, in define_table
table = self.lazy_define_table(tablename,*fields,**args)
  File 
"/home/ramstein74/webapps/new2py/web2py/gluon/packages/dal/pydal/base.py",
line 873, in lazy_define_table
polymodel=polymodel)
  File 
"/home/ramstein74/webapps/new2py/web2py/gluon/packages/dal/pydal/adapters/base.py",
line 510, in create_table
fake_migrate=fake_migrate
  File 
"/home/ramstein74/webapps/new2py/web2py/gluon/packages/dal/pydal/adapters/base.py",
line 623, in migrate_table
self.execute(sub_query)
  File 
"/home/ramstein74/webapps/new2py/web2py/gluon/packages/dal/pydal/adapters/postgres.py",
line 362, in execute
return BaseAdapter.execute(self, *a, **b)
  File 
"/home/ramstein74/webapps/new2py/web2py/gluon/packages/dal/pydal/adapters/base.py",
line 1388, in execute
return self.log_execute(*a, **b)
  File 
"/home/ramstein74/webapps/new2py/web2py/gluon/packages/dal/pydal/adapters/base.py",
line 1382, in log_execute
ret = self.get_cursor().execute(command, *a[1:], **b)
ProgrammingError: column "worker_stats__tmp" is of type json but
expression is of type text
LINE 1: UPDATE scheduler_worker SET worker_stats__tmp=worker_stats;
  ^
HINT:  You will need to rewrite or cast the expression.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the 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.