Re: [web2py] appadmin database administration fails when trying to edit record

2019-06-06 Thread Ben Duncan
 Field('Account', 'reference CoA',
requires=IS_IN_DB(db, 'CoA.id', '%(Name)s', orderby=db.CoA.Name)),


To me, it looks like you are using "name" to reference the COA, instead of
the ID.

http://www.web2py.com/books/default/search/29?search=IS_IN_DB

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Thu, Jun 6, 2019 at 10:25 AM David Manns  wrote:

> running Python 2.7, web2py 2.18.5
>
> table:
>
> db.define_table('AccTrans',
> Field('Timestamp', 'datetime', default=request.now, writable=False),
> Field('Bank', 'reference Bank_Accounts', writable=False),#e.g.
> PayPal, Cambridge Trust, ...
> Field('Account', 'reference CoA',
> requires=IS_IN_DB(db, 'CoA.id', '%(Name)s', orderby=
> db.CoA.Name)),
> Field('Event', 'reference Events',
> requires=IS_EMPTY_OR(IS_IN_DB(db, 'Events.id',
> '%(Event)s', orderby=~db.Events.Date)),
> comment='leave blank if not applicable'),
> Field('Amount', 'decimal(8,2)',
> comment='enter full amount of check (negative) or deposit
> (positive); split using Edit if multiple accounts',
> requires=IS_DECIMAL_IN_RANGE(-1, 1)),# >=0 for
> asset/revenue, <0 for liability/expense
> Field('Fee', 'decimal(6,2)',
> requires=IS_EMPTY_OR(IS_DECIMAL_IN_RANGE(-1000,100))),# e.g. PayPal
> transaction fee, <0 (unless refunded)
> Field('CheckNumber', 'integer', default=None,
> requires=IS_EMPTY_OR(IS_INT_IN_RANGE(1,9)),
> comment='enter check number if recording a check written'),
> Field('Accrual', 'boolean', default=True, readable=True,
> writable=False),
> Field('FullAmt', 'decimal(8,2)', writable=False, readable=False),#
> for an accrual, the original unsplit amount
> Field('Reference', 'string', writable=False),
> Field('Notes', 'text'),
> singular='Transaction', plural='Check_Register')
>
> first referenced table:
>
> db.define_table('CoA',
> Field('Name', 'string'),
> Field('Notes', 'string'),
> singular='Bank', plural='Banks', format='%(Name)s')
> db.CoA.Name.requires = [IS_NOT_EMPTY(), IS_NOT_IN_DB(db, 'CoA.Name')]
>
> appadmin displays table rows just fine.
>
> clicking a record link in the id column to edit the record fails:
>
> Ticket ID
>
> 127.0.0.1.2019-06-06.11-23-25.64b3e296-56e8-4c9f-a875-5a0ae496f620
>  'Account.Name' Version
> web2py™ Version 2.18.5-stable+timestamp.2019.04.08.04.22.03
> Python Python 2.7.14: C:\Python27\python.exe (prefix: C:\Python27)
> Traceback
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
> 13.
> 14.
> 15.
> 16.
> 17.
> 18.
> 19.
> 20.
> 21.
> 22.
>
> Traceback (most recent call last):
>   File "C:\Users\David\Google Drive\My 
> Documents\OxCamNE.3.1\gluon\restricted.py", line 219, in restricted
> exec(ccode, environment)
>   File "C:\Users\David\Google Drive\My 
> Documents\OxCamNE.3.1\applications\init\controllers/appadmin.py", line 695, 
> in 
>   File "C:\Users\David\Google Drive\My 
> Documents\OxCamNE.3.1\gluon\globals.py", line 421, in 
> self._caller = lambda f: f()
>   File "C:\Users\David\Google Drive\My 
> Documents\OxCamNE.3.1\applications\init\controllers/appadmin.py", line 337, 
> in update
> f='download', args=request.args[:1]))
>   File "C:\Users\David\Google Drive\My 
> Documents\OxCamNE.3.1\gluon\sqlhtml.py", line 1550, in __init__
> inp = self.widgets.options.widget(field, default)
>   File "C:\Users\David\Google Drive\My 
> Documents\OxCamNE.3.1\gluon\sqlhtml.py", line 353, in widget
> options = requires[0].options()
>   File "C:\Users\David\Google Drive\My 
> Documents\OxCamNE.3.1\gluon\packages\dal\pydal\validators.py", line 2742, in 
> _options
> options = self.other.options(*args, **kwargs)
>   File "C:\Users\David\Google Drive\My 
> Documents\OxCamNE.3.1\gluon\packages\dal\pydal\validators.py", line 609, in 
> options
> self.build_set()
>   File "C:\Users\David\Google Drive\My 
> Documents\OxCamNE.3.1\gluon\packages\dal\pydal\validators.py", line 604, in 
> build_set
> self.labels = [self.label % r for r in records]
>   File "C:\Users\David\Google Drive\My 
> Documents\OxCamNE.3.1\gluon\packages\dal\pydal\objects.py", line 103, in 
> __getitem__
> raise KeyError(key)
> KeyError: 'Account.Name'
>
> Error snapshot [image: help]
> <http://127.0.0.1:8000/admin/default/ticket/init/127.0.0.1.2019-06-06.11-23-25.64b3e296-56e8-4c9f-a875-5a0ae496f620#>
>
> ('Accou

Re: [web2py] Re: How to make this code work ...

2019-06-06 Thread Ben Duncan
Ok, moving it to static makes it work fine. It was in view/default
Any IDEAS on what / why this works this way ?

Thanks ...

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Wed, Jun 5, 2019 at 9:51 PM Dave S  wrote:

>
>
> On Wednesday, June 5, 2019 at 12:47:51 PM UTC-7, Dave S wrote:
>>
>>
>>
>> On Wednesday, June 5, 2019 at 3:30:46 AM UTC-7, Val K wrote:
>>>
>>> Yes, file:// is even another protocol, so using http transport in this
>>> case is out of all standards. But it should work fine with regular web2py
>>> app (over http)
>>
>>
>> Since I found a way to successfully demonstrate the javascript working,
>> it is quite possible I will not ever pursue the file:// x-site issues.
>> I've done OPTIONS handling in node.js before, and I think I can see how to
>> do it in the front end (nginx), but I don't have a reason to pursue it at
>> present.
>>
>> /dps
>>
>>
>
>  Although looking through some of my long-open tabs, I see mcm's
> cors_origin decorator from October '16, and curiosity might provoke me.
>
> -d
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/ac268300-8ec7-4f4d-9d3b-9ffbe7f12f4f%40googlegroups.com
> <https://groups.google.com/d/msgid/web2py/ac268300-8ec7-4f4d-9d3b-9ffbe7f12f4f%40googlegroups.com?utm_medium=email_source=footer>
> .
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CAC10dPY5spoodbktBvMTgvdSxf9DPY%3Dv%2B0QCGqQSABi1nECCKA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: How to make this code work ...

2019-06-05 Thread Ben Duncan
Put some console logs in to see  strange ...

This site makes use of a SHA-1 Certificate; it’s recommended you use
certificates with signature algorithms that use hash functions stronger
than SHA-1.
loadajax <https://10.13.70.47/Book/default/loadajax>
In function loaddoc loadajax:14:11
<https://10.13.70.47/Book/default/loadajax>
readystate= 1 loadajax:18:11 <https://10.13.70.47/Book/default/loadajax>
status= 0 loadajax:19:11 <https://10.13.70.47/Book/default/loadajax>
This site makes use of a SHA-1 Certificate; it’s recommended you use
certificates with signature algorithms that use hash functions stronger
than SHA-1.
ajax_info.txt <https://10.13.70.47/Book/default/ajax_info.txt>
readystate= 2 loadajax:18:11 <https://10.13.70.47/Book/default/loadajax>
status= 404 loadajax:19:11 <https://10.13.70.47/Book/default/loadajax>
readystate= 3 loadajax:18:11 <https://10.13.70.47/Book/default/loadajax>
status= 404 loadajax:19:11 <https://10.13.70.47/Book/default/loadajax>
readystate= 4 loadajax:18:11 <https://10.13.70.47/Book/default/loadajax>
status= 404

ajax_info is just a text file that Iv'e created that looks like :
Ajax is not a programming language

  AJAX
  AJAX IS A technique for accessing webs ervers from a web page

AJAX stands for ASYNCHRONOUS Javascript and XML/JSON

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Wed, Jun 5, 2019 at 5:30 AM Val K  wrote:

> Yes, file:// is even another protocol, so using http transport in this
> case is out of all standards. But it should work fine with regular web2py
> app (over http)
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/70288247-9e3b-4078-81e5-385ef4a4f67e%40googlegroups.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CAC10dPZLTgabtWTW_qGfp5DwO0AS%3DD_-HpU6c-xTLznq4LNrmw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: How to make this code work ...

2019-06-04 Thread Ben Duncan
I've been trying to run it ... When you click on the button it does nothing

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Tue, Jun 4, 2019 at 4:35 PM Anthony  wrote:

> What are you trying to do? That code should work fine in web2py, as it's
> just Javascript. You just need to have it call a web2py URL. Of course,
> web2py includes some built-in mechanisms for handling Ajax requests, such
> as the ajax() Javascript function and the LOAD() helper to create Ajax
> components.
>
> Anthony
>
> On Tuesday, June 4, 2019 at 3:23:11 PM UTC-4, Ben Duncan wrote:
>>
>> Ok, the following is code from w3 schools:
>> https://www.w3schools.com/js/js_ajax_intro.asp
>>
>> The code is as follows :
>>
>> 
>> 
>> 
>>
>> 
>> The XMLHttpRequest Object
>> Change Content
>> 
>>
>> 
>> function loadDoc() {
>>   var xhttp = new XMLHttpRequest();
>>   xhttp.onreadystatechange = function() {
>> if (this.readyState == 4 && this.status == 200) {
>>   document.getElementById("demo").innerHTML =
>>   this.responseText;
>> }
>>   };
>>   xhttp.open("GET", "ajax_info.txt", true);
>>   xhttp.send();
>> }
>> 
>>
>> 
>> 
>>
>> The question is how do I get this code to run under web2py ?
>>
>> Thanks ...
>>
>> *Ben Duncan*
>> DBA / Chief Software Architect
>> Mississippi State Supreme Court
>> Electronic Filing Division
>>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/9b9fa219-3038-4d61-9206-a5ab134f783e%40googlegroups.com
> <https://groups.google.com/d/msgid/web2py/9b9fa219-3038-4d61-9206-a5ab134f783e%40googlegroups.com?utm_medium=email_source=footer>
> .
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CAC10dPa2-zKpNW1fMkLZz4FtDZjm-XQgB9dfd8%3Dqou-o1qyyaA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] How to make this code work ...

2019-06-04 Thread Ben Duncan
Ok, the following is code from w3 schools:
https://www.w3schools.com/js/js_ajax_intro.asp

The code is as follows :






The XMLHttpRequest Object
Change Content



function loadDoc() {
  var xhttp = new XMLHttpRequest();
  xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
  document.getElementById("demo").innerHTML =
  this.responseText;
}
  };
  xhttp.open("GET", "ajax_info.txt", true);
  xhttp.send();
}





The question is how do I get this code to run under web2py ?

Thanks ...

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division

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


Re: [web2py] Re: quotes & invoices app

2019-04-10 Thread Ben Duncan
Her at the Mississippi State Supreme Court we are working on a COMPLETE
Accounting System.
It will be bases upon my 30 years of dealing with CRM/ERP systems. This
will be for the County Clerks to run their offices.

The modules will be GL/AR/AP/PO/Bank Rec/Billing/Inventory/OE

Stuck to the side is Payroll, RMA, BOM, JC ...

I have used a lot of features from 4GL's (AppGen / Informix) , MRP COBOL
systems and the some form the 'BIG RED' fininancials.

The unfortunate bit of information, is that it is a few years down the
road, and I'm learning all about web programming (Extensive Client / Server
experience - bu no REAL web development)

The good news, Is all of the DB side of stuff is designed.

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Tue, Apr 9, 2019 at 7:43 PM pollwerk  wrote:

> There is also something on Sourceforge:
> https://sourceforge.net/projects/facturalibre.berlios/ saying last
> updated in September 2014
>
> Are there any improvements/new projects for ERP and Invoicing etc?
>
>
>
> Am Mittwoch, 16. Mai 2012 14:35:08 UTC+2 schrieb Alan Etkin:
>>
>> The second link is wrong. FacturaLibre is at
>> http://code.google.com/p/pyafipws/source/checkout?repo=web2py-app
>>
>> El miércoles, 16 de mayo de 2012 09:32:06 UTC-3, Alan Etkin escribió:
>>>
>>> Check out this projects:
>>>
>>> *GestionLibre* <http://code.google.com/p/gestionlibre/>
>>> *FacturaLibre*
>>> <http://code.google.com/p/pyafipws/source/checkout?repo=gui2py-app>
>>>
>>> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [web2py] Re: Convert in line Javascript to file

2019-04-09 Thread Ben Duncan
Thanks DUH, I guess looking at it since 6 AM this morning was not good for
MY brain cells.

Anyway, thanks again ...

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Tue, Apr 9, 2019 at 10:39 AM Anthony  wrote:

> Get rid of the 

[web2py] Convert in line Javascript to file

2019-04-09 Thread Ben Duncan
I have the following file i would like to put in a .js file.
When I've tried in the past I get the "not a text/javascript" , "failed to
load" error message.

I know how to do the src="{{=URL('static','js/swal/swalerror.js')}}" >
stuff.
How would I go about doing this ?

Thanks ...

---


Re: [web2py] Re: Using the results of a variable returned by one function in another function

2019-03-27 Thread Ben Duncan
Could you not use:

*session.resultsARE= *
*to save it an reuse it and pass during the whole session ?*

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Wed, Mar 27, 2019 at 1:42 PM Anthony  wrote:

> It's not quite clear what you mean. Are these two functions two separate
> controller actions? If so, it's not clear how you can share that variable,
> as it is defined based on request.args(0) in the first function, but
> presumably request.args(0) has a different meaning in the context of the
> second function. What are you really trying to do?
>
> On Wednesday, March 27, 2019 at 8:11:15 AM UTC-4, mostwanted wrote:
>>
>> I have 2 functions and i want to use the value of the variable returned
>> by one function in another function, how can i achieve this?
>> I want to use the value of *resultsARE *in *function1 *in the same way
>> in *function2 *as attempted in the highlighted lines below.
>>
>> *FUNCTION1*
>> def companies():
>> *resultsARE=db.services(request.args(0))*
>> rslts=db(db.business.services==resultsARE.id).select(db.business.ALL,
>> orderby=db.business.company_name)
>> services=len(rslts)
>> return locals()
>>
>> *FUNCTION2*
>> def Results():
>> results=db.locations(request.args(0))
>> comps=companies()
>> for services in comps:
>> serv=services
>> rslts=db(db.business.place==results.id).select
>> *(db.business.services==resultsARE.id)*
>> services=len(rslts)
>> return locals()
>> Mostwanted
>>
>> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group 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] Uh Oh ... web2py.com error..

2019-03-13 Thread Ben Duncan
http://web2py.com/books/default/chapter/29/05?search=data
Internal errorTicket issued:
books/205.144.224.2.2019-03-13.11-52-48.afb41d97-713c-4ce6-b3b3-f4329ec13e2e
<http://web2py.com/admin/default/ticket/books/205.144.224.2.2019-03-13.11-52-48.afb41d97-713c-4ce6-b3b3-f4329ec13e2e>

Must be using 2.18? 樂

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group 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: Cannot import modules

2019-03-03 Thread Ben Duncan
Will do ...
*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Sun, Mar 3, 2019 at 2:06 AM Massimo Di Pierro 
wrote:

> No. this is indeed stange. Can you please open a ticket about this?
>
> On Friday, 1 March 2019 04:30:37 UTC-8, Ben Duncan wrote:
>>
>> Ok further testing* REVELS* that if the module begins with 'test',
>> cutome_import chokes and pukes.
>> Named it to bensmodule and it works ...
>>
>> *Massimo*, is that expected behavior ?
>>
>> *Ben Duncan*
>> DBA / Chief Software Architect
>> Mississippi State Supreme Court
>> Electronic Filing Division
>>
>>
>> On Fri, Mar 1, 2019 at 6:25 AM Ben Duncan  wrote:
>>
>>> Ok, tried the deleting of ALL pyc, even moved the test module to gluon
>>> and tried:
>>>
>>> [web2py@su-postgres-ben-3 Book]$ cp -av modules/testmod/testmod.py
>>> ../../gluon/
>>> `modules/testmod/testmod.py' -> `../../gluon/testmod.py'
>>> [web2py@su-postgres-ben-3 Book]$ ls -la ../../gluon/testmod.py
>>> -rw-rw-r-- 1 web2py web2py 250 Feb 28 13:49 ../../gluon/testmod.py
>>> [web2py@su-postgres-ben-3 Book]$
>>>
>>> And still got:
>>> Seems to me cutom_import is borken.
>>>
>>> Error ticket for "Book" Ticket ID
>>>
>>> 10.13.69.144.2019-03-01.06-22-33.1284ee98-507a-49ff-a358-f3e409dff1fc
>>>  (ImportError('No module named
>>> testmod',), ) Version
>>> web2py™ Version 2.17.2-stable+timestamp.2018.10.06.11.34.06
>>> Python Python 2.7.13: /usr/bin/python (prefix:
>>> /opt/rh/python27/root/usr) Traceback
>>>
>>> 1.
>>> 2.
>>> 3.
>>> 4.
>>> 5.
>>> 6.
>>> 7.
>>> 8.
>>> 9.
>>> 10.
>>> 11.
>>> 12.
>>>
>>> Traceback (most recent call last):
>>>   File "/data/web2py/web2py/gluon/restricted.py", line 219, in restricted
>>> exec(ccode, environment)
>>>   File "/data/web2py/web2py/applications/Book/controllers/default.py" 
>>> <https://10.13.70.47/admin/default/edit/Book/controllers/default.py>, line 
>>> 510, in 
>>>   File "/data/web2py/web2py/gluon/globals.py", line 421, in 
>>> self._caller = lambda f: f()
>>>   File "/data/web2py/web2py/applications/Book/controllers/default.py" 
>>> <https://10.13.70.47/admin/default/edit/Book/controllers/default.py>, line 
>>> 109, in login
>>> from testmod import *
>>>   File "/data/web2py/web2py/gluon/custom_import.py", line 104, in 
>>> custom_importer
>>> raise ImportError(e1, import_tb)  # there an import error in the module
>>> ImportError: (ImportError('No module named testmod',), >> 0x7fc9ff98c560>)
>>>
>>> Error snapshot [image: help]
>>> <https://10.13.70.47/admin/default/ticket/Book/10.13.69.144.2019-03-01.06-22-33.1284ee98-507a-49ff-a358-f3e409dff1fc#>
>>>
>>> ((ImportError('No module named
>>> testmod',), ))
>>>
>>> inspect attributes
>>> Frames
>>>
>>>-
>>>
>>>*File /data/web2py/web2py/gluon/restricted.py in restricted at line
>>>219* code arguments variables
>>>-
>>>
>>>*File /data/web2py/web2py/applications/Book/controllers/default.py
>>>in  at line 510* code arguments variables
>>>-
>>>
>>>*File /data/web2py/web2py/gluon/globals.py in  at line 421*
>>>code arguments variables
>>>-
>>>
>>>*File /data/web2py/web2py/applications/Book/controllers/default.py
>>>in login at line 109* code arguments variables
>>>-
>>>
>>>*File /data/web2py/web2py/gluon/custom_import.py in custom_importer
>>>at line 104* code arguments variables
>>>Function argument list
>>>
>>>(name='testmod', globals={'A': , 'ANY_OF':
>>>, 'ASSIGNJS': ,
>>>'AppConfig': , 'B': , 
>>> 'BEAUTIFY':
>>>, 'BODY': , 'BR':
>>>, 'BUTTON': ,
>>>'BytesIO': , ...}, locals={}, 
>>> fromlist=('*',),
>>>level=-1)
>>>Code listing
>>>
>>>99.
>>>100.
>>>101.
>>>102.
>>>103.
>>>104.
>>>105.
>>>106.
>>>107.
>>>108.
>>>
>>>except ImportError as e1:
>&

Re: [web2py] Re: Cannot import modules

2019-03-01 Thread Ben Duncan
Ok further testing* REVELS* that if the module begins with 'test',
cutome_import chokes and pukes.
Named it to bensmodule and it works ...

*Massimo*, is that expected behavior ?

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Fri, Mar 1, 2019 at 6:25 AM Ben Duncan  wrote:

> Ok, tried the deleting of ALL pyc, even moved the test module to gluon and
> tried:
>
> [web2py@su-postgres-ben-3 Book]$ cp -av modules/testmod/testmod.py
> ../../gluon/
> `modules/testmod/testmod.py' -> `../../gluon/testmod.py'
> [web2py@su-postgres-ben-3 Book]$ ls -la ../../gluon/testmod.py
> -rw-rw-r-- 1 web2py web2py 250 Feb 28 13:49 ../../gluon/testmod.py
> [web2py@su-postgres-ben-3 Book]$
>
> And still got:
> Seems to me cutom_import is borken.
>
> Error ticket for "Book" Ticket ID
>
> 10.13.69.144.2019-03-01.06-22-33.1284ee98-507a-49ff-a358-f3e409dff1fc
>  (ImportError('No module named testmod',),
> ) Version
> web2py™ Version 2.17.2-stable+timestamp.2018.10.06.11.34.06
> Python Python 2.7.13: /usr/bin/python (prefix: /opt/rh/python27/root/usr)
> Traceback
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
>
> Traceback (most recent call last):
>   File "/data/web2py/web2py/gluon/restricted.py", line 219, in restricted
> exec(ccode, environment)
>   File "/data/web2py/web2py/applications/Book/controllers/default.py" 
> <https://10.13.70.47/admin/default/edit/Book/controllers/default.py>, line 
> 510, in 
>   File "/data/web2py/web2py/gluon/globals.py", line 421, in 
> self._caller = lambda f: f()
>   File "/data/web2py/web2py/applications/Book/controllers/default.py" 
> <https://10.13.70.47/admin/default/edit/Book/controllers/default.py>, line 
> 109, in login
> from testmod import *
>   File "/data/web2py/web2py/gluon/custom_import.py", line 104, in 
> custom_importer
> raise ImportError(e1, import_tb)  # there an import error in the module
> ImportError: (ImportError('No module named testmod',),  0x7fc9ff98c560>)
>
> Error snapshot [image: help]
> <https://10.13.70.47/admin/default/ticket/Book/10.13.69.144.2019-03-01.06-22-33.1284ee98-507a-49ff-a358-f3e409dff1fc#>
>
> ((ImportError('No module named testmod',),
> ))
>
> inspect attributes
> Frames
>
>-
>
>*File /data/web2py/web2py/gluon/restricted.py in restricted at line
>219* code arguments variables
>-
>
>*File /data/web2py/web2py/applications/Book/controllers/default.py in
> at line 510* code arguments variables
>-
>
>*File /data/web2py/web2py/gluon/globals.py in  at line 421*
>code arguments variables
>-
>
>*File /data/web2py/web2py/applications/Book/controllers/default.py in
>login at line 109* code arguments variables
>-
>
>*File /data/web2py/web2py/gluon/custom_import.py in custom_importer at
>line 104* code arguments variables
>Function argument list
>
>(name='testmod', globals={'A': , 'ANY_OF':
>, 'ASSIGNJS': ,
>'AppConfig': , 'B': , 'BEAUTIFY':
>, 'BODY': , 'BR':
>, 'BUTTON': ,
>'BytesIO': , ...}, locals={}, fromlist=('*',),
>level=-1)
>Code listing
>
>99.
>100.
>101.
>102.
>103.
>104.
>105.
>106.
>107.
>108.
>
>except ImportError as e1:
>import_tb = sys.exc_info()[2]
>try:
>return NATIVE_IMPORTER(name, globals, locals, fromlist, 
> level)
>except (ImportError, KeyError) as e3:
>raise ImportError(e1, import_tb)  # there an import error 
> in the module
>except Exception as e2:
>raise  # there is an error in the module
>finally:
>if import_tb:
>
>Variables
>builtinImportError 
>e1 ImportError('No module named testmod',)
>import_tb None
>
> Context
>
> locals request session response
> In file: /data/web2py/web2py/applications/Book/controllers/default.py
>
> 1.
>
>  at 0x7fc9ff98a930, file 
> "/data/web2py/web2py/applications/Book/controllers/default.py", line 12>
>
>
> *Ben Duncan*
> DBA / Chief Software Architect
> Mississippi State Supreme Court
> Electronic Filing Division
>
>
> On Fri, Mar 1, 2019 at 6:21 AM Ben Duncan  wrote:
>
>> Dave: Yes   same level.
>>
>> Paul will try deleting the pyc files ...
>> *Ben Duncan*
>> DBA / Chief Software Architect
>> Mississippi State Supreme Court
>> Electronic Filing Division
&

Re: [web2py] Re: Cannot import modules

2019-03-01 Thread Ben Duncan
Ok, tried the deleting of ALL pyc, even moved the test module to gluon and
tried:

[web2py@su-postgres-ben-3 Book]$ cp -av modules/testmod/testmod.py
../../gluon/
`modules/testmod/testmod.py' -> `../../gluon/testmod.py'
[web2py@su-postgres-ben-3 Book]$ ls -la ../../gluon/testmod.py
-rw-rw-r-- 1 web2py web2py 250 Feb 28 13:49 ../../gluon/testmod.py
[web2py@su-postgres-ben-3 Book]$

And still got:
Seems to me cutom_import is borken.

Error ticket for "Book" Ticket ID

10.13.69.144.2019-03-01.06-22-33.1284ee98-507a-49ff-a358-f3e409dff1fc
 (ImportError('No module named testmod',),
) Version
web2py™ Version 2.17.2-stable+timestamp.2018.10.06.11.34.06
Python Python 2.7.13: /usr/bin/python (prefix: /opt/rh/python27/root/usr)
Traceback

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

Traceback (most recent call last):
  File "/data/web2py/web2py/gluon/restricted.py", line 219, in restricted
exec(ccode, environment)
  File "/data/web2py/web2py/applications/Book/controllers/default.py"
<https://10.13.70.47/admin/default/edit/Book/controllers/default.py>,
line 510, in 
  File "/data/web2py/web2py/gluon/globals.py", line 421, in 
self._caller = lambda f: f()
  File "/data/web2py/web2py/applications/Book/controllers/default.py"
<https://10.13.70.47/admin/default/edit/Book/controllers/default.py>,
line 109, in login
from testmod import *
  File "/data/web2py/web2py/gluon/custom_import.py", line 104, in
custom_importer
raise ImportError(e1, import_tb)  # there an import error in the module
ImportError: (ImportError('No module named testmod',), )

Error snapshot [image: help]
<https://10.13.70.47/admin/default/ticket/Book/10.13.69.144.2019-03-01.06-22-33.1284ee98-507a-49ff-a358-f3e409dff1fc#>

((ImportError('No module named testmod',),
))

inspect attributes
Frames

   -

   *File /data/web2py/web2py/gluon/restricted.py in restricted at line 219*
   code arguments variables
   -

   *File /data/web2py/web2py/applications/Book/controllers/default.py in
at line 510* code arguments variables
   -

   *File /data/web2py/web2py/gluon/globals.py in  at line 421* code
   arguments variables
   -

   *File /data/web2py/web2py/applications/Book/controllers/default.py in
   login at line 109* code arguments variables
   -

   *File /data/web2py/web2py/gluon/custom_import.py in custom_importer at
   line 104* code arguments variables
   Function argument list

   (name='testmod', globals={'A': , 'ANY_OF': , 'ASSIGNJS': , 'AppConfig':
   , 'B': , 'BEAUTIFY': , 'BODY': , 'BR': , 'BUTTON': , 'BytesIO':
   , ...}, locals={}, fromlist=('*',), level=-1)
   Code listing

   99.
   100.
   101.
   102.
   103.
   104.
   105.
   106.
   107.
   108.

   except ImportError as e1:
   import_tb = sys.exc_info()[2]
   try:
   return NATIVE_IMPORTER(name, globals, locals,
fromlist, level)
   except (ImportError, KeyError) as e3:
   raise ImportError(e1, import_tb)  # there an import
error in the module
   except Exception as e2:
   raise  # there is an error in the module
   finally:
   if import_tb:

   Variables
   builtinImportError 
   e1 ImportError('No module named testmod',)
   import_tb None

Context

locals request session response
In file: /data/web2py/web2py/applications/Book/controllers/default.py

1.

 at 0x7fc9ff98a930, file
"/data/web2py/web2py/applications/Book/controllers/default.py", line
12>


*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Fri, Mar 1, 2019 at 6:21 AM Ben Duncan  wrote:

> Dave: Yes   same level.
>
> Paul will try deleting the pyc files ...
> *Ben Duncan*
> DBA / Chief Software Architect
> Mississippi State Supreme Court
> Electronic Filing Division
>
>
> On Fri, Mar 1, 2019 at 12:26 AM Paul Ellis  wrote:
>
>> I know this sounds odd. But this worked for me recently. It can be caused
>> by a corrupt .pyc file.
>>
>> Try deleting the .pyc files and see if the problem remains.
>>
>> On Thursday, 28 February 2019 20:54:24 UTC+1, Ben Duncan wrote:
>>>
>>> Getting the following errors when trying to import a module
>>> Module directory looks like:
>>>
>>> [web2py@su-postgres-ben-3 Book]$ ls -la modules/
>>> total 16
>>> drwxr-xr-x  2 web2py web2py 4096 Feb 28 13:49 .
>>> drwxrwxr-x 15 web2py web2py 4096 Feb 25 14:33 ..
>>> -rw-rw-r--  1 web2py web2py  256 Jan 30 10:48 emptysample.py
>>> -rw-rw-r--  1 web2py web2py0 Feb 28 13:32 __init__.py
>>> -rw-rw-r--  1 web2py web2py  250 Feb 28 13:49 *testmod.py*
>>> [web2py@su-postgres-ben-3 Book]$
>>>
>>> controller looks like:
>>>
>>> def login():
>>> *from tes

Re: [web2py] Re: Cannot import modules

2019-03-01 Thread Ben Duncan
Dave: Yes   same level.

Paul will try deleting the pyc files ...
*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Fri, Mar 1, 2019 at 12:26 AM Paul Ellis  wrote:

> I know this sounds odd. But this worked for me recently. It can be caused
> by a corrupt .pyc file.
>
> Try deleting the .pyc files and see if the problem remains.
>
> On Thursday, 28 February 2019 20:54:24 UTC+1, Ben Duncan wrote:
>>
>> Getting the following errors when trying to import a module
>> Module directory looks like:
>>
>> [web2py@su-postgres-ben-3 Book]$ ls -la modules/
>> total 16
>> drwxr-xr-x  2 web2py web2py 4096 Feb 28 13:49 .
>> drwxrwxr-x 15 web2py web2py 4096 Feb 25 14:33 ..
>> -rw-rw-r--  1 web2py web2py  256 Jan 30 10:48 emptysample.py
>> -rw-rw-r--  1 web2py web2py0 Feb 28 13:32 __init__.py
>> -rw-rw-r--  1 web2py web2py  250 Feb 28 13:49 *testmod.py*
>> [web2py@su-postgres-ben-3 Book]$
>>
>> controller looks like:
>>
>> def login():
>> *from testmod import **
>> FRM_ERR = 'N'
>> CHOOSE_COMPANY = 'N'
>> print
>> "-\n"
>> print "Doing the LOGIN form ...\n"
>> print "LOGIN: default frm-err: \n ", FRM_ERR
>> 
>>
>> What gives, book says it should work fine ...
>> Restarted several times and tried various name changes ...
>>
>> Thanks ...
>> Error ticket for "Book" Ticket ID
>>
>> 10.13.69.144.2019-02-28.13-47-50.cf8b0622-c9d2-457d-be0d-93c11fb1251c
>>  (ImportError('No module named
>> Book.modules.testmod',), ) Version
>> web2py™ Version 2.17.2-stable+timestamp.2018.10.06.11.34.06
>> Python Python 2.7.13: /usr/bin/python (prefix: /opt/rh/python27/root/usr)
>> Traceback
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>> 7.
>> 8.
>> 9.
>> 10.
>> 11.
>> 12.
>>
>> Traceback (most recent call last):
>>   File "/data/web2py/web2py/gluon/restricted.py", line 219, in restricted
>> exec(ccode, environment)
>>   File "/data/web2py/web2py/applications/Book/controllers/default.py" 
>> <https://10.13.70.47/admin/default/edit/Book/controllers/default.py>, line 
>> 510, in 
>>   File "/data/web2py/web2py/gluon/globals.py", line 421, in 
>> self._caller = lambda f: f()
>>   File "/data/web2py/web2py/applications/Book/controllers/default.py" 
>> <https://10.13.70.47/admin/default/edit/Book/controllers/default.py>, line 
>> 109, in login
>> from testmod import *
>>   File "/data/web2py/web2py/gluon/custom_import.py", line 104, in 
>> custom_importer
>> raise ImportError(e1, import_tb)  # there an import error in the module
>> ImportError: (ImportError('No module named Book.modules.testmod',), 
>> )
>>
>> Error snapshot [image: help]
>> <https://10.13.70.47/admin/default/ticket/Book/10.13.69.144.2019-02-28.13-47-50.cf8b0622-c9d2-457d-be0d-93c11fb1251c#>
>>
>> ((ImportError('No module named
>> Book.modules.testmod',), ))
>> *Ben Duncan*
>> DBA / Chief Software Architect
>> Mississippi State Supreme Court
>> Electronic Filing Division
>>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group 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] Cannot import modules

2019-02-28 Thread Ben Duncan
Getting the following errors when trying to import a module
Module directory looks like:

[web2py@su-postgres-ben-3 Book]$ ls -la modules/
total 16
drwxr-xr-x  2 web2py web2py 4096 Feb 28 13:49 .
drwxrwxr-x 15 web2py web2py 4096 Feb 25 14:33 ..
-rw-rw-r--  1 web2py web2py  256 Jan 30 10:48 emptysample.py
-rw-rw-r--  1 web2py web2py0 Feb 28 13:32 __init__.py
-rw-rw-r--  1 web2py web2py  250 Feb 28 13:49 *testmod.py*
[web2py@su-postgres-ben-3 Book]$

controller looks like:

def login():
*from testmod import **
FRM_ERR = 'N'
CHOOSE_COMPANY = 'N'
print
"-\n"
print "Doing the LOGIN form ...\n"
print "LOGIN: default frm-err: \n ", FRM_ERR


What gives, book says it should work fine ...
Restarted several times and tried various name changes ...

Thanks ...
Error ticket for "Book" Ticket ID

10.13.69.144.2019-02-28.13-47-50.cf8b0622-c9d2-457d-be0d-93c11fb1251c
 (ImportError('No module named
Book.modules.testmod',), ) Version
web2py™ Version 2.17.2-stable+timestamp.2018.10.06.11.34.06
Python Python 2.7.13: /usr/bin/python (prefix: /opt/rh/python27/root/usr)
Traceback

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

Traceback (most recent call last):
  File "/data/web2py/web2py/gluon/restricted.py", line 219, in restricted
exec(ccode, environment)
  File "/data/web2py/web2py/applications/Book/controllers/default.py"
<https://10.13.70.47/admin/default/edit/Book/controllers/default.py>,
line 510, in 
  File "/data/web2py/web2py/gluon/globals.py", line 421, in 
self._caller = lambda f: f()
  File "/data/web2py/web2py/applications/Book/controllers/default.py"
<https://10.13.70.47/admin/default/edit/Book/controllers/default.py>,
line 109, in login
from testmod import *
  File "/data/web2py/web2py/gluon/custom_import.py", line 104, in
custom_importer
raise ImportError(e1, import_tb)  # there an import error in the module
ImportError: (ImportError('No module named Book.modules.testmod',),
)

Error snapshot [image: help]
<https://10.13.70.47/admin/default/ticket/Book/10.13.69.144.2019-02-28.13-47-50.cf8b0622-c9d2-457d-be0d-93c11fb1251c#>

((ImportError('No module named
Book.modules.testmod',), ))
*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group 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] Javascript return value

2019-02-27 Thread Ben Duncan
Ok  a little more detail in  pseudo code:

Display Login page:
get user name and password.
If form validates:
   validate username and password
   if username and password validates
  popup company selection
  get company
  redirect to next page
   else
  show "username password" error message
  go back Display Login page:
else  # Forms did not pass validation ...
  go back Display Login page:

That's the flow I'm used to using in CS software ...

Thanks ...

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Wed, Feb 27, 2019 at 6:53 AM Ben Duncan  wrote:

> What I was hoping to do was a javascript popup to to choose a company,
> then a redirect.
> I load the company number and values in a session variables upon
> connection.
>
> The user id file can have a default company (court) assignment , in which
> case there would be no reason to do the popup, but
> if the user had '0' in the company or was a super admin, it would do the
> popup for company (Court)
>
> Make sense ?
>
> *Ben Duncan*
> DBA / Chief Software Architect
> Mississippi State Supreme Court
> Electronic Filing Division
>
>
> On Wed, Feb 27, 2019 at 2:51 AM Val K  wrote:
>
>> Hard to understand the workflow, do you want the user to be redirected to
>> choose the company after he has logged in? or he should make a choice along
>> the login form filling?
>>
>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

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


Re: [web2py] Javascript return value

2019-02-27 Thread Ben Duncan
What I was hoping to do was a javascript popup to to choose a company, then
a redirect.
I load the company number and values in a session variables upon connection.

The user id file can have a default company (court) assignment , in which
case there would be no reason to do the popup, but
if the user had '0' in the company or was a super admin, it would do the
popup for company (Court)

Make sense ?

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Wed, Feb 27, 2019 at 2:51 AM Val K  wrote:

> Hard to understand the workflow, do you want the user to be redirected to
> choose the company after he has logged in? or he should make a choice along
> the login form filling?
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group 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] Javascript return value

2019-02-26 Thread Ben Duncan
Given I have the following sweet alert js:

--
(async function getCompany () {
  const inputOptions = new Promise((resolve) => {
setTimeout(() => {
  resolve(myargs)
}, 2000)
  })

  const {value: company} = await Swal.fire({
title: 'Select Company',
input: 'radio',
inputOptions: inputOptions,
inputValidator: (value) => {
  return !value && 'You need to choose something!'
}
  })

  if (company) {
Swal.fire({html: 'You selected: ' + company})
  }
  return company
})
()
--

And i have the following code in the view:

{{if CHOOSE_COMPANY == 'Y' : }}
  {{ print "LOGIN view : choose: \n", CHOOSE_COMPANY }}
  {{print "LOGIN view : swalcompany fired \n"}}
  {{print "JSARGS is :\n", js_args}}
  {{=ASSIGNJS(myargs=js_args)}}
  {{=ASSIGNJS(myargs=js_args)}}
  var html_post = "center"
  

{{pass}}

AND in the controller:

if in_form.process(session=None, formname='login').accepted:
print "LOGIN: Accepts...\n"
response.flash = 'form accepted'
FRM_ERR = 'N'
CHOOSE_COMPANY = 'Y'
print "LOGIN: Accepts Trying the return \n"
return dict(form=in_form, FRM_ERR=FRM_ERR, js_args=js_args,
CHOOSE_COMPANY=CHOOSE_COMPANY)
redirect(URL('buttonbar'))
elif in_form.errors :
print "LOGIN: error...\n"
response.flash = 'form has errors'
FRM_ERR = 'Y'
return dict(form=in_form, FRM_ERR=FRM_ERR, js_args=js_args,
CHOOSE_COMPANY=CHOOSE_COMPANY)

I'm trying to accomplish 2 things:

A: get some value backup from the javascript file and
instead of the "return" under the accepted section of controller code, want
to set
a session value and then continue on to the redirect.

How do I go about doing both of theses's ??

As always, Thanks ...
\
*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group 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: Convert ASSIGNJS row to javascript dict

2019-02-25 Thread Ben Duncan
Ok thanks:

Looking to pass to the javascript something like this:

{ 2: "Third Company",  5: "Number 5 Company", 13: "Lucky 13 Company"}

It is to create a selection list that returns the number (2, 5, 13 ,etc
...) but shows the
company name

Thanks

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Mon, Feb 25, 2019 at 12:29 PM Leonel Câmara 
wrote:

> Well then don't give ASSIGNJS all those rows, because that's a list of
> companies.
>
> You can also put the list of companies inside a javascript dictionary
> ASSIGNJS(myargs= {'company_list': Company_List}) is this what you want? If
> you tell me what you're trying to achieve it would be easier to explain how
> to do it.
>
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group 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: Convert ASSIGNJS row to javascript dict

2019-02-25 Thread Ben Duncan
I don't want the array, just the dictionary

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Mon, Feb 25, 2019 at 11:17 AM Leonel Câmara 
wrote:

> What do you mean? You already have a javascript array of javascript dicts.
> If you only need a specific index just access it in javascript with
> myargs[0] or myargs[1].
>
> I may be misunderstanding what you're trying to do.
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group 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] Convert ASSIGNJS row to javascript dict

2019-02-25 Thread Ben Duncan
I have this code:
Company_List = \
 db(db.company.company_number > '0').\
 select(db.company.company_number,db.company.company_name,\
 orderby=db.company.company_number)

Which when passed ot ASSIGNJS creates this list:
var myargs = [{"company_number": 2, "company_name": "Third Company"},
{"company_number": 5, "company_name": "Number 5 Company"},
{"company_number": 13, "company_name": "Lucky 13 Company"}];

I need to have this list changed to a Javascript dict for a popup select.
How do I go about doing that ?

Thanks ...

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group 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: 2.18.1 is OUT

2019-02-25 Thread Ben Duncan
Errors on redhat 7, Python 2.7.13:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable
to complete your request.

Please contact the server administrator at root@localhost to inform them of
the time this error occurred, and the actions you performed just before
this error.

More information about this error may be available in the server error log.


Server Log:


[Mon Feb 25 07:11:02.171430 2019] [wsgi:error] [pid 48880] [remote
10.13.69.144:65464] mod_wsgi (pid=48880): Exception occurred processing
WSGI script '/data/web2py/web2py/wsgihandler.py'.
[Mon Feb 25 07:11:02.171483 2019] [wsgi:error] [pid 48880] [remote
10.13.69.144:65464] Traceback (most recent call last):
[Mon Feb 25 07:11:02.171552 2019] [wsgi:error] [pid 48880] [remote
10.13.69.144:65464]   File "/data/web2py/web2py/wsgihandler.py", line 29,
in 
[Mon Feb 25 07:11:02.171631 2019] [wsgi:error] [pid 48880] [remote
10.13.69.144:65464] import gluon.main
[Mon Feb 25 07:11:02.171668 2019] [wsgi:error] [pid 48880] [remote
10.13.69.144:65464]   File "/data/web2py/web2py/gluon/__init__.py", line
47, in 
[Mon Feb 25 07:11:02.171716 2019] [wsgi:error] [pid 48880] [remote
10.13.69.144:65464] from .globals import current
[Mon Feb 25 07:11:02.171748 2019] [wsgi:error] [pid 48880] [remote
10.13.69.144:65464]   File "/data/web2py/web2py/gluon/globals.py", line 16,
in 
[Mon Feb 25 07:11:02.171831 2019] [wsgi:error] [pid 48880] [remote
10.13.69.144:65464] from gluon._compat import pickle, StringIO,
copyreg, Cookie, urlparse, PY2, iteritems, to_unicode, to_native, \\
[Mon Feb 25 07:11:02.171890 2019] [wsgi:error] [pid 48880] [remote
10.13.69.144:65464] ImportError: cannot import name Cookie
[Mon Feb 25 07:11:20.182840 2019] [wsgi:error] [pid 48880] [remote
10.13.69.144:65470] mod_wsgi (pid=48880): Target WSGI script
'/data/web2py/web2py/wsgihandler.py' cannot be loaded as Python module.
[Mon Feb 25 07:11:20.182952 2019] [wsgi:error] [pid 48880] [remote
10.13.69.144:65470] mod_wsgi (pid=48880): Exception occurred processing
WSGI script '/data/web2py/web2py/wsgihandler.py'.
[Mon Feb 25 07:11:20.182998 2019] [wsgi:error] [pid 48880] [remote
10.13.69.144:65470] Traceback (most recent call last):
[Mon Feb 25 07:11:20.183039 2019] [wsgi:error] [pid 48880] [remote
10.13.69.144:65470]   File "/data/web2py/web2py/wsgihandler.py", line 29,
in 
[Mon Feb 25 07:11:20.183113 2019] [wsgi:error] [pid 48880] [remote
10.13.69.144:65470] import gluon.main
[Mon Feb 25 07:11:20.183151 2019] [wsgi:error] [pid 48880] [remote
10.13.69.144:65470]   File "/data/web2py/web2py/gluon/__init__.py", line
47, in 
[Mon Feb 25 07:11:20.183197 2019] [wsgi:error] [pid 48880] [remote
10.13.69.144:65470] from .globals import current
[Mon Feb 25 07:11:20.183229 2019] [wsgi:error] [pid 48880] [remote
10.13.69.144:65470]   File "/data/web2py/web2py/gluon/globals.py", line 16,
in 
[Mon Feb 25 07:11:20.183398 2019] [wsgi:error] [pid 48880] [remote
10.13.69.144:65470] from gluon._compat import pickle, StringIO,
copyreg, Cookie, urlparse, PY2, iteritems, to_unicode, to_native, \\
[Mon Feb 25 07:11:20.183481 2019] [wsgi:error] [pid 48880] [remote
10.13.69.144:65470] ImportError: cannot import name Cookie
[Mon Feb 25 07:13:25.948959 2019] [wsgi:error] [pid 48880] [remote
10.13.69.144:49224] mod_wsgi (pid=48880): Target WSGI script
'/data/web2py/web2py/wsgihandler.py' cannot be loaded as Python module.
[Mon Feb 25 07:13:25.949144 2019] [wsgi:error] [pid 48880] [remote
10.13.69.144:49224] mod_wsgi (pid=48880): Exception occurred processing
WSGI script '/data/web2py/web2py/wsgihandler.py'.
[Mon Feb 25 07:13:25.949311 2019] [wsgi:error] [pid 48880] [remote
10.13.69.144:49224] Traceback (most recent call last):
[Mon Feb 25 07:13:25.949422 2019] [wsgi:error] [pid 48880] [remote
10.13.69.144:49224]   File "/data/web2py/web2py/wsgihandler.py", line 29,
in 
[Mon Feb 25 07:13:25.949594 2019] [wsgi:error] [pid 48880] [remote
10.13.69.144:49224] import gluon.main
[Mon Feb 25 07:13:25.949688 2019] [wsgi:error] [pid 48880] [remote
10.13.69.144:49224]   File "/data/web2py/web2py/gluon/__init__.py", line
47, in 
[Mon Feb 25 07:13:25.949804 2019] [wsgi:error] [pid 48880] [remote
10.13.69.144:49224] from .globals import current
[Mon Feb 25 07:13:25.949894 2019] [wsgi:error] [pid 48880] [remote
10.13.69.144:49224]   File "/data/web2py/web2py/gluon/globals.py", line 16,
in 
[Mon Feb 25 07:13:25.950056 2019] [wsgi:error] [pid 48880] [remote
10.13.69.144:49224] from gluon._compat import pickle, StringIO,
copyreg, Cookie, urlparse, PY2, iteritems, to_unicode, to_native, \\
[Mon Feb 25 07:13:25.950185 2019] [wsgi:error] [pid 48880] [remote
10.13.69.144:49224] ImportError: cannot import name Cookie

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Mon, Feb 25, 2019 at 12:38 AM Lovedie JC  wrote:

&

Re: [web2py] sqlform double representation

2019-02-25 Thread Ben Duncan
On the first ...:
1.255,76is invalid as there are no commas AFTER decimal places.
As far as the latter, I am not sure. Could be a Python thing ...

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Sat, Feb 23, 2019 at 9:48 PM Cristian Re  wrote:

> Hello, I have a question.
>
> I have a model like this:
>
> db.define_table('buy_invoices',
> ...
> Field('amount', 'double', default=0.0, label="Importo")
> ...
> )
>
> and I create a page with sqlform
>
> form = SQLFORM(db.buy_invoices)
>
>
> when the for is displayed there if a try to copy into the amount field a
> string with decimal and thousand separators the form conserve the first
> separator and delete the others. For example:
>
> if I copy the string "1.255,76" the form field becomes "1.25576" the same
> if I change the separators "1,255.76" becomes "1,25576"
>
> is there a way to keep the format?
>
> Thanks in advance
> Cristian
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [web2py] SQLFORM with specific record

2019-02-22 Thread Ben Duncan
Are you trying to join to db's ?
If not, then try :

ROW = db(db.lugar.user_id == auth.user['id']).select()
or
ROW = db.lugar[auth_user['id']]

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

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Thu, Feb 21, 2019 at 10:04 PM Christian Varas 
wrote:

> Hello !
> I'm trying to get a sqlform that display a specific entry, i've been able
> to get it work like in the book but just with one condition
> like this: record = db.rutas(request.args(0))
>
> i need to do something like this:
> record = db.rutas.id == request.args(0) and db.lugar.user_id ==
> auth.user['id']
>
> I've tried:
> record = db(db.rutas.id == request.args(0) and db.lugar.user_id ==
> auth.user['id'])
> record = db((db.rutas.id == request.args(0)) & (db.lugar.user_id ==
> auth.user['id']))
> but it doesn't work.
> i'm getting this error:
> * argument of type 'Query' is not iterable*
>
> this is my function
> @auth.requires_login()
> def EditarRutaIngresada():
> record = db.rutas.id == request.args(0) and db.lugar.user_id ==
> auth.user['id']
> form_edit_ruta = SQLFORM(db.rutas, record)
>
> return dict(form_edit_ruta=form_edit_ruta)
>
> anybody knows how to do this right ?
>
>
> Thanks in advanced.
> Cheers.
> Chris.
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [web2py] Re: Implementing sweetalert js into web2py

2019-02-21 Thread Ben Duncan
Ok, got it

Thanks a lot ..

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Thu, Feb 21, 2019 at 3:53 AM Val K  wrote:

> You can use conditional rendering in the view like a following:
> {{if 'js_args' in response._vars:}}
> 

Re: [web2py] creating tables with web2py console and mysql

2019-02-20 Thread Ben Duncan
Database Itself  config change:

See:

https://dev.mysql.com/doc/refman/8.0/en/charset-unicode-utf8mb3.html

https://www.google.com/search?client=firefox-b-1-d=Warning%3A+%283719%2C+u%22%27utf8%27+is+currently+an+alias+for+the+character+set+UTF8MB3%2C+but+will+be+an+alias+for+UTF8MB4+in+a+future+release.+Please+consider+us


*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Tue, Feb 19, 2019 at 11:51 PM Andrea Fae'  wrote:

> Hello, why I have this warning?
>
> c:\web2py>python web2py.py -S ga2 -M -P
> web2py Web Framework
> Created by Massimo Di Pierro, Copyright 2007-2019
> Version 2.16.1-stable+timestamp.2017.11.14.05.54.25
> Database drivers available: pymysql, imaplib, sqlite3, pg8000, pyodbc,
> mysqlconnector
> C:\Python27\lib\site-packages\pymysql\cursors.py:170:* Warning: (3719,
> u"'utf8' is currently an alias for the character set UTF8MB3, but will be
> an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in
> order to be unambiguous.")*
>   result = self._query(query)
> Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:25:58) [MSC v.1500 64
> bit (AMD64)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
> (InteractiveConsole)
>
> I specified this in the appcoonfig.ini
>
> mysql://root:passwordroot@localhost/ga2db?set_encoding=utf8mb4
>
> If I don't specify ?set_encoding=utf8mb4 the warning is the same
> mysql is 8.0.15...
>
> thank you
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [web2py] Re: Implementing sweetalert js into web2py

2019-02-20 Thread Ben Duncan
Val, is there a way to something along the lines of this (controller)

Where the Javascript is ONLY fired off if a certain condition is met?

Thanks ...
--
def login():
print "Doing the LOGIN form ...\n"

in_form = SQLFORM.factory(
Field('userid' , requires=IS_NOT_EMPTY()),
Field('password',  requires=IS_NOT_EMPTY()),
Field('rememberlogin' ),
Field('mydate', format=('%m/%d/%Y')),
Field('married' ),
formstyle='divs',
submit_button=' Submit '
)
in_form[0][-1][1][0]['_class']='button'

print "LOGIN: Doing the process form testing ...\n"
if in_form.process(session=None, formname='login').accepted:
print "LOGIN: Accepts...\n"
response.flash = 'form accepted'
redirect(URL('buttonbar'))
elif in_form.errors :
print "LOGIN: error...\n"
   # Fire off the sweetalert as well if we have an error ...
response.flash = 'form has errors'

# The following will fire off the sweetalert in the view
# dict creates a dictionary:
#js_args = dict(message = "Hi There")
# The view, ASSIGNJS, creates the list for the sweetalert popup ...
print "Setting JS args...\n"
js_args = dict(topline = "Hi There",
  title = "You screwed up!",
  type = "error",
  confirmbutton = "Really?")

print "LOGIN: RETURN Form ...\n"
return dict(form=in_form, js_args=js_args)

return dict(form=in_form)
-----------

Again, Thanks ...

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Tue, Feb 19, 2019 at 6:48 AM Ben Duncan  wrote:

> WHoa H !
>
> Thanks VAl that works 
>
>
> *Ben Duncan*
> DBA / Chief Software Architect
> Mississippi State Supreme Court
> Electronic Filing Division
>
>
> On Fri, Feb 15, 2019 at 2:39 PM Val K  wrote:
>
>>
>> include arguments (that it should be json-serializable object) to pass to
>> js-code in the controller output:
>>
>> # controller.py
>> def foo():
>> ...
>> js_args = dict(message  = 'Hi there!')
>> return dict(..., js_args = js_args)
>>
>>
>> insert script into your view
>>
>>
>> 
>> $(document).ready(
>> function(){
>> {{=ASSIGNJS(args = js_args)}} // - converts js_args to `var
>> args = {"message": "Hi there!"};`
>> Swal.fire(args.message);;
>> }
>> )
>> 
>>
>>
>>
>>
>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

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


Re: [web2py] mysql import from csv problem

2019-02-20 Thread Ben Duncan
I Can't speak for MySql, only for Postgres.

In our MAJOR conversion from Informix to Postgres, we simple put a place
holder. Since we used pipes as delimiters, it looked something like this:

NAME|ADDRESS1||CITY|STATE|ZIP|PHONE1||AGE|BIRTHDATE| (etc...)
where there was nothing  for address 2 , or Phone number 2

You need to make sure all fields are accounted for in some way ...

Hope this helps ...

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Tue, Feb 19, 2019 at 3:13 PM Andrea Fae'  wrote:

> Hello, when I import with this procedure
> https://www.pythonanywhere.com/forums/topic/1288/ from csv to mysql, it
> alter the ids of some related tables and I have data not corresponding to
> the original exported csv. What can I do?
> What is my error? is it depending on charset or something related? thank
> you
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [web2py] Re: Migrate from sqlite to mysql

2019-02-20 Thread Ben Duncan
You mean character set UTF?
Make sure environment variable set to UTF.

Have had problems with Windows being NON UTF before.

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Tue, Feb 19, 2019 at 2:58 PM Andrea Fae'  wrote:

> Hello, I deleted a foreign key and I was able to import. But I have a
> strange problem. When I export all data is ok, when I import I don't have
> problems to do now but in mysql database some information chenged!
>
> Could it depend on the charset umtf?
> Thank you in advance who will answer.
>
> Il giorno lunedì 18 febbraio 2019 08:57:38 UTC+1, Web2_3py ha scritto:
>>
>> Hi,
>>
>> I am having the same error (Failure to connect).
>>
>> I checked the connection to mysql using python command line
>> 1
>> 2
>> >>> import mysql.connector
>> >>> mysql.connector.connect(host='localhost',database='mysql',user='root'
>> ,password='')
>> and it is success.
>>
>> What could be the reason of that error?
>>
>> Thanks.
>>
>> On Wednesday, February 13, 2019 at 10:55:32 PM UTC+3, Andrea Fae' wrote:
>>>
>>>
>>>  Failure to connect, tried 5 times:
>>> Traceback (most recent call last): File
>>> "C:\web2py\gluon\packages\dal\pydal\base.py", line 454, in __init__
>>> self._adapter = adapter(**kwargs) File
>>> "C:\web2py\gluon\packages\dal\pydal\adapters\__init__.py", line 40, in
>>> __call__ obj = super(AdapterMeta, cls).__call__(*args, **kwargs) File
>>> "C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 368, in
>>> __init__ super(SQLAdapter, self).__init__(*args, **kwargs) File
>>> "C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 52, in __init__
>>> self.reconnect() File "C:\web2py\gluon\packages\dal\pydal\connection.py",
>>> line 172, in reconnect self.connection = self.connector() File
>>> "C:\web2py\gluon\packages\dal\pydal\adapters\mysql.py", line 52, in
>>> connector return self.driver.connect(**self.driver_args) File
>>> "C:\web2py\gluon\contrib\pymysql\__init__.py", line 90, in Connect return
>>> Connection(*args, **kwargs) File
>>> "C:\web2py\gluon\contrib\pymysql\connections.py", line 688, in __init__
>>> self.connect() File "C:\web2py\gluon\contrib\pymysql\connections.py", line
>>> 905, in connect self._get_server_information() File
>>> "C:\web2py\gluon\contrib\pymysql\connections.py", line 1231, in
>>> _get_server_information self.server_charset = charset_by_id(lang).name File
>>> "C:\web2py\gluon\contrib\pymysql\charset.py", line 38, in by_id return
>>> self._by_id[id] KeyError: 255
>>>
>>>>
>>>>
>>>> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [web2py] Re: Implementing sweetalert js into web2py

2019-02-19 Thread Ben Duncan
WHoa H !

Thanks VAl that works 


*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Fri, Feb 15, 2019 at 2:39 PM Val K  wrote:

>
> include arguments (that it should be json-serializable object) to pass to
> js-code in the controller output:
>
> # controller.py
> def foo():
> ...
> js_args = dict(message  = 'Hi there!')
> return dict(..., js_args = js_args)
>
>
> insert script into your view
>
>
> 
> $(document).ready(
> function(){
> {{=ASSIGNJS(args = js_args)}} // - converts js_args to `var
> args = {"message": "Hi there!"};`
> Swal.fire(args.message);;
> }
> )
> 
>
>
>
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [web2py] Re: Implementing sweetalert js into web2py

2019-02-15 Thread Ben Duncan
Sorry, to sound like a newb on this.
I've really been dealing with and into javascript for , um 36 hours now ?


*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Fri, Feb 15, 2019 at 1:36 PM Ben Duncan  wrote:

> Ok, that works ... NOW what ?
> Can I incorporate it in the controllers ?
>
> *Ben Duncan*
> DBA / Chief Software Architect
> Mississippi State Supreme Court
> Electronic Filing Division
>
>
> On Fri, Feb 15, 2019 at 1:32 PM Ben Duncan  wrote:
>
>> Just call some if it's functions and pop ups ...
>>
>> *Ben Duncan*
>> DBA / Chief Software Architect
>> Mississippi State Supreme Court
>> Electronic Filing Division
>>
>>
>> On Fri, Feb 15, 2019 at 1:23 PM Val K  wrote:
>>
>>> You can open browser console (usually Ctrl+Shit+j) and try
>>> Swal.fire('Hello world!')
>>> How do you plan to use it?
>>>
>>>
>>> On Friday, February 15, 2019 at 8:21:01 PM UTC+3, Ben Duncan wrote:
>>>>
>>>> How would I go about implementing and using sweetalery in web2py?
>>>> see:
>>>> https://sweetalert2.github.io/
>>>>
>>>> I've made the following entries in web2py_ajax.html:
>>>> {{
>>>> response.files.insert(0,URL('static','js/jquery.js'))
>>>> response.files.insert(1,URL('static','css/calendar.css'))
>>>> response.files.insert(2,URL('static','js/calendar.js'))
>>>> response.files.insert(3,URL('static','js/web2py.js'))
>>>> response.files.insert(4,URL('static','css/sweetalert2.css'))
>>>> response.files.insert(5,URL('static','js/sweetalert2.all.js'))
>>>> response.include_meta()
>>>> response.include_files()
>>>> }}
>>>>
>>>> So what Do I need to do next ?
>>>>
>>>> (Forgive please I'm just starting on the javascript side of things ...)
>>>>
>>>> Thanks ..
>>>>
>>>> *Ben Duncan*
>>>> DBA / Chief Software Architect
>>>> Mississippi State Supreme Court
>>>> Electronic Filing Division
>>>>
>>> --
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> - http://github.com/web2py/web2py (Source code)
>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "web2py-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to web2py+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>

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


Re: [web2py] Re: Implementing sweetalert js into web2py

2019-02-15 Thread Ben Duncan
Ok, that works ... NOW what ?
Can I incorporate it in the controllers ?

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Fri, Feb 15, 2019 at 1:32 PM Ben Duncan  wrote:

> Just call some if it's functions and pop ups ...
>
> *Ben Duncan*
> DBA / Chief Software Architect
> Mississippi State Supreme Court
> Electronic Filing Division
>
>
> On Fri, Feb 15, 2019 at 1:23 PM Val K  wrote:
>
>> You can open browser console (usually Ctrl+Shit+j) and try
>> Swal.fire('Hello world!')
>> How do you plan to use it?
>>
>>
>> On Friday, February 15, 2019 at 8:21:01 PM UTC+3, Ben Duncan wrote:
>>>
>>> How would I go about implementing and using sweetalery in web2py?
>>> see:
>>> https://sweetalert2.github.io/
>>>
>>> I've made the following entries in web2py_ajax.html:
>>> {{
>>> response.files.insert(0,URL('static','js/jquery.js'))
>>> response.files.insert(1,URL('static','css/calendar.css'))
>>> response.files.insert(2,URL('static','js/calendar.js'))
>>> response.files.insert(3,URL('static','js/web2py.js'))
>>> response.files.insert(4,URL('static','css/sweetalert2.css'))
>>> response.files.insert(5,URL('static','js/sweetalert2.all.js'))
>>> response.include_meta()
>>> response.include_files()
>>> }}
>>>
>>> So what Do I need to do next ?
>>>
>>> (Forgive please I'm just starting on the javascript side of things ...)
>>>
>>> Thanks ..
>>>
>>> *Ben Duncan*
>>> DBA / Chief Software Architect
>>> Mississippi State Supreme Court
>>> Electronic Filing Division
>>>
>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

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


Re: [web2py] Re: Implementing sweetalert js into web2py

2019-02-15 Thread Ben Duncan
Just call some if it's functions and pop ups ...

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Fri, Feb 15, 2019 at 1:23 PM Val K  wrote:

> You can open browser console (usually Ctrl+Shit+j) and try
> Swal.fire('Hello world!')
> How do you plan to use it?
>
>
> On Friday, February 15, 2019 at 8:21:01 PM UTC+3, Ben Duncan wrote:
>>
>> How would I go about implementing and using sweetalery in web2py?
>> see:
>> https://sweetalert2.github.io/
>>
>> I've made the following entries in web2py_ajax.html:
>> {{
>> response.files.insert(0,URL('static','js/jquery.js'))
>> response.files.insert(1,URL('static','css/calendar.css'))
>> response.files.insert(2,URL('static','js/calendar.js'))
>> response.files.insert(3,URL('static','js/web2py.js'))
>> response.files.insert(4,URL('static','css/sweetalert2.css'))
>> response.files.insert(5,URL('static','js/sweetalert2.all.js'))
>> response.include_meta()
>> response.include_files()
>> }}
>>
>> So what Do I need to do next ?
>>
>> (Forgive please I'm just starting on the javascript side of things ...)
>>
>> Thanks ..
>>
>> *Ben Duncan*
>> DBA / Chief Software Architect
>> Mississippi State Supreme Court
>> Electronic Filing Division
>>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group 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] Implementing sweetalert js into web2py

2019-02-15 Thread Ben Duncan
How would I go about implementing and using sweetalery in web2py?
see:
https://sweetalert2.github.io/

I've made the following entries in web2py_ajax.html:
{{
response.files.insert(0,URL('static','js/jquery.js'))
response.files.insert(1,URL('static','css/calendar.css'))
response.files.insert(2,URL('static','js/calendar.js'))
response.files.insert(3,URL('static','js/web2py.js'))
response.files.insert(4,URL('static','css/sweetalert2.css'))
response.files.insert(5,URL('static','js/sweetalert2.all.js'))
response.include_meta()
response.include_files()
}}

So what Do I need to do next ?

(Forgive please I'm just starting on the javascript side of things ...)

Thanks ..

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group 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: Weird behavior in sqlform / forms ...

2019-02-15 Thread Ben Duncan
Ok, thanks VAL, that did the trick ...

Where do you go to find such neat little things?

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Thu, Feb 14, 2019 at 2:46 PM Ben Duncan  wrote:

> Ok, will give it a shot tomorrow.
> Yeah, I like to do things the long way. But I'm kinda restricted to
> getting this accounting app to match (look and feel)
> of a late 1990's PERL based application (Federal PACER system based ...)
>
> It's what all the attorneys and court clerks are used to using in our
> state ...
>
> *Ben Duncan*
> DBA / Chief Software Architect
> Mississippi State Supreme Court
> Electronic Filing Division
>
>
> On Thu, Feb 14, 2019 at 2:29 PM Val K  wrote:
>
>> It seems you  like handmade things;)
>> I  don't see the closing tag -  
>> Try to remove your handmade hidden field and place
>> {{ =form.hidden_fields() }}
>>
>> and  it should be
>> return dict(form=in_form)
>> in the controller
>>
>>
>>
>>
>> On Thursday, February 14, 2019 at 9:59:41 PM UTC+3, Ben Duncan wrote:
>>>
>>> Sure:
>>>
>>> But, it seems something is strange with firefox, closing the web browser
>>> down and then opening it back up again, and it works the way it should...
>>>
>>> Gess .. Is it always this weird / hard in the world of web
>>> programming ?
>>>
>>>
>>> 
>>> {{extend 'deflayout.html'}}
>>> {{include 'mectopline.html'}}
>>>
>>> >>action="{{=URL()}}"
>>>method="post"
>>>autocomplete="off"
>>> >
>>> 
>>> Input form
>>>
>>>   
>>>   Enter your User ID
>>>   
>>>   >> style='width:100%;'>
>>>
>>> 
>>>   
>>>   Password
>>>   
>>>   
>>> 
>>>
>>> 
>>>   
>>>   Remember Me
>>>   
>>> 
>>>
>>> 
>>>   
>>>   
>>>   >>   style='padding-left: 10px ; padding-right:10px'>
>>>   
>>> 
>>>
>>>
>>>
>>> Submitted variables
>>> {{=BEAUTIFY(request.vars)}}
>>>
>>> 
>>>
>>> I am moving around here ...
>>> 
>>> Stuff a line ...
>>> 
>>> More sir stuff a lot ...
>>> 
>>> Eat MORE CHEESE AT MOE's
>>> 
>>>   
>>> ~
>>>  END
>>> OF VIEW
>>> ---
>>> *Ben Duncan*
>>> DBA / Chief Software Architect
>>> Mississippi State Supreme Court
>>> Electronic Filing Division
>>>
>>>
>>> On Thu, Feb 14, 2019 at 12:52 PM Leonel Câmara 
>>> wrote:
>>>
>>>> Can I see the rest of the view? It seems you're missing the form hidden
>>>> fields which have the token.
>>>>
>>>> --
>>>> Resources:
>>>> - http://web2py.com
>>>> - http://web2py.com/book (Documentation)
>>>> - http://github.com/web2py/web2py (Source code)
>>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>>> ---
>>>> You received this message because you are subscribed to the Google
>>>> Groups "web2py-users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to web2py+un...@googlegroups.com.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group 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: Weird behavior in sqlform / forms ...

2019-02-14 Thread Ben Duncan
Ok, will give it a shot tomorrow.
Yeah, I like to do things the long way. But I'm kinda restricted to getting
this accounting app to match (look and feel)
of a late 1990's PERL based application (Federal PACER system based ...)

It's what all the attorneys and court clerks are used to using in our state
...

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Thu, Feb 14, 2019 at 2:29 PM Val K  wrote:

> It seems you  like handmade things;)
> I  don't see the closing tag -  
> Try to remove your handmade hidden field and place
> {{ =form.hidden_fields() }}
>
> and  it should be
> return dict(form=in_form)
> in the controller
>
>
>
>
> On Thursday, February 14, 2019 at 9:59:41 PM UTC+3, Ben Duncan wrote:
>>
>> Sure:
>>
>> But, it seems something is strange with firefox, closing the web browser
>> down and then opening it back up again, and it works the way it should...
>>
>> Gess .. Is it always this weird / hard in the world of web
>> programming ?
>>
>>
>> 
>> {{extend 'deflayout.html'}}
>> {{include 'mectopline.html'}}
>>
>> >action="{{=URL()}}"
>>method="post"
>>autocomplete="off"
>> >
>> 
>> Input form
>>
>>   
>>   Enter your User ID
>>   
>>   
>>
>> 
>>   
>>   Password
>>   
>>   
>> 
>>
>> 
>>   
>>   Remember Me
>>   
>> 
>>
>> 
>>   
>>   
>>   >   style='padding-left: 10px ; padding-right:10px'>
>>   
>> 
>>
>>
>>
>> Submitted variables
>> {{=BEAUTIFY(request.vars)}}
>>
>> 
>>
>> I am moving around here ...
>> 
>> Stuff a line ...
>> 
>> More sir stuff a lot ...
>> 
>> Eat MORE CHEESE AT MOE's
>> 
>>   
>> ~
>>  END
>> OF VIEW
>> ---
>> *Ben Duncan*
>> DBA / Chief Software Architect
>> Mississippi State Supreme Court
>> Electronic Filing Division
>>
>>
>> On Thu, Feb 14, 2019 at 12:52 PM Leonel Câmara 
>> wrote:
>>
>>> Can I see the rest of the view? It seems you're missing the form hidden
>>> fields which have the token.
>>>
>>> --
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> - http://github.com/web2py/web2py (Source code)
>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "web2py-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to web2py+un...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group 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] Mysql 8.0.15

2019-02-14 Thread Ben Duncan
Related possibly:

https://stackoverflow.com/questions/45368336/error-keyerror-255-when-executing-pymysql-connect


*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Thu, Feb 14, 2019 at 1:09 PM Andrea Fae'  wrote:

> Hello, I'm sorry but I'm not able to use web2py with this type of db.
>
> I just installed mysql version 8.0.15 on windows 10 pro and I have
> connector for Python 3.7 and 2.7 installed
> I created using mysql.exe a db named 'gadb', without any tables.
>
> with web2py I created a new "welcome" application changing db.py in this
> way (not using appconfig.ini)
>
> i changed only this:
> db = DAL('mysql://root:rootpassword@localhost/gadb',pool_size=20)
>
> commenting this
> """db = DAL(configuration.get('db.uri'),
>  pool_size=configuration.get('db.pool_size'),
>  migrate_enabled=configuration.get('db.migrate'),
>  check_reserved=['all'])"""
>
> but when I try to start the application I have this error:
>
> Error ticket for "testmysql"Ticket ID
>
> 127.0.0.1.2019-02-14.20-04-44.4a997a45-2232-4144-ab7e-6005309040bb
>  Failure to connect, tried 5 times:
> Traceback (most recent call last): File
> "C:\web2py\gluon\packages\dal\pydal\base.py", line 454, in __init__
> self._adapter = adapter(**kwargs) File
> "C:\web2py\gluon\packages\dal\pydal\adapters\__init__.py", line 40, in
> __call__ obj = super(AdapterMeta, cls).__call__(*args, **kwargs) File
> "C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 368, in
> __init__ super(SQLAdapter, self).__init__(*args, **kwargs) File
> "C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 52, in __init__
> self.reconnect() File "C:\web2py\gluon\packages\dal\pydal\connection.py",
> line 172, in reconnect self.connection = self.connector() File
> "C:\web2py\gluon\packages\dal\pydal\adapters\mysql.py", line 52, in
> connector return self.driver.connect(**self.driver_args) File
> "C:\web2py\gluon\contrib\pymysql\__init__.py", line 90, in Connect return
> Connection(*args, **kwargs) File
> "C:\web2py\gluon\contrib\pymysql\connections.py", line 688, in __init__
> self.connect() File "C:\web2py\gluon\contrib\pymysql\connections.py", line
> 905, in connect self._get_server_information() File
> "C:\web2py\gluon\contrib\pymysql\connections.py", line 1231, in
> _get_server_information self.server_charset = charset_by_id(lang).name File
> "C:\web2py\gluon\contrib\pymysql\charset.py", line 38, in by_id return
> self._by_id[id] KeyError: 255Versione
> web2py™ Version 2.16.1-stable+timestamp.2017.11.14.05.54.25Traceback
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
> 13.
> 14.
> 15.
> 16.
> 17.
> 18.
> 19.
> 20.
> 21.
> 22.
> 23.
> 24.
> 25.
> 26.
> 27.
> 28.
> 29.
> 30.
> 31.
> 32.
> 33.
> 34.
> 35.
> 36.
>
> Traceback (most recent call last):
>   File "C:\web2py\gluon\restricted.py", line 219, in restricted
> exec(ccode, environment)
>   File "C:/web2py/applications/testmysql/models/db.py" 
> <http://127.0.0.1:8000/admin/default/edit/testmysql/models/db.py>, line 33, 
> in 
> db = DAL('mysql://root:AeDeFsubfi3!@localhost/gadb',pool_size=20)
>   File "C:\web2py\gluon\packages\dal\pydal\base.py", line 169, in __call__
> obj = super(MetaDAL, cls).__call__(*args, **kwargs)
>   File "C:\web2py\gluon\packages\dal\pydal\base.py", line 474, 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:\web2py\gluon\packages\dal\pydal\base.py", line 454, in __init__
> self._adapter = adapter(**kwargs)
>   File "C:\web2py\gluon\packages\dal\pydal\adapters\__init__.py", line 40, in 
> __call__
> obj = super(AdapterMeta, cls).__call__(*args, **kwargs)
>   File "C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 368, in 
> __init__
> super(SQLAdapter, self).__init__(*args, **kwargs)
>   File "C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 52, in 
> __init__
> self.reconnect()
>   File "C:\web2py\gluon\packages\dal\pydal\connection.py", line 172, in 
> reconnect
> self.connection = self.connector()
>   File "C:\web2py\gluon\packages\dal\pydal\adapters\mysql.py", line 52, in 
> connector
> return self.driver.connect(**self.driver_args)
>   File "C:\web2py\gluon\contrib\pymys

Re: [web2py] Re: Weird behavior in sqlform / forms ...

2019-02-14 Thread Ben Duncan
Sure:

But, it seems something is strange with firefox, closing the web browser
down and then opening it back up again, and it works the way it should...

Gess .. Is it always this weird / hard in the world of web programming ?


{{extend 'deflayout.html'}}
{{include 'mectopline.html'}}



Input form

  
  Enter your User ID
  
  


  
  Password
  
  



  
  Remember Me
  



  
  
  
  




Submitted variables
{{=BEAUTIFY(request.vars)}}



I am moving around here ...

Stuff a line ...

More sir stuff a lot ...

Eat MORE CHEESE AT MOE's

  
~
 END OF
VIEW
---
*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Thu, Feb 14, 2019 at 12:52 PM Leonel Câmara 
wrote:

> Can I see the rest of the view? It seems you're missing the form hidden
> fields which have the token.
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [web2py] Re: Weird behavior in sqlform / forms ...

2019-02-14 Thread Ben Duncan
Yes, in the view:

  
  
  
  


Let me check my config for the CSRF token ...

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Thu, Feb 14, 2019 at 12:12 PM Leonel Câmara 
wrote:

> How are you submitting this form? It doesn't seem to be using POST, it
> seems you're just requesting a new page with the form using GET. In case
> that's not what's happening the other possible cause is that you have a
> session.forget somewhere or something is wrong with your cookies and the
> form thinks you don't have a valid CSRF token.
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group 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] Weird behavior in sqlform / forms ...

2019-02-14 Thread Ben Duncan
I'm never EVER getting either a n_form.process().accepted  nor a
in_form.errors hit in the controller

 The following python default code tested with BOTH SQLFROM.factory AND the
FORM

>From controller default.py: (Version with FORM)

def login():
print "Doing the LOGIN form ...\n"

in_form = FORM('login',
   INPUT(_name='userid' ),
   INPUT(_name='password') ,
   INPUT(_name='rememberlogin' ),
   INPUT(_type='submit'))
#in_form = SQLFORM.factory(
#Field('userid' , requires=IS_NOT_EMPTY()),
#Field('password' ),
#Field('rememberlogin' ),
#formstyle='divs',
#submit_button=' Submit ',
#table_name='login'
#)
#in_form[0][-1][1][0]['_class']='button'

print "Doing the process form testing ...\n"
if in_form.process().accepted :
print "Doing the LOGIN Accepts...\n"
response.flash = 'form accepted'
elif in_form.errors :
print "Doing the LOGIN error...\n"
response.flash = 'form has errors'

return dict()
#return dict(form=in_form)
--
And in the view (login.html) I have tried:

OR the SQLFORM value {{=from}} or EVEN nothing (both input type and =form
removed)

I Always NEVER EVER get the in_form.process().accepted : nor the
in_form.errors
hit.

Here is the Following logs from the print statements:

Thu Feb 14 11:34:59.578023 2019] [wsgi:error] [pid 29474] [remote
10.13.69.144:51763] Starting the DEFAULT Python Stuff ...
[Thu Feb 14 11:34:59.579647 2019] [wsgi:error] [pid 29474] [remote
10.13.69.144:51763] Doing the LOGIN form ...
[Thu Feb 14 11:34:59.579706 2019] [wsgi:error] [pid 29474] [remote
10.13.69.144:51763]
[Thu Feb 14 11:34:59.579903 2019] [wsgi:error] [pid 29474] [remote
10.13.69.144:51763] Doing the process form testing ...
[Thu Feb 14 11:34:59.579942 2019] [wsgi:error] [pid 29474] [remote
10.13.69.144:51763]
[Thu Feb 14 11:36:19.560354 2019] [wsgi:error] [pid 29474] [remote
10.13.69.144:51774] Starting the DEFAULT Python Stuff ...
[Thu Feb 14 11:36:19.562100 2019] [wsgi:error] [pid 29474] [remote
10.13.69.144:51774] Doing the LOGIN form ...
[Thu Feb 14 11:36:19.562156 2019] [wsgi:error] [pid 29474] [remote
10.13.69.144:51774]
[Thu Feb 14 11:36:19.562404 2019] [wsgi:error] [pid 29474] [remote
10.13.69.144:51774] Doing the process form testing ...
[Thu Feb 14 11:36:19.562444 2019] [wsgi:error] [pid 29474] [remote
10.13.69.144:51774]
[Thu Feb 14 11:36:25.923173 2019] [wsgi:error] [pid 29474] [remote
10.13.69.144:51788] Starting the DEFAULT Python Stuff ...
[Thu Feb 14 11:36:25.924805 2019] [wsgi:error] [pid 29474] [remote
10.13.69.144:51788] Doing the LOGIN form ...
[Thu Feb 14 11:36:25.924862 2019] [wsgi:error] [pid 29474] [remote
10.13.69.144:51788]
[Thu Feb 14 11:36:25.925040 2019] [wsgi:error] [pid 29474] [remote
10.13.69.144:51788] Doing the process form testing ...
[Thu Feb 14 11:36:25.925073 2019] [wsgi:error] [pid 29474] [remote
10.13.69.144:51788]

Ok, What could I be doing wrong, or am I missing something critical here ?

Thanks ..


*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group 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: Splitting form

2019-02-14 Thread Ben Duncan
Ok, I've gotten web2py working with the way I want.

Part of the problem is is needed to have:



then in the .html a formname assigned in the controller.

Everything is now shiny again 

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Tue, Feb 12, 2019 at 5:20 PM Ben Duncan  wrote:

> Ok, got it thanks ...
>
> *Ben Duncan*
> DBA / Chief Software Architect
> Mississippi State Supreme Court
> Electronic Filing Division
>
>
> On Tue, Feb 12, 2019 at 4:23 PM Dave S  wrote:
>
>>
>>
>> On Tuesday, February 12, 2019 at 1:40:25 PM UTC-8, Dave S wrote:
>>>
>>> On Tuesday, February 12, 2019 at 5:19:54 AM UTC-8, Ben Duncan wrote:
>>>>
>>>> Excuse my ignorance (Being a NEWBIE is irritating to me after having
>>>> done CS stuff for 30+ years)
>>>> But, Dave, exactly whats is turning on left-colum / right column
>>>> support ?
>>>>
>>>> Thanks ..
>>>>
>>>>
>>> The correct term is "sidebar", but it behaves like columns (magazine
>>> style, rather than newspaper style, I'd say), so I ask for your indulgence.
>>>
>>> In 2.17.1, the welcome app no longer has this present-but-disabled, but
>>> you can look at the examples app.  layout.html has conditionals for
>>> left_sidebar_enabled and right_sidebar_enabled, and several views in
>>> the default subdir have {{ block sidebar}} {{end}} (take a look at
>>> what.html, for instance).
>>>
>>>
>> In one of my apps, but not one I can reach from this location, I use the
>> left sidebar to  show a list of links, which is a common style, but my
>> sidebar isn't set off with a different background like them thar fancy
>> sites.
>>
>> /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.
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group 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] Run JAVA script in controller.

2019-02-14 Thread Ben Duncan
Is it possible to fire off a java script in the controller .py file?

i.e.:
if in_form.process(session=None, formname='login').accepted:
response.flash = 'form accepted'

   [ << JAVASCRIPT FIRES OFF HERE>>]

elif in_form.errors:
response.flash = 'form has errors'
else:
response.flash = 'please fill the form'

Thanks ...

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group 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: Migrate from sqlite to mysql

2019-02-14 Thread Ben Duncan
Ok, is the python AND the mysql on the same windows BOX ?
If not, could be a firewall issue.

For the record, my python stand alone are truly stand alone (But I run
LINUX , no Windowns here).
So all my script are not thru the web2py but use the pydal library ...


*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Thu, Feb 14, 2019 at 7:48 AM andfae  wrote:

> How to test via command prompt the connection between python and mysql?
>
> Il giorno gio 14 feb 2019 alle ore 14:47 andfae  ha
> scritto:
>
>> Yes I tried this usi too  uri = mysql://root:passwordroot@localhost/gadb
>> I don't know what is the problem...
>> Thank you
>>
>> Il giorno gio 14 feb 2019 alle ore 00:48 黄祥 
>> ha scritto:
>>
>>> RuntimeError: Failure to connect, tried 5 times:
>>>
>>> seems have a connection problem between python and mysql
>>> perhaps you can test the connection first (via command prompt)
>>>
>>> or perhaps an uri definition is wrong, had you try:
>>> *private/appconfig.ini*
>>> uri = mysql://root:passwordroot@localhost/gadb
>>> ?
>>>
>>> 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 a topic in the
>>> Google Groups "web2py-users" group.
>>> To unsubscribe from this topic, visit
>>> https://groups.google.com/d/topic/web2py/w0aSCaf7W5o/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.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group 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: Migrate from sqlite to mysql

2019-02-13 Thread Ben Duncan
Yes it will create the db.define.

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Wed, Feb 13, 2019 at 1:55 PM Andrea Fae'  wrote:

> Hello!
> I followed the instruction you wrote me.
> But at that point:" load web2py app, ensure migrate is true, so that will
> create the tables defined in web2py"
>
> I have this error:
>
> Error ticket for "ga"Ticket ID
>
> 127.0.0.1.2019-02-13.20-49-28.fcc1a494-3aa4-42c2-b1a9-ab14a466e72e
>  Failure to connect, tried 5 times:
> Traceback (most recent call last): File
> "C:\web2py\gluon\packages\dal\pydal\base.py", line 454, in __init__
> self._adapter = adapter(**kwargs) File
> "C:\web2py\gluon\packages\dal\pydal\adapters\__init__.py", line 40, in
> __call__ obj = super(AdapterMeta, cls).__call__(*args, **kwargs) File
> "C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 368, in
> __init__ super(SQLAdapter, self).__init__(*args, **kwargs) File
> "C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 52, in __init__
> self.reconnect() File "C:\web2py\gluon\packages\dal\pydal\connection.py",
> line 172, in reconnect self.connection = self.connector() File
> "C:\web2py\gluon\packages\dal\pydal\adapters\mysql.py", line 52, in
> connector return self.driver.connect(**self.driver_args) File
> "C:\web2py\gluon\contrib\pymysql\__init__.py", line 90, in Connect return
> Connection(*args, **kwargs) File
> "C:\web2py\gluon\contrib\pymysql\connections.py", line 688, in __init__
> self.connect() File "C:\web2py\gluon\contrib\pymysql\connections.py", line
> 905, in connect self._get_server_information() File
> "C:\web2py\gluon\contrib\pymysql\connections.py", line 1231, in
> _get_server_information self.server_charset = charset_by_id(lang).name File
> "C:\web2py\gluon\contrib\pymysql\charset.py", line 38, in by_id return
> self._by_id[id] KeyError: 255Versione
> web2py™ Version 2.16.1-stable+timestamp.2017.11.14.05.54.25Traceback
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
> 13.
> 14.
> 15.
> 16.
> 17.
> 18.
> 19.
> 20.
> 21.
> 22.
> 23.
> 24.
> 25.
> 26.
> 27.
> 28.
> 29.
> 30.
> 31.
> 32.
> 33.
> 34.
> 35.
> 36.
>
> Traceback (most recent call last):
>   File "C:\web2py\gluon\restricted.py", line 219, in restricted
> exec(ccode, environment)
>   File "C:/web2py/applications/ga/models/db.py" 
> <http://127.0.0.1:8000/admin/default/edit/ga/models/db.py>, line 34, in 
> 
> check_reserved=['all'])
>   File "C:\web2py\gluon\packages\dal\pydal\base.py", line 169, in __call__
> obj = super(MetaDAL, cls).__call__(*args, **kwargs)
>   File "C:\web2py\gluon\packages\dal\pydal\base.py", line 474, 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:\web2py\gluon\packages\dal\pydal\base.py", line 454, in __init__
> self._adapter = adapter(**kwargs)
>   File "C:\web2py\gluon\packages\dal\pydal\adapters\__init__.py", line 40, in 
> __call__
> obj = super(AdapterMeta, cls).__call__(*args, **kwargs)
>   File "C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 368, in 
> __init__
> super(SQLAdapter, self).__init__(*args, **kwargs)
>   File "C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 52, in 
> __init__
> self.reconnect()
>   File "C:\web2py\gluon\packages\dal\pydal\connection.py", line 172, in 
> reconnect
> self.connection = self.connector()
>   File "C:\web2py\gluon\packages\dal\pydal\adapters\mysql.py", line 52, in 
> connector
> return self.driver.connect(**self.driver_args)
>   File "C:\web2py\gluon\contrib\pymysql\__init__.py", line 90, in Connect
> return Connection(*args, **kwargs)
>   File "C:\web2py\gluon\contrib\pymysql\connections.py", line 688, in __init__
> self.connect()
>   File "C:\web2py\gluon\contrib\pymysql\connections.py", line 905, in connect
> self._get_server_information()
>   File "C:\web2py\gluon\contrib\pymysql\connections.py", line 1231, in 
> _get_server_information
> self.server_charset = charset_by_id(lang).name
>   File "C:\web2py\gluon\contrib\pymysql\charset.py", line 38, in by_id
> return self._by_id[id]
> KeyError: 255
>
> In file: C:\web2py\applications\ga\models\db.py
>
> 1.
>
>  at 0AC93830, file 
> "C:\w

Re: [web2py] Re: Splitting form

2019-02-12 Thread Ben Duncan
Ok, got it thanks ...

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Tue, Feb 12, 2019 at 4:23 PM Dave S  wrote:

>
>
> On Tuesday, February 12, 2019 at 1:40:25 PM UTC-8, Dave S wrote:
>>
>> On Tuesday, February 12, 2019 at 5:19:54 AM UTC-8, Ben Duncan wrote:
>>>
>>> Excuse my ignorance (Being a NEWBIE is irritating to me after having
>>> done CS stuff for 30+ years)
>>> But, Dave, exactly whats is turning on left-colum / right column support
>>> ?
>>>
>>> Thanks ..
>>>
>>>
>> The correct term is "sidebar", but it behaves like columns (magazine
>> style, rather than newspaper style, I'd say), so I ask for your indulgence.
>>
>> In 2.17.1, the welcome app no longer has this present-but-disabled, but
>> you can look at the examples app.  layout.html has conditionals for
>> left_sidebar_enabled and right_sidebar_enabled, and several views in the
>> default subdir have {{ block sidebar}} {{end}} (take a look at  what.html,
>> for instance).
>>
>>
> In one of my apps, but not one I can reach from this location, I use the
> left sidebar to  show a list of links, which is a common style, but my
> sidebar isn't set off with a different background like them thar fancy
> sites.
>
> /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.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group 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: Splitting form

2019-02-12 Thread Ben Duncan
Excuse my ignorance (Being a NEWBIE is irritating to me after having done
CS stuff for 30+ years)
But, Dave, exactly whats is turning on left-colum / right column support ?

Thanks ..


*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Mon, Feb 11, 2019 at 4:11 PM Dave S  wrote:

>
>
> On Monday, February 11, 2019 at 9:13:48 AM UTC-8, Ben Duncan wrote:
>>
>> Ok, any ideas of how I can split my form down the middle using sqlform ?
>>
>> I need the left 50% for login input and the right  50% for a NEWS coulumn:
>>
>> ie:
>>
>> MY HEADER TOP LINE STUFF HERE
>>
>> -+
>> User ID  |
>> (a pic) NEWS
>> []
>> |Headline Next Line
>> Password
>> |--
>> []
>> |   Blah Blah Blah Blah .
>>
>> |
>>  |
>>
>> --------
>>
>> ANY help is appreciated
>>
>> Thanks ...
>>
>> *Ben Duncan*
>> DBA / Chief Software Architect
>> Mississippi State Supreme Court
>> Electronic Filing Division
>>
>
> Turning on the left-column support in the example views doesn't work for
> you?
>
> (There is also right-column support, if being left isn't enough for you.)
>
> /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.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group 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] Accessing MySQL data without define tables

2019-02-12 Thread Ben Duncan
Here is the TOP of what I use.
You will  need the migrate commands in your connections tring

--


import os, sys, string, copy, time
import getopt
from types import *

from pydal import DAL, Field

db = DAL("postgres://postgres:postgres@localhost:7103/ac03303_live",
pool_size=10, migrate_enabled=False, fake_migrate_all=True )
print db._uri
print db._dbname


db.define_table('company',
Field('company_number', type='integer'),
Field('company_name', type='string', length=255),
Field('address_1', type='string', length=255),
Field('address_2', type='string', length=255),
Field('city', type='string', length=255),
Field('state', type='string', length=20),
Field('zip', type='string', length=10),
.....


*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Tue, Feb 12, 2019 at 4:26 AM Jon Subscripted 
wrote:

> Hi,
> BTW I was checking "sql.log" file just in case I had unintentionally
> messed up redefining the fen field twice and saw that every execution of
> the script in my previous email led to a CREATE TABLE (see below). There's
> more than one (one per each test I performed with the script).
>
> Is this normal? Should the table definition in the script outside
> web2py-app lead to a CREATE TABLE?
>
> I also realized that the original CREATE TABLE statement created by web2py
> (at the very top of the "sql.log" file, right after auth tables are
> created) does have a different length VARCHAR( `fen` VARCHAR(512),).
>
> Can this kind of length difference lead to MySQL to create a duplicated
> field?
>
> Thanks in advance.
> Regards, Jon.
>
> timestamp: 2019-02-11T16:33:57.499000
> CREATE TABLE problem(
> id INT AUTO_INCREMENT NOT NULL,
> question_hint VARCHAR(255),
> fen VARCHAR(255),
> solutionSAN LONGTEXT,
> solutionUCI LONGTEXT,
> solordered CHAR(1),
> pcomment VARCHAR(255),
> previousFEN VARCHAR(255),
> previousSAN VARCHAR(255),
> previousUCI VARCHAR(255),
> game_control VARCHAR(255),
> ply_control INT,
> PRIMARY KEY(id)
> ) ENGINE=InnoDB CHARACTER SET utf8;
>
> On Tue, Feb 12, 2019 at 10:49 AM Jon Subscripted <
> jonsubscripti...@gmail.com> wrote:
>
>> Thanks Ben,
>> I did what you suggested and somehow I think I moved on.
>>
>> Still I got a weird error: InternalError: (1060, u"Duplicate column name
>> 'fen__tmp'")
>>
>> import sys
>>
>> sys.path.append(r'C:\Users\Jon\Downloads\web2py_src\web2py\gluon')
>>
>> from gluon import DAL,Field
>> from gluon import *
>>
>> dbpath =
>> r'C:\Users\Jon\Downloads\web2py_src\web2py\applications\xakemate_scratch\databases'
>> problemsuri = 'mysql://root:web2py@localhost/xakemate'
>> posFEN = 'rnb2rk1/pp4pp/1qpbp3/3p4/4P3/3P1NP1/PPPN1RBP/R1BQ3K b - - 0 13'
>>
>>
>> db = DAL(problemsuri)#,folder=dbpath)#,auto_import=True)
>>
>> db.define_table(
>> "problem",
>> Field("question_hint",type="string"),
>>
>> Field("fen",type="string"),#,requires=(IS_NOT_EMPTY(),IS_NOT_IN_DB(db,'problem.fen'))),
>> Field("solutionSAN",type="list:string",requires=IS_NOT_EMPTY()),
>> Field("solutionUCI",type="list:string",requires=IS_NOT_EMPTY()),
>> Field("solordered",type="boolean",default=True),
>> Field("pcomment",type="string"),
>> Field("previousSAN",type="string",default=''),
>> Field("previousUCI",type="string",default=''),
>> Field("previousFEN",type="string",default=''),
>> Field("game_control",type="string",default=''),
>> Field("ply_control",type="integer",default=0)
>> )
>>
>> query = (db.problem.fen == posFEN)
>> problem = db(query).select(orderby=db.problem.id).first()
>>
>> No handlers could be found for logger "web2py"
>> WARNING:root:Unable to import plural rules: No module named plural_rules
>>
>> Traceback (most recent call last):
>>   File "C:\Python27\withoutdefine.py", line 27, in 
>> Field("ply_control",type="integer",default=0)
>>   File "C:\Python27\lib\site-packages\gluon\dal.py", line 7085, in
>> define_table
>> table = self.lazy_define_table(tablename,*fields,**args)
>>   File "C:\Python27\lib\site-packages\glu

Re: [web2py] Re: Splitting form

2019-02-11 Thread Ben Duncan
Ok, thanks Val. that kinda gives me something to work with.
I had to modify the view to

:{extend 'layout.html'}}
Input form
{{=login_news}}
Submitted variables
{{=BEAUTIFY(request.vars)}}
To get it to work.

I will play with some more ...

Thanks again ...



On Mon, Feb 11, 2019 at 2:22 PM Val K  wrote:

> def login_news():
> form = SQLFORM.factory(Field('user'), Field('password', 'password'))
> if form.process().accepted:
> ... # auth logic goes here
>login_div = DIV(form, _style = 'display: inline-block; width:50%')
> news_div = DIV('blah '*50, _style = 'display: inline-block;width:50%;
> vertical-align:top;')
> return dict(login_news = DIV(login_div, news_div))
>
>
>
> On Monday, February 11, 2019 at 9:36:03 PM UTC+3, Ben Duncan wrote:
>>
>> I originally had it using FORM and could do that in the VIEW side of
>> things.
>> Doing that I somehow lost the usage of in_form.process/accept for some
>> reason.
>>
>> I was trying to see if i could do it with the SQLFORM(.factory) helpers
>> to regain those, but it looks like without great difficulty ..
>>
>> Thanks ...
>>
>> *Ben Duncan*
>> DBA / Chief Software Architect
>> Mississippi State Supreme Court
>> Electronic Filing Division
>>
>>
>> On Mon, Feb 11, 2019 at 12:13 PM Ben Lawrence  wrote:
>>
>>> You can use the FORM helper to add DIV elements. Or even add empty DIV
>>> elements which you can fill in later with JS
>>> one example
>>>  form = FORM( DIV(DIV( INPUT(...), , _class="col-sm-2") ,
>>> DIV("NEWS",_id="form-user", _class="col-sm-2" ))
>>> .
>>> , INPUT(_type='submit', _class = "btn btn-primary")
>>> , _method="post", _id="payment-form")
>>>
>>> not sure if thats helpful!
>>>
>>> On Monday, February 11, 2019 at 9:13:48 AM UTC-8, Ben Duncan wrote:
>>>>
>>>> Ok, any ideas of how I can split my form down the middle using sqlform ?
>>>>
>>>> I need the left 50% for login input and the right  50% for a NEWS
>>>> coulumn:
>>>>
>>>> ie:
>>>>
>>>> MY HEADER TOP LINE STUFF HERE
>>>>
>>>> -+
>>>> User ID  |
>>>> (a pic) NEWS
>>>> [
>>>> ]|Headline Next Line
>>>> Password
>>>> |--
>>>> [
>>>> ]|   Blah Blah Blah Blah .
>>>>
>>>> |
>>>>  |
>>>>
>>>> 
>>>>
>>>> ANY help is appreciated
>>>>
>>>> Thanks ...
>>>>
>>>> *Ben Duncan*
>>>> DBA / Chief Software Architect
>>>> Mississippi State Supreme Court
>>>> Electronic Filing Division
>>>>
>>> --
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> - http://github.com/web2py/web2py (Source code)
>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "web2py-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to web2py+un...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group 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: Splitting form

2019-02-11 Thread Ben Duncan
I originally had it using FORM and could do that in the VIEW side of things.
Doing that I somehow lost the usage of in_form.process/accept for some
reason.

I was trying to see if i could do it with the SQLFORM(.factory) helpers to
regain those, but it looks like without great difficulty ..

Thanks ...

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Mon, Feb 11, 2019 at 12:13 PM Ben Lawrence  wrote:

> You can use the FORM helper to add DIV elements. Or even add empty DIV
> elements which you can fill in later with JS
> one example
>  form = FORM( DIV(DIV( INPUT(...), , _class="col-sm-2") ,
> DIV("NEWS",_id="form-user", _class="col-sm-2" ))
> .
> , INPUT(_type='submit', _class = "btn btn-primary")
> , _method="post", _id="payment-form")
>
> not sure if thats helpful!
>
> On Monday, February 11, 2019 at 9:13:48 AM UTC-8, Ben Duncan wrote:
>>
>> Ok, any ideas of how I can split my form down the middle using sqlform ?
>>
>> I need the left 50% for login input and the right  50% for a NEWS coulumn:
>>
>> ie:
>>
>> MY HEADER TOP LINE STUFF HERE
>>
>> -+
>> User ID  |
>> (a pic) NEWS
>> []
>> |Headline Next Line
>> Password
>> |--
>> []
>> |   Blah Blah Blah Blah .
>>
>> |
>>  |
>>
>> 
>>
>> ANY help is appreciated
>>
>> Thanks ...
>>
>> *Ben Duncan*
>> DBA / Chief Software Architect
>> Mississippi State Supreme Court
>> Electronic Filing Division
>>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group 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] Over ride SQLFORM defaults

2019-02-11 Thread Ben Duncan
How can you over rider the default CSS in sqlform(.factory) ...
i.e.:
 in_form = SQLFORM.factory(
Field('userid', label='User Id: ', requires=IS_NOT_EMPTY(),
_style='width: 50%'),
Field('password', label='Password', type='password',
requires=IS_NOT_EMPTY()),
formstyle='divs',
submit_button=' Submit ',
)

_style as shown above is not accepted ...

Thanks ...

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group 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] Splitting form

2019-02-11 Thread Ben Duncan
Ok, any ideas of how I can split my form down the middle using sqlform ?

I need the left 50% for login input and the right  50% for a NEWS coulumn:

ie:

MY HEADER TOP LINE STUFF HERE
-+
User ID  |  (a
pic) NEWS
[]
|Headline Next Line
Password
|--
[]
|   Blah Blah Blah Blah .
  |
 |


ANY help is appreciated

Thanks ...

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group 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] Accessing MySQL data without define tables

2019-02-11 Thread Ben Duncan
No , all you need is the db.define for the table you are going to access,
unless there is foreign keyes involved.
Then include the PARENT table if these are child tables.

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Mon, Feb 11, 2019 at 9:27 AM Jon Subscripted 
wrote:

> Thanks Ben,
> Should I include just the define_table for that very table (there are
> more, but will not be accessed)?
> Regards, Jon.
>
> On Mon, Feb 11, 2019 at 4:26 PM Ben Duncan  wrote:
>
>> If this script is being run OUTSIDE the web2py environment then you will
>> need to include the define inside the python program itself.
>>
>> *Ben Duncan*
>> DBA / Chief Software Architect
>> Mississippi State Supreme Court
>> Electronic Filing Division
>>
>>
>> On Mon, Feb 11, 2019 at 9:01 AM Jon Subscripted <
>> jonsubscripti...@gmail.com> wrote:
>>
>>> Thanks Ben,
>>> Honestly I do not know if I understood what you suggest, sorry... it's
>>> actually my fault as I'm still trying to learn web2py (reading the manual,
>>> etc.).
>>>
>>> My web2py-app is actually working, but I still have lost of data to load
>>> in the DB. Most of the data to populate de DB is created outside the app
>>> itself (this may change in the future, but unfortunatelly it is like that
>>> now).
>>>
>>> As this data creation is done outside my web2py-app I wanted the scripts
>>> creating this data to check which data has already been uploaded to the
>>> web2py-app database. In order to do so I wrote a python script which is
>>> meant to be run apart from the web2py-app to check if the data is already
>>> in the DB (calling the snippet below), if it's not create it and then load
>>> it.
>>>
>>> problemsuri = 'mysql://root:web2py@localhost/xakemate'
>>> dbpath =
>>> r'C:\Users\Jon\Downloads\web2py_src\web2py\applications\xakemate_scratch\databases'
>>>
>>> def checkproblem(posFEN):
>>> print "checking",posFEN
>>> dbproblems = DAL(problemsuri,folder=dbpath,auto_import=True)
>>>
>>> query = (dbproblems.problem.fen == posFEN)
>>> problem = dbproblems(query).select(orderby=dbproblems.problem.id
>>> ).first()
>>> print "DUPLICATED problem",problem
>>> return problem
>>>
>>> But when I do run the code I get an error telling me "AttributeError:
>>> 'DAL' object has no attribute 'problem'".
>>>
>>> Do I need to define the table I'm trying to access again ('cause it's
>>> already defined in models folder, but not in this script)?
>>> If I do need to define the table again, How should I do it?
>>> Regards, Jon.
>>>
>>>
>>>
>>> On Mon, Feb 11, 2019 at 3:43 PM Ben Duncan  wrote:
>>>
>>>> Oh yeah. One thing I missed explaining is that I spend the end of last
>>>> year creating a python library that would take file layouts I've gleaned
>>>> from a 4GL, old cobol systems and an Informix database, and some Oracle
>>>> Financials.
>>>>
>>>> I've create a "layout template" that the library will generate the
>>>> create table, primary keyes, secondary keyes, foreign keyes, grants and
>>>> views.
>>>> As part of the library it will generate the pydal "define" statements
>>>> as well.
>>>>
>>>>
>>>> *Ben Duncan*
>>>> DBA / Chief Software Architect
>>>> Mississippi State Supreme Court
>>>> Electronic Filing Division
>>>>
>>>>
>>>> On Mon, Feb 11, 2019 at 8:36 AM Ben Duncan  wrote:
>>>>
>>>>> I'm not sure what your statement means, however i will give it my best
>>>>> shot to explain> I'm new to web2py myself.
>>>>> Her goes:
>>>>>
>>>>> In my models folder i have several different sub folders:
>>>>> ar, ap ,gl ...etc...
>>>>>
>>>>> Each has the definition. For example under ar there is the
>>>>> dbf_arfiles_dal.py which starts likes this:
>>>>>
>>>>> db.define_table('ar_cusmas_billing_info',
>>>>> Field('company_number', type='reference client.company_number',
>>>>> ondelete='CASCADE'),
>>>>> Field('client_number', type='reference client.client_number',
>>>>> ondelete='CASCADE'),
>>>

Re: [web2py] Accessing MySQL data without define tables

2019-02-11 Thread Ben Duncan
If this script is being run OUTSIDE the web2py environment then you will
need to include the define inside the python program itself.

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Mon, Feb 11, 2019 at 9:01 AM Jon Subscripted 
wrote:

> Thanks Ben,
> Honestly I do not know if I understood what you suggest, sorry... it's
> actually my fault as I'm still trying to learn web2py (reading the manual,
> etc.).
>
> My web2py-app is actually working, but I still have lost of data to load
> in the DB. Most of the data to populate de DB is created outside the app
> itself (this may change in the future, but unfortunatelly it is like that
> now).
>
> As this data creation is done outside my web2py-app I wanted the scripts
> creating this data to check which data has already been uploaded to the
> web2py-app database. In order to do so I wrote a python script which is
> meant to be run apart from the web2py-app to check if the data is already
> in the DB (calling the snippet below), if it's not create it and then load
> it.
>
> problemsuri = 'mysql://root:web2py@localhost/xakemate'
> dbpath =
> r'C:\Users\Jon\Downloads\web2py_src\web2py\applications\xakemate_scratch\databases'
>
> def checkproblem(posFEN):
> print "checking",posFEN
> dbproblems = DAL(problemsuri,folder=dbpath,auto_import=True)
>
> query = (dbproblems.problem.fen == posFEN)
> problem = dbproblems(query).select(orderby=dbproblems.problem.id
> ).first()
> print "DUPLICATED problem",problem
> return problem
>
> But when I do run the code I get an error telling me "AttributeError:
> 'DAL' object has no attribute 'problem'".
>
> Do I need to define the table I'm trying to access again ('cause it's
> already defined in models folder, but not in this script)?
> If I do need to define the table again, How should I do it?
> Regards, Jon.
>
>
>
> On Mon, Feb 11, 2019 at 3:43 PM Ben Duncan  wrote:
>
>> Oh yeah. One thing I missed explaining is that I spend the end of last
>> year creating a python library that would take file layouts I've gleaned
>> from a 4GL, old cobol systems and an Informix database, and some Oracle
>> Financials.
>>
>> I've create a "layout template" that the library will generate the create
>> table, primary keyes, secondary keyes, foreign keyes, grants and views.
>> As part of the library it will generate the pydal "define" statements as
>> well.
>>
>>
>> *Ben Duncan*
>> DBA / Chief Software Architect
>> Mississippi State Supreme Court
>> Electronic Filing Division
>>
>>
>> On Mon, Feb 11, 2019 at 8:36 AM Ben Duncan  wrote:
>>
>>> I'm not sure what your statement means, however i will give it my best
>>> shot to explain> I'm new to web2py myself.
>>> Her goes:
>>>
>>> In my models folder i have several different sub folders:
>>> ar, ap ,gl ...etc...
>>>
>>> Each has the definition. For example under ar there is the
>>> dbf_arfiles_dal.py which starts likes this:
>>>
>>> db.define_table('ar_cusmas_billing_info',
>>> Field('company_number', type='reference client.company_number',
>>> ondelete='CASCADE'),
>>> Field('client_number', type='reference client.client_number',
>>> ondelete='CASCADE'),
>>> Field('bank_name', type='string', length=30),
>>> Field('bank_route', type='integer'),
>>> Field('bank_acct', type='integer'),
>>> Field('cc', type='string', length=2),
>>> Field('ccno', type='integer'),
>>> Field('exp1', type='date'),
>>> Field('holder1', type='string', length=50),
>>> Field('cc2', type='string', length=2),
>>> Field('ccno2', type='integer'),
>>> Field('exp2', type='date'),
>>> Field('holder2', type='string', length=50),
>>> primarykey=['company_number','client_number'],
>>> migrate=False)
>>>
>>> db.define_table('ar_cusmas_pclass',
>>> Field('company_number', type='reference client.company_number',
>>> ondelete='CASCADE'),
>>> . and so one.
>>>
>>> In 0.py , I start it off as:
>>>
>>> --
>>>
>>> # -*- coding: utf-8 -*-
>>>
>>> #
>>> -
>>> # AppConfig configuration made easy. Lo

Re: [web2py] Accessing MySQL data without define tables

2019-02-11 Thread Ben Duncan
Oh yeah. One thing I missed explaining is that I spend the end of last year
creating a python library that would take file layouts I've gleaned from a
4GL, old cobol systems and an Informix database, and some Oracle Financials.

I've create a "layout template" that the library will generate the create
table, primary keyes, secondary keyes, foreign keyes, grants and views.
As part of the library it will generate the pydal "define" statements as
well.


*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Mon, Feb 11, 2019 at 8:36 AM Ben Duncan  wrote:

> I'm not sure what your statement means, however i will give it my best
> shot to explain> I'm new to web2py myself.
> Her goes:
>
> In my models folder i have several different sub folders:
> ar, ap ,gl ...etc...
>
> Each has the definition. For example under ar there is the
> dbf_arfiles_dal.py which starts likes this:
>
> db.define_table('ar_cusmas_billing_info',
> Field('company_number', type='reference client.company_number',
> ondelete='CASCADE'),
> Field('client_number', type='reference client.client_number',
> ondelete='CASCADE'),
> Field('bank_name', type='string', length=30),
> Field('bank_route', type='integer'),
> Field('bank_acct', type='integer'),
> Field('cc', type='string', length=2),
> Field('ccno', type='integer'),
> Field('exp1', type='date'),
> Field('holder1', type='string', length=50),
> Field('cc2', type='string', length=2),
> Field('ccno2', type='integer'),
> Field('exp2', type='date'),
> Field('holder2', type='string', length=50),
> primarykey=['company_number','client_number'],
> migrate=False)
>
> db.define_table('ar_cusmas_pclass',
> Field('company_number', type='reference client.company_number',
> ondelete='CASCADE'),
> . and so one.
>
> In 0.py , I start it off as:
>
> --
>
> # -*- coding: utf-8 -*-
>
> # -
> # AppConfig configuration made easy. Look inside private/appconfig.ini
> # Auth is for authenticaiton and access control
> # -
> import datetime
> from gluon.contrib.appconfig import AppConfig
> from gluon.settings import global_settings
> from gluon import current
> from gluon.tools import Crud, Service
> # from gluon.tools import Auth
>
> from gluon.storage import *
> from pydal.contrib import portalocker
> from pydal._compat import basestring, StringIO, integer_types, xrange,
> BytesIO, to_bytes, long
> from gluon.storage import Messages, Settings, Storage
> from gluon.utils import web2py_uuid
>
> from gluon.validators import CLEANUP, CRYPT, IS_ALPHANUMERIC,
> IS_DATE_IN_RANGE, IS_DATE, \
> IS_DATETIME_IN_RANGE, IS_DATETIME, IS_DECIMAL_IN_RANGE, \
> IS_EMAIL, IS_EMPTY_OR, IS_EXPR, IS_FLOAT_IN_RANGE, IS_IMAGE, \
> IS_IN_DB, IS_IN_SET, IS_INT_IN_RANGE, IS_IPV4, IS_LENGTH, \
> IS_LIST_OF, IS_LOWER, IS_MATCH, IS_EQUAL_TO, IS_NOT_EMPTY, \
> IS_NOT_IN_DB, IS_NULL_OR, IS_SLUG, IS_STRONG, IS_TIME, \
> IS_UPLOAD_FILENAME, IS_UPPER, IS_URL
>
> # from gluon.validators import CRYPT, IS_EMAIL, IS_EQUAL_TO,
> IS_INT_IN_RANGE, IS_LOWER, IS_MATCH, IS_NOT_EMPTY, \
> # IS_NOT_IN_DB
> from pydal.objects import Table, Field, Row
>
>  (and so on till I get to the bottom)
>
> # ---------
> # Local application settings
> # ---------
>
> settings = Storage()
>
> settings.migrate = False
> settings.title = request.application
> settings.subtitle = T('Ben Duncan')
> settings.author = 'Ben Duncan'
> settings.author_email = 'y...@example.com'
> settings.keywords = 'Ben Duncan'
> settings.description = 'Ben Duncan'
> settings.layout_theme = 'Default'
> settings.database_uri = 'postgres://
> web2py:web2py@10.13.70.47:7103/ac03303_live'
> settings.security_key = 'c4d5c7ec-97b4-474b-98d3-9c1582dad510'
> settings.email_server = 'localhost'
> settings.email_sender = 'y...@example.com'
> settings.email_login = ''
> settings.login_method = 'local'
> settings.login_config = ''
> settings.plugins = []
> session.is_logged_in = 'NO'
>
> --
>

Re: [web2py] Accessing MySQL data without define tables

2019-02-11 Thread Ben Duncan
I'm not sure what your statement means, however i will give it my best shot
to explain> I'm new to web2py myself.
Her goes:

In my models folder i have several different sub folders:
ar, ap ,gl ...etc...

Each has the definition. For example under ar there is the
dbf_arfiles_dal.py which starts likes this:

db.define_table('ar_cusmas_billing_info',
Field('company_number', type='reference client.company_number',
ondelete='CASCADE'),
Field('client_number', type='reference client.client_number',
ondelete='CASCADE'),
Field('bank_name', type='string', length=30),
Field('bank_route', type='integer'),
Field('bank_acct', type='integer'),
Field('cc', type='string', length=2),
Field('ccno', type='integer'),
Field('exp1', type='date'),
Field('holder1', type='string', length=50),
Field('cc2', type='string', length=2),
Field('ccno2', type='integer'),
Field('exp2', type='date'),
Field('holder2', type='string', length=50),
primarykey=['company_number','client_number'],
migrate=False)

db.define_table('ar_cusmas_pclass',
Field('company_number', type='reference client.company_number',
ondelete='CASCADE'),
. and so one.

In 0.py , I start it off as:
--

# -*- coding: utf-8 -*-

# -
# AppConfig configuration made easy. Look inside private/appconfig.ini
# Auth is for authenticaiton and access control
# -
import datetime
from gluon.contrib.appconfig import AppConfig
from gluon.settings import global_settings
from gluon import current
from gluon.tools import Crud, Service
# from gluon.tools import Auth

from gluon.storage import *
from pydal.contrib import portalocker
from pydal._compat import basestring, StringIO, integer_types, xrange,
BytesIO, to_bytes, long
from gluon.storage import Messages, Settings, Storage
from gluon.utils import web2py_uuid

from gluon.validators import CLEANUP, CRYPT, IS_ALPHANUMERIC,
IS_DATE_IN_RANGE, IS_DATE, \
IS_DATETIME_IN_RANGE, IS_DATETIME, IS_DECIMAL_IN_RANGE, \
IS_EMAIL, IS_EMPTY_OR, IS_EXPR, IS_FLOAT_IN_RANGE, IS_IMAGE, \
IS_IN_DB, IS_IN_SET, IS_INT_IN_RANGE, IS_IPV4, IS_LENGTH, \
IS_LIST_OF, IS_LOWER, IS_MATCH, IS_EQUAL_TO, IS_NOT_EMPTY, \
IS_NOT_IN_DB, IS_NULL_OR, IS_SLUG, IS_STRONG, IS_TIME, \
IS_UPLOAD_FILENAME, IS_UPPER, IS_URL

# from gluon.validators import CRYPT, IS_EMAIL, IS_EQUAL_TO,
IS_INT_IN_RANGE, IS_LOWER, IS_MATCH, IS_NOT_EMPTY, \
# IS_NOT_IN_DB
from pydal.objects import Table, Field, Row

 (and so on till I get to the bottom)

# -
# Local application settings
# -

settings = Storage()

settings.migrate = False
settings.title = request.application
settings.subtitle = T('Ben Duncan')
settings.author = 'Ben Duncan'
settings.author_email = 'y...@example.com'
settings.keywords = 'Ben Duncan'
settings.description = 'Ben Duncan'
settings.layout_theme = 'Default'
settings.database_uri = 'postgres://
web2py:web2py@10.13.70.47:7103/ac03303_live'
settings.security_key = 'c4d5c7ec-97b4-474b-98d3-9c1582dad510'
settings.email_server = 'localhost'
settings.email_sender = 'y...@example.com'
settings.email_login = ''
settings.login_method = 'local'
settings.login_config = ''
settings.plugins = []
session.is_logged_in = 'NO'

--

Then in db.py I have:

# -*- coding: utf-8 -*-

# -
# Database model
# -

db = DAL(settings.database_uri, pool_size=10, migrate_enabled=False,
fake_migrate_all=True )

# -
# Here is sample code if you need for
# - email capabilities
# - authentication (registration, login, logout, ... )
# - authorization (role based authorization)
# - services (xml, csv, json, xmlrpc, jsonrpc, amf, rss)
# - old style crud actions
# (more options discussed in gluon/tools.py)
# -
# host names must be a list of allowed host names (glob syntax allowed)
# auth = Auth(db, host_names=configuration.get('host.names'))
# auth = Auth(db, secure=True)
# -
#auth = Auth(db,signature=False)
crud = Crud(db)

.. (every thing else is commented out  as well. this is because I am
doing my own custome authentication and other
things - which MA

Re: [web2py] Accessing MySQL data without define tables

2019-02-08 Thread Ben Duncan
Did you set up the db_define table for the database in models.

For example, the accounting package I am working on for our Supreme Court
has and external postgres database.
>From the DDL, I've created, for example, the "ship to code" file (we reuse
for something else)
-
db.define_table('ar_ship_code',
Field('company_number', type='reference company.company_number',
ondelete='CASCADE'),
Field('code', type='string', length=10),
Field('short_desc', type='string', length=20),
Field('description', type='string', length=255),
Field('notes', type='text'),
primarykey=['company_number','code'],
migrate=False)
---

For each table you want to access, you will need a "db.define_table" entry
in the model directory.

Hope this helps
*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Fri, Feb 8, 2019 at 7:17 AM Jon Subscripted 
wrote:

> Hi everyone,
> I'm trying to access the data stored in my app db from a different piece
> of software (apart from my web2py app). But I get an error AttributeError.
>
> Based on the manual:
>
>
> http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Using-DAL-without-define-tables
>
> I used the code below (from IDLE):
>
> import sys
>
> sys.path.append(r'C:\Users\Jon\Downloads\web2py_src\web2py\gluon')
>
> from gluon import DAL
>
> dbpath =
> r'C:\Users\Jon\Downloads\web2py_src\web2py\applications\xakemate_scratch\databases'
> problemsuri = 'mysql://root:web2py@localhost/xakemate'
> pos = 'test_position'
>
> db = DAL(problemsuri,folder=dbpath,auto_import=True)
> query = (db.problem.fen == pos)
> problem = db(query).select(orderby=db.problem.id).first()
>
> I get the following error:
>
> Traceback (most recent call last):
>   File "", line 1, in 
> query = (dbproblems.problem.fen == posFEN)
>   File "C:\Python27\lib\site-packages\gluon\dal.py", line 7150, in
> __getattr__
> return ogetattr(self, key)
> AttributeError: 'DAL' object has no attribute 'problem'
>
> From what I understood the tables should be auto-imported and thus known
> to my code. Why is it not finding the table?
>
> In addition to that I've got a couple of questions:
>
> 1st Should I import PYDAL (from pydal import DAL)  or GLUON.DAL (as I did)?
>
> 2nd Even when using the db different from SQLite should we point to
> "applications/myapp/databases"?
>
> Thanks in advance, Jon.
>
>
> <https://www.avast.com/sig-email?utm_medium=email_source=link_campaign=sig-email_content=webmail>
>  Libre
> de virus. www.avast.com
> <https://www.avast.com/sig-email?utm_medium=email_source=link_campaign=sig-email_content=webmail>
> <#m_-5898545075541849496_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [web2py] Re: how do I Select in a FORM using a database.

2019-02-06 Thread Ben Duncan
Again, thanks Dave.

Seems if you do not use the full feature set of SQLFORM(factory) the
IS_IN_DB method does not work.

I was using the view to populate the form, but then simply using the
sqlform to get the values.

My way around this is something like this from the view:


{{isession.company_info = \
 db(db.company.company_number > '0').\
 select(db.company.company_number,db.company.company_name,\
 orderby=db.company.company_number) }} {{pass}}


  
--Please choose an option--
{{for comp in session.company_info:}}

 {{print "VIEW MSQL COMPANY INFO 2: ID - %i  Name: %s" % (
comp.company_number, comp.company_name) }}
  '{{=comp.company_name}}'
{{pass}}
  






*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Tue, Feb 5, 2019 at 5:30 PM Dave S  wrote:

>
>
> On Tuesday, February 5, 2019 at 4:31:33 AM UTC-8, Ben Duncan wrote:
>>
>> This is to have a drop down list appear.
>> Currently sqlform.factory works only if you have all the labels etc in
>> the sqlform.factory.
>>
>> I have a custom html using flex boxes and modal in the views but
>> following these instructions:
>>
>> http://web2py.com/books/default/chapter/29/07/forms-and-validators#SQLFORM-in-HTML
>>
>> Using IS_IN_DB doesn't work when included in the sqlform.factory ...
>>
>> *Ben Duncan*
>> DBA / Chief Software Architect
>> Mississippi State Supreme Court
>> Electronic Filing Division
>>
>>
> I'm going to defer to the experts, but I think you've explained your use
> case much better this time.
>
> /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.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group 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: Clear a form after submit

2019-02-06 Thread Ben Duncan
Ok, I found the answer. It's by putting in the entry ' autocomplete="off" '
in the From my testing and sample, I probably, like you will be using the FORM
construct for this project rather than
the SQLFORM libraries ...



*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Tue, Feb 5, 2019 at 5:28 PM Dave S  wrote:

>
>
> On Tuesday, February 5, 2019 at 1:17:50 PM UTC-8, Ben Duncan wrote:
>>
>> What is the best way to clear a form in web2py after it has been
>> submitted.
>>
>> Thanks
>>
>> *Ben Duncan*
>> DBA / Chief Software Architect
>> Mississippi State Supreme Court
>> Electronic Filing Division
>>
>
> If you're using the  usual FORM() and SQLFORM() helpers, your controller
> will either redirect away from the form, or return it again.  Unless you
> use "keepvalues=True"), the form will be cleared when it is redrawn.  Note
> that the user's browser may suggest previous input when the user starts
> entering values.
>
> If you're using an HTML FORM tag directly, you may need to refresh the
> page.  I don't speak from experience (although I've done FORM tags in other
> contexts).
>
> I don't know much about SQLFORM.factory/grid as I've only made limited use
> of them.  SQLTABLE falls outside your question.
>
> /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.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group 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] Clear a form after submit

2019-02-05 Thread Ben Duncan
What is the best way to clear a form in web2py after it has been submitted.

Thanks

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group 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: how do I Select in a FORM using a database.

2019-02-05 Thread Ben Duncan
This is to have a drop down list appear.
Currently sqlform.factory works only if you have all the labels etc in the
sqlform.factory.

I have a custom html using flex boxes and modal in the views but following
these instructions:
http://web2py.com/books/default/chapter/29/07/forms-and-validators#SQLFORM-in-HTML

Using IS_IN_DB doesn't work when included in the sqlform.factory ...

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Mon, Feb 4, 2019 at 3:44 PM Dave S  wrote:

>
>
> On Monday, February 4, 2019 at 9:32:02 AM UTC-8, Ben Duncan wrote:
>>
>> Ok, I have a standard FORM doing a web page.
>> How do you do a select from a a database table in a FORM helper:
>>
>> ie what is equivalent to the sqlform.factory of:
>> 
>> Field('companyid',
>>
>> requires=IS_IN_DB(db,db.company.company_number,'%(company_name)s')),
>>
>> Thanks
>>
>>
>>
>> *Ben Duncan*
>> DBA / Chief Software Architect
>> Mississippi State Supreme Court
>> Electronic Filing Division
>>
>
>
> I'm not sure I understand your question.  If you want a *requires()* to
> be applied, I don't think you have to do anything extra after putting in
> the requirement.  If you want to do a lookup after form.accepts(), you just
> use form.vars, no?
>
> Most of my use of plain FORM() is for stuff that isn't in the DB.
>
> /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.
>

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


[web2py] how do I Select in a FORM using a database.

2019-02-04 Thread Ben Duncan
Ok, I have a standard FORM doing a web page.
How do you do a select from a a database table in a FORM helper:

ie what is equivalent to the sqlform.factory of:

Field('companyid',

requires=IS_IN_DB(db,db.company.company_number,'%(company_name)s')),

Thanks



*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group 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] demo apps on website broken

2019-01-31 Thread Ben Duncan
I'm still getting it ...

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Thu, Jan 31, 2019 at 3:22 PM Nico Zanferrari  wrote:

> Hi,
>
> this is working now from here ...
>
> Nico
>
> Il giorno gio 31 gen 2019 alle ore 20:25 Yi Liu  ha
> scritto:
>
>> There are a series of posts here about improving our website. And here is
>> another one.
>>
>> The interactive demo sites at this location:
>> http://www.web2py.com/demo_admin
>>
>> are broken, issuing:
>>
>> Internal errorTicket issued: unrecoverable
>> <http://www.web2py.com/admin/default/ticket/unrecoverable>
>>
>> Anyone know how to fix this?
>>
>> Best regards,
>> Yi
>>
>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To unsubscribe from this group 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.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group 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: Different layout.html

2019-01-15 Thread Ben Duncan
Here is one I am developing for the Supreme Court:
We are using flx boxes are the basis for things.
See:
https://internetingishard.com/html-and-css/flexbox/

!DOCTYPE html>


  

Bens Web Page

  




  
   
 MEC
   
  

  

   
{{if session.isloggedin == 'Y' :}}
   {{=session.username }}
{{else:}}
   Login
{{pass}}
Support
   
 {{=session.company}}
   





  {{include}}





Here is the CSS:

/* Start of CSS */
@charset "UTF-8";

/* Reset all THings ...
 * Understand ALL things will be treated like a FLEX box
 * SO use any defaults that pertain to those
 */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  border:0;
  outline:0;
  /* font-size:100%; */
  font-size: 18px ;
  vertical-align:baseline;
  background:transparent;
  align-items: center;
  }



blockquote, q { quotes:none; }
blockquote:before, blockquote:after,
q:before, q:after { content:''; content:none; }


#top-container {
  display: flex ;
  justify-content: center;
  color: #fff;
  background-color: blue;  /* Blue */
  height:60px ;
  width: 100%;
  padding-top: 10px ;
  padding-bottom: 10px ;
  padding-right: 10px ;
  padding-left: 10px ;
  border: 5px solid #fff;
  border-radius: 0px 0px 30px 0px ;
  position: fixed ;
}

.top-noborder {
  display: flex;
  justify-content: space-between;
  border: none ;
  width: 900px;
}

.top-border {
  display: flex;
  justify-content: space-between;
  border: 1px solid #fff;
  width: 900px;
}

.top-mec {
  display: flex;
  justify-content: flex-center;
  align-items: center;
}

.top-links {
  display: flex;
  justify-content: flex-end;
  font-weight: bold;
}

.top-login {
  margin-left: 20px;
  font-weight: bold;
}

.top-companyname {
  margin-left: 20px;
  align-items: right ;
  font-weight: bold;
}
* Our Header line with stuff in it ...
 */

#header-container {
  display: flex ;
  color: black ;
  background-color: white ;
  padding-top: 30px ;
}

.header {
  display: flex;
  justify-content: space-evenly;
  width: 900px;
}

.meclogo {
  display: flex;
  justify-content: flex-center ;
  align-items: center;
  padding-top: 30px ;
}
.header-text {
  display: flex;
  justify-content: flex-right ;
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif ;
  align-items: right ;
  padding-top: 30px ;
  /* font-size: 3.0em ; */
  font-size: 45px ;
}
/* Photo Boxes
 */
#photo-grid-container {
  display: flex;
  justify-content: center;
  border: 2px solid black;
}

.photo-grid {
  width: 900px;
  display: flex;
  justify-content: center ;
  flex-wrap: wrap ;
}

.photo-grid-item {
  border: 1px solid #fff;
  width: 300px;
  height: 300px;
}

#body-container {
  display: flex ;
  color: black ;
  background-color: white ;
  padding-top: 30px ;
  justify-content: flex-left ;
  align-items: top;
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif ;
  align-items: right ;
  padding-top: 20px ;
  padding-left: 70px ;
  font-size: 18px ;
  border: 8px solid black;
}
/* End of CSS */



*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Tue, Jan 15, 2019 at 6:56 AM  wrote:

> You can take any bootstrap html template and use it as layout. You just
> need to modify it a bit.
> Here's one
> <https://themeforest.net/item/goodway-multipurpose-business-template/11256908>
> template that I implemented into this webpage <http://www.panon.rs/>. And
> here's another web template
> <https://codecanyon.net/item/wireless-minimalist-bootstrap-ui-kit/10498551>
> that I'm using this webpage <https://sshreach.me/init/default/index>. Of
> course, basic knowledge of html and css is needed.
>
>
> On Wednesday, January 9, 2019 at 1:19:13 PM UTC+1, Chris V. wrote:
>>
>> Hi everyone!
>> I'm wonder if there is another layout.html to use in web2py?
>>
>> I have adapted the adminlte template (
>> https://adminlte.io/themes/AdminLTE/index2.html) and but is not adapted
>> at 100% (menu.py is not working and grid doesnt look good, but if you dont
>> mind to add the menu manually on the layout is ok. Response.flash works
>> perfect and the forms looks great.)
>>
>> i have a site using this (www.climbersoul.com)
>> i can share a n empty app with this layout if someone wants to play.
>> I wil try to adapt the layout in a 100%, when is finished i will share it
>> !
>>
>> Cheers.
>> Chris.
>>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails 

Re: [web2py] Happy New Year

2019-01-07 Thread Ben Duncan
8) auth logic were simpler and not tied to the current cookie/session/form
logic.

I know that auth logic is a PITA, but still a lot of users use it. Even
when use 3rd party services, is common to use some kind of authorization
mechanism, so, I think that the framework should, at least, build some
basic logic and an interface for extend or completely replace with 3rd
party modules or custom auth logic.

I'm on with that ONE:

I've already started on a ABAC type of replacement for the standard auth
stuff. I've been spending considerable amount of time figuring out what i'm
going to break by doing so ...

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Mon, Jan 7, 2019 at 9:58 AM António Ramos  wrote:

> 5) admin were a simpler vue.js app.  +1!!! dont forget vuex !!
>
> Em qui, 3 de jan de 2019 às 02:54, Carlos Cesar Caballero Díaz <
> carlos.caball...@cfg.jovenclub.cu> escreveu:
>
>> Happy new year!!
>>
>> I have answered this in other thread because for some reason I have
>> missed this one, and many of my wishes match yours
>> https://groups.google.com/d/msg/web2py/BskHaFZkVEI/sudO0jdsFgAJ
>>
>> First a question (mostly for curiosity). Why using Bottle instead (for
>> example) Flask or werkzeug or one of the new async microframeworks? I
>> assume because bottle is really small and we can include it without
>> dependencies, and less verbose than werkzeug, but I have never used it, so
>> I have no idea.
>>
>> We can look in weppy most of the features that I really would like to
>> have in web2py/web3py, it is in my opinion a great mix of flask and web2py
>> styles. One of the things that I most like is the pydal based ORM. I know
>> that there are a lot of people that like to work directly with the DAL, but
>> in my opinion a ORM helps when we need to use inheritance and reuse code,
>> and eases a lot the code reading in complex models. I really like the
>> concept of "fat models and thin controllers", but my models looks really
>> weird right now in web2py when I need to declare virtual fields or methods
>> with complex logic.
>>
>> I think that Weppy migrations are really useful in deployments and CI/CD,
>> mostly when we need to make complex changes in database or update  old
>> versions of our applications, because is easy to define an exact behavior
>> of migrations and data.
>>
>> Now some comments about your wishes:
>>
>> 4) the scheduler were part of pydal
>>
>> I am not sure about this, of course you know the web2py API a lot better
>> than me, and this have a reason, but I see the scheduler and the DAL as two
>> completely different things, with different responsibilities, so I don't
>> see why the scheduler should be part of pydal, instead of a standalone
>> module.
>>
>> 6) we could remove every filesystem IO (errors, sessions, uploads)
>>
>> But there should be an easy way for users to handle uploads, because is a
>> common task.
>>
>> 8) auth logic were simpler and not tied to the current
>> cookie/session/form logic.
>>
>> I know that auth logic is a PITA, but still a lot of users use it. Even
>> when use 3rd party services, is common to use some kind of authorization
>> mechanism, so, I think that the framework should, at least, build some
>> basic logic and an interface for extend or completely replace with 3rd
>> party modules or custom auth logic.
>>
>> 9) SQLFORM and Grid were JS libraries that use Ajax for communication
>>
>> That's good, but grid should be flexible enough, in my opinion, the main
>> issue with the grid right now, is that customization is very limited or
>> complex.
>>
>> Then web2py -> web3py would be a thin layer using bottle and the above
>> libs.
>>
>> I think that there is a niche among Python web frameworks right now, and
>> web2py -> web3py can fill it. There are a lot of microframeworks which are
>> good, and fast, but need a lot of code and 3rd party integrations for
>> building an application, there are others like django that include a lot of
>> things, but still needs a lot of coding for building things like grids and
>> forms or even a more classic app structure (that's why there are people
>> making money with code generators), and there is web2py, which needs really
>> little code for building applications, but is not "pythonic" or "flexible"
>> enough for take off between the developers. So in my opinion there is
>> space for a framework which makes the developer life easier, and be
>> "pythonic" and flexib

Re: [web2py] what is the webserver software of pythonanywhere

2018-12-19 Thread Ben Duncan
SEE:

https://www.pythonanywhere.com/forums/topic/2776/

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Wed, Dec 19, 2018 at 3:15 AM Arindam Dasgupta 
wrote:

> Hi,
>
> I need to have a ssl certificate for my webserver. So that the certificate
> vendor needs  the webserver software. Please help me to find it out. I am
> presented with a list like below :
> Where should I look for it in pythonanywhere.com ?
> [image: image.png]
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [web2py] Re: Issue with login_bare and custom tables

2018-12-17 Thread Ben Duncan
The new authentication functions I will be writing ...
But, Reading in the book under API, it looks like the will go in modules
since the will get imported (using the import)
first before the default stuff ...


*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Mon, Dec 17, 2018 at 9:12 AM Anthony  wrote:

> On Sunday, December 16, 2018 at 1:08:16 PM UTC-5, Ben Duncan wrote:
>>
>> Ok, Anthony will do.
>>
>> My question is should i put my new functions in "modules" or under
>> "controllers" ?
>>
>
> What functions?
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [web2py] Re: Issue with login_bare and custom tables

2018-12-16 Thread Ben Duncan
Ok, Anthony will do.

My question is should i put my new functions in "modules" or under
"controllers" ?

Thanks
*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Fri, Dec 14, 2018 at 5:56 PM Anthony  wrote:

> This should not be necessary. If you need to customize Auth tables, you
> must do so in a manner that does not break existing Auth functionality.
> Note, the problem you are having would not be limited to login_bare, but to
> the standard .login() method as well. We do not want to complicate the Auth
> code with lots of extra parameters and conditional logic to cover all the
> ways in which someone might customize the Auth tables in a breaking manner.
> Simply keep the default fields and add extra fields if needed. If you need
> a completely different type of table to operate outside of the Auth system,
> then don't customize an Auth table for such purposes but simply create an
> independent table.
>
> Anthony
>
> On Friday, December 14, 2018 at 9:29:37 AM UTC-5, Ben Duncan wrote:
>>
>> Can someone review and possible add this to a merge if accepted:
>> Issue
>>
>> Custom auth tables break login_bare:
>>
>> def login_bare(self, username, password, ident = None):
>> """
>> Logins user as specified by username (or email) and password
>>
>> If you use a custom auth user table and you do not have the
>> field name 'id' defined, pass the ident paramater to add the id
>> and value from ident field to avoid any errors from default
>> assumptions that 'id' exsists
>> """
>> settings = self._get_login_settings()
>> user = settings.table_user(**{settings.userfield: username})
>> if user and ident:
>>user['id'] = user[ident]
>>
>> if user and user.get(settings.passfield, False):
>> password = settings.table_user[
>> settings.passfield].validate(password)[0]
>> if ((user.registration_key is None or
>>  not user.registration_key.strip()) and
>> password == user[settings.passfield]):
>> self.login_user(user)
>> return user
>> else:
>> # user not in database try other login methods
>>     for login_method in self.settings.login_methods:
>> if login_method != self and login_method(username,
>> password):
>> self.user = user
>> return user
>> return False
>>
>>
>> Thanks ..
>>
>> *Ben Duncan*
>> DBA / Chief Software Architect
>> Mississippi State Supreme Court
>> Electronic Filing Division
>>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [web2py] How do I import Libraries in Web2py

2018-12-14 Thread Ben Duncan
https://help.pythonanywhere.com/pages/InstallingNewModules/

You will have to use a bash console ...

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Fri, Dec 14, 2018 at 10:10 AM Arindam Dasgupta 
wrote:

> Hi,
> I am takling about how to install libraries in python anywhere cloud just
> like I would open command prompt in my local machine and use the command 
> "python
> -m pip install XXX" in order to install a certain package locally. Where
> do I do the same thing after logging in to www.pythonanywhere.com?
>
> Regards,
> Arindam Dasgupta
>
> On Thu, Dec 13, 2018 at 9:38 PM Ben Duncan  wrote:
>
>> Are you talking about running IN pythonanywhere cloud?
>>
>> If you are talking about running locally but including the libraries, you
>> would install the libraries, then put the
>> include statements in models/0.py or models/db.py and modify the sys
>> search path as referenced in:
>>
>> https://docs.python.org/2/tutorial/modules.html
>>
>> Hope this helps ...
>>
>> *Ben Duncan*
>> DBA / Chief Software Architect
>> Mississippi State Supreme Court
>> Electronic Filing Division
>>
>>
>> On Thu, Dec 13, 2018 at 9:57 AM Arindam Dasgupta 
>> wrote:
>>
>>> Hi,
>>>
>>> I have a general question in my mind that how do I import a library in
>>> web2py.
>>> For example should I need a library like "openpyxl" or
>>> "matplotlib.pyplot" what do I do?  I am talking about the pythonanywhere
>>> framework available online through "https://www.pythonanywhere.com;.
>>>
>>> I should not expect that all the available libraries are already
>>> installed and I just have to import it at the top of my code. Also please
>>> let me know How do I find which libraries are available by default and
>>> which are not.
>>>
>>> Many thanks in advance for your help.
>>>
>>> Best Regards,
>>> Arindam
>>>
>>> --
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> - http://github.com/web2py/web2py (Source code)
>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "web2py-users" group.
>>> To unsubscribe from this group 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.
>>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group 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] Issue with login_bare and custom tables

2018-12-14 Thread Ben Duncan
Can someone review and possible add this to a merge if accepted:
Issue

Custom auth tables break login_bare:

def login_bare(self, username, password, ident = None):
"""
Logins user as specified by username (or email) and password

If you use a custom auth user table and you do not have the
field name 'id' defined, pass the ident paramater to add the id
and value from ident field to avoid any errors from default
assumptions that 'id' exsists
"""
settings = self._get_login_settings()
user = settings.table_user(**{settings.userfield: username})
if user and ident:
   user['id'] = user[ident]

if user and user.get(settings.passfield, False):
password = settings.table_user[
settings.passfield].validate(password)[0]
if ((user.registration_key is None or
 not user.registration_key.strip()) and
password == user[settings.passfield]):
self.login_user(user)
return user
else:
# user not in database try other login methods
for login_method in self.settings.login_methods:
if login_method != self and login_method(username,
password):
self.user = user
return user
    return False


Thanks ..

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group 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] lgoin_bare WTF???

2018-12-13 Thread Ben Duncan
Ok, I THINK the error is due to our custome tables
ie: Group is defined as :

db.define_table('auth_group',
Field('group_id', type='integer'),
Field('role', type='string', length=50),
Field('description', type='string', length=256),
Field('company_number', type='integer', default=0),
Field('created_on', type='datetime'),
Field('created_by', type='string', length=50),
Field('modified_on', type='datetime'),
Field('modified_by', type='string', length=50),
Field('notes', type='text'),
primarykey=['group_id'],
migrate=False)

SO (Correct me if I am wrong) it's trying to use the "self.user.id" which
is not defined, since these are cutome tables.

If so, how to I go about correcting this ?

As always, thanks ...

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Thu, Dec 13, 2018 at 3:06 PM Ben Duncan  wrote:

>
> *Ben Duncan*
> DBA / Chief Software Architect
> Mississippi State Supreme Court
> Electronic Filing Division
> Argg ... spoke to soon :
>
> Errors :
>
> web2py™ Version 2.17.2-stable+timestamp.2018.10.06.18.54.02
> Python Python 2.7.13: /usr/bin/python (prefix: /opt/rh/python27/root/usr)
> Traceback
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
> 13.
> 14.
> 15.
> 16.
> 17.
> 18.
>
> Traceback (most recent call last):
>   File "/data/web2py/web2py/gluon/restricted.py", line 219, in restricted
> exec(ccode, environment)
>   File "/data/web2py/web2py/applications/Mec/controllers/default.py" 
> <https://10.13.70.47/admin/default/edit/Mec/controllers/default.py>, line 
> 205, in 
>   File "/data/web2py/web2py/gluon/globals.py", line 421, in 
> self._caller = lambda f: f()
>   File "/data/web2py/web2py/applications/Mec/controllers/default.py" 
> <https://10.13.70.47/admin/default/edit/Mec/controllers/default.py>, line 25, 
> in user_bare
> user = auth.login_bare(username, cryptpassword)
>   File "/data/web2py/web2py/gluon/tools.py", line 2283, in login_bare
> self.login_user(user)
>   File "/data/web2py/web2py/gluon/authapi.py", line 739, in login_user
> self.update_groups()
>   File "/data/web2py/web2py/gluon/authapi.py", line 503, in update_groups
> table_membership.user_id == self.user.id).select()
>   File 
> "/opt/rh/python27/root/usr/lib/python2.7/site-packages/pyDAL-17.11-py2.7.egg/pydal/objects.py",
>  line 109, in __getattr__
> raise AttributeError
> AttributeError
>
> Error snapshot [image: help]
> <https://10.13.70.47/admin/default/ticket/Mec/10.13.69.144.2018-12-13.15-04-19.fd6eaf1e-d535-4d77-a405-c1054cbd0199#>
>
> ()
>
> inspect attributes
> Frames
>
>-
>
>*File /data/web2py/web2py/gluon/restricted.py in restricted at line
>219* code arguments variables
>-
>
>*File /data/web2py/web2py/applications/Mec/controllers/default.py in
> at line 205* code arguments variables
>-
>
>*File /data/web2py/web2py/gluon/globals.py in  at line 421*
>code arguments variables
>-
>
>*File /data/web2py/web2py/applications/Mec/controllers/default.py in
>user_bare at line 25* code arguments variables
>-
>
>*File /data/web2py/web2py/gluon/tools.py in login_bare at line 2283*
>code arguments variables
>-
>
>*File /data/web2py/web2py/gluon/authapi.py in login_user at line 739*
>code arguments variables
>-
>
>*File /data/web2py/web2py/gluon/authapi.py in update_groups at line
>503* code arguments variables
>-
>
>*File
>
> /opt/rh/python27/root/usr/lib/python2.7/site-packages/pyDAL-17.11-py2.7.egg/pydal/objects.py
>in __getattr__ at line 109* code arguments variables
>Function argument list
>
>(self=None, 'address_3': None, 'notes': None}>, k='id')
>Code listing
>
>104.
>105.
>106.
>107.
>108.
>109.
>110.
>111.
>112.
>113.
>
>
>def __getattr__(self, k):
>try:
>return self.__getitem__(k)
>except KeyError:
>raise AttributeError
>
>def __copy__(self):
>return Row(self)
>
>Variables
>builtinAttributeError 
>
> Context
>
> locals request session response
> In file: /data/web2py/web2py/applications/Mec/controllers/default.py
>
> 1.
>
>  at 0x7f1259ef06b0, file 
> "/data/web2py/web2py/applications/Mec/controllers/default.py", line 11>
>
>
> On Thu, Dec 13, 2018 at 3:02 PM Ben Duncan  wrote:
>

Re: [web2py] lgoin_bare WTF???

2018-12-13 Thread Ben Duncan
*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division
Argg ... spoke to soon :

Errors :

web2py™ Version 2.17.2-stable+timestamp.2018.10.06.18.54.02
Python Python 2.7.13: /usr/bin/python (prefix: /opt/rh/python27/root/usr)
Traceback

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

Traceback (most recent call last):
  File "/data/web2py/web2py/gluon/restricted.py", line 219, in restricted
exec(ccode, environment)
  File "/data/web2py/web2py/applications/Mec/controllers/default.py"
<https://10.13.70.47/admin/default/edit/Mec/controllers/default.py>,
line 205, in 
  File "/data/web2py/web2py/gluon/globals.py", line 421, in 
self._caller = lambda f: f()
  File "/data/web2py/web2py/applications/Mec/controllers/default.py"
<https://10.13.70.47/admin/default/edit/Mec/controllers/default.py>,
line 25, in user_bare
user = auth.login_bare(username, cryptpassword)
  File "/data/web2py/web2py/gluon/tools.py", line 2283, in login_bare
self.login_user(user)
  File "/data/web2py/web2py/gluon/authapi.py", line 739, in login_user
self.update_groups()
  File "/data/web2py/web2py/gluon/authapi.py", line 503, in update_groups
table_membership.user_id == self.user.id).select()
  File 
"/opt/rh/python27/root/usr/lib/python2.7/site-packages/pyDAL-17.11-py2.7.egg/pydal/objects.py",
line 109, in __getattr__
raise AttributeError
AttributeError

Error snapshot [image: help]
<https://10.13.70.47/admin/default/ticket/Mec/10.13.69.144.2018-12-13.15-04-19.fd6eaf1e-d535-4d77-a405-c1054cbd0199#>

()

inspect attributes
Frames

   -

   *File /data/web2py/web2py/gluon/restricted.py in restricted at line 219*
   code arguments variables
   -

   *File /data/web2py/web2py/applications/Mec/controllers/default.py in
at line 205* code arguments variables
   -

   *File /data/web2py/web2py/gluon/globals.py in  at line 421* code
   arguments variables
   -

   *File /data/web2py/web2py/applications/Mec/controllers/default.py in
   user_bare at line 25* code arguments variables
   -

   *File /data/web2py/web2py/gluon/tools.py in login_bare at line 2283* code
   arguments variables
   -

   *File /data/web2py/web2py/gluon/authapi.py in login_user at line 739*
   code arguments variables
   -

   *File /data/web2py/web2py/gluon/authapi.py in update_groups at line 503*
   code arguments variables
   -

   *File
   
/opt/rh/python27/root/usr/lib/python2.7/site-packages/pyDAL-17.11-py2.7.egg/pydal/objects.py
   in __getattr__ at line 109* code arguments variables
   Function argument list

   (self=, k='id')
   Code listing

   104.
   105.
   106.
   107.
   108.
   109.
   110.
   111.
   112.
   113.


   def __getattr__(self, k):
   try:
   return self.__getitem__(k)
   except KeyError:
   raise AttributeError

   def __copy__(self):
   return Row(self)

   Variables
   builtinAttributeError 

Context

locals request session response
In file: /data/web2py/web2py/applications/Mec/controllers/default.py

1.

 at 0x7f1259ef06b0, file
"/data/web2py/web2py/applications/Mec/controllers/default.py", line
11>


On Thu, Dec 13, 2018 at 3:02 PM Ben Duncan  wrote:

> Ok, I seem to have it working now:
>
> My Code Snippets if anyone is interested:
>
> controllers/default.py
> def user_bare():
> alg = 'pbkdf2(1000,20,sha512)'
> custom_auth_table.password.requires = None
> username, password = request.post_vars['username'],
> request.post_vars['password']
> session.is_logged_in = "NO"
> cryptpassword =
> str(CRYPT(digest_alg=alg,salt='Mars_Salt_4u')(password)[0])
>
> user = auth.login_bare(username, cryptpassword)
>
> #if auth.is_logged_in() :
> if user :
>session.is_logged_in = "YES"
>if auth.user['company_number'] == 0:
>  redirect(URL('company_choose'))
>else:
>  redirect(URL('index'))
>
> return dict()
>
>
> view/default/user_bar.html
>
> {{extend 'layout.html'}}
>
>  onclick="location.href='{{=URL('index')}}'"/>
>
>action="{{=URL()}}" method="post"> 
>  
>   
>  
>  
>   
>  
>  
>Submit
>      
>  
>
>
>
> *Ben Duncan*
> DBA / Chief Software Architect
> Mississippi State Supreme Court
> Electronic Filing Division
>
>
> On Thu, Dec 13, 2018 at 2:57 PM Ben Duncan  wrote:
>
>> Ok, thanks, will revisit it. I was getting insert errors from it before.
>> Maybe my ignorance ...
>>
>>
>> *Ben Duncan*
>> DBA / Chief Software Architect
>> Mississippi State Supreme Court
>> Electronic Filing Division
>>
&g

Re: [web2py] lgoin_bare WTF???

2018-12-13 Thread Ben Duncan
Ok, I seem to have it working now:

My Code Snippets if anyone is interested:

controllers/default.py
def user_bare():
alg = 'pbkdf2(1000,20,sha512)'
custom_auth_table.password.requires = None
username, password = request.post_vars['username'],
request.post_vars['password']
session.is_logged_in = "NO"
cryptpassword =
str(CRYPT(digest_alg=alg,salt='Mars_Salt_4u')(password)[0])

user = auth.login_bare(username, cryptpassword)

#if auth.is_logged_in() :
if user :
   session.is_logged_in = "YES"
   if auth.user['company_number'] == 0:
 redirect(URL('company_choose'))
   else:
 redirect(URL('index'))

return dict()


view/default/user_bar.html

{{extend 'layout.html'}}



 
 
  
 
 
  
 
 
   Submit
     
 



*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Thu, Dec 13, 2018 at 2:57 PM Ben Duncan  wrote:

> Ok, thanks, will revisit it. I was getting insert errors from it before.
> Maybe my ignorance ...
>
>
> *Ben Duncan*
> DBA / Chief Software Architect
> Mississippi State Supreme Court
> Electronic Filing Division
>
>
> On Thu, Dec 13, 2018 at 2:14 PM Anthony  wrote:
>
>> Got it, but I don't see login_bare/login_user/update_groups getting in
>> the way of any of that. The update_groups method simply adds a dictionary
>> of the user's current group ids/roles to the session, which can be used
>> instead of doing a database lookup on each request. You are free to ignore
>> it.
>>
>> Anthony
>>
>> On Thursday, December 13, 2018 at 11:34:05 AM UTC-5, Ben Duncan wrote:
>>>
>>> Thanks Anthony.
>>>
>>> I'm trying to maintain some reference to the auth mechanism , but our
>>> needs get a little more convoluted.
>>>
>>> Some Background Info:
>>> This is a accounting system (AR/AP/GL/IV/OE/PR/BI/BR/RMA/ ..etc) based
>>> upon about 30 years of collected source
>>> I have for Chancery / Circuit Clerks for Fees, Fines and restitution and
>>> land records et.all.
>>>
>>> I'm trying to keep it generic as possible for the Supreme Court.
>>>
>>> From the Clerks view, the are elected officials for a particular
>>> County/Jurisdiction. However, in some instances the may cover several
>>> counties / courts (if those are small).
>>>
>>> Courts are grouped in "districts" and we are going to using "company id"
>>> numbers to signify those courts within the districts and all courts under
>>> one
>>> umbrella for the database.
>>>
>>> Now the CLERKS have deputy clerks, who may OR may not be assigned to
>>> multiple county/courts and may be limited to WHAT or what they cannot
>>> do, but are designated by the "company" code to which court they will
>>> have access to.
>>> Add to that, the wants of our Office of the State Auditors our very own
>>> AOC (Administrator of Courts and their auditors) it gets pretty
>>> convulsed in a hurry.
>>>
>>> Now looking at the ACCESS CONTROL stuff, we are really a flipped version
>>> of that - GROUP and MEMBERSHIP before and controlling the
>>> auth_user.as well as company id in the group and membership/permission
>>> file.signifying what court the have jurisdiction to use. (Phew).
>>>
>>> I hope I haven't totally confused you.
>>>
>>> Thanks again ...
>>> *Ben Duncan*
>>> DBA / Chief Software Architect
>>> Mississippi State Supreme Court
>>> Electronic Filing Division
>>>
>>>
>>> On Thu, Dec 13, 2018 at 10:03 AM Anthony wrote:
>>>
>>>> On Wednesday, December 12, 2018 at 6:57:07 PM UTC-5, Ben Duncan wrote:
>>>>>
>>>>> Yes, I wanted to just use the auth_table.
>>>>> Everything else is controlled outside of the normal mechs ..
>>>>>
>>>>
>>>> If you don't want to use the Auth login mechanism, then I suppose you
>>>> can write your own logic. Keep in mind you will then be responsible for
>>>> updating the session with the appropriate auth data so Auth knows the user
>>>> is logged in on each subsequent request. But really, I don't see why you
>>>> would do that just to avoid having the list of group memberships
>>>> automatically updated upon login -- what problem is that creating for you?
>>>>
>>>> Anthony
>>>>
>>>> --
>>>> Resources:
>>>> - http://web2py.

Re: [web2py] lgoin_bare WTF???

2018-12-13 Thread Ben Duncan
Ok, thanks, will revisit it. I was getting insert errors from it before.
Maybe my ignorance ...


*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Thu, Dec 13, 2018 at 2:14 PM Anthony  wrote:

> Got it, but I don't see login_bare/login_user/update_groups getting in the
> way of any of that. The update_groups method simply adds a dictionary of
> the user's current group ids/roles to the session, which can be used
> instead of doing a database lookup on each request. You are free to ignore
> it.
>
> Anthony
>
> On Thursday, December 13, 2018 at 11:34:05 AM UTC-5, Ben Duncan wrote:
>>
>> Thanks Anthony.
>>
>> I'm trying to maintain some reference to the auth mechanism , but our
>> needs get a little more convoluted.
>>
>> Some Background Info:
>> This is a accounting system (AR/AP/GL/IV/OE/PR/BI/BR/RMA/ ..etc) based
>> upon about 30 years of collected source
>> I have for Chancery / Circuit Clerks for Fees, Fines and restitution and
>> land records et.all.
>>
>> I'm trying to keep it generic as possible for the Supreme Court.
>>
>> From the Clerks view, the are elected officials for a particular
>> County/Jurisdiction. However, in some instances the may cover several
>> counties / courts (if those are small).
>>
>> Courts are grouped in "districts" and we are going to using "company id"
>> numbers to signify those courts within the districts and all courts under
>> one
>> umbrella for the database.
>>
>> Now the CLERKS have deputy clerks, who may OR may not be assigned to
>> multiple county/courts and may be limited to WHAT or what they cannot
>> do, but are designated by the "company" code to which court they will
>> have access to.
>> Add to that, the wants of our Office of the State Auditors our very own
>> AOC (Administrator of Courts and their auditors) it gets pretty
>> convulsed in a hurry.
>>
>> Now looking at the ACCESS CONTROL stuff, we are really a flipped version
>> of that - GROUP and MEMBERSHIP before and controlling the
>> auth_user.as well as company id in the group and membership/permission
>> file.signifying what court the have jurisdiction to use. (Phew).
>>
>> I hope I haven't totally confused you.
>>
>> Thanks again ...
>> *Ben Duncan*
>> DBA / Chief Software Architect
>> Mississippi State Supreme Court
>> Electronic Filing Division
>>
>>
>> On Thu, Dec 13, 2018 at 10:03 AM Anthony wrote:
>>
>>> On Wednesday, December 12, 2018 at 6:57:07 PM UTC-5, Ben Duncan wrote:
>>>>
>>>> Yes, I wanted to just use the auth_table.
>>>> Everything else is controlled outside of the normal mechs ..
>>>>
>>>
>>> If you don't want to use the Auth login mechanism, then I suppose you
>>> can write your own logic. Keep in mind you will then be responsible for
>>> updating the session with the appropriate auth data so Auth knows the user
>>> is logged in on each subsequent request. But really, I don't see why you
>>> would do that just to avoid having the list of group memberships
>>> automatically updated upon login -- what problem is that creating for you?
>>>
>>> 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.
>>>
>> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [web2py] lgoin_bare WTF???

2018-12-13 Thread Ben Duncan
Thanks Anthony.

I'm trying to maintain some reference to the auth mechanism , but our needs
get a little more convoluted.

Some Background Info:
This is a accounting system (AR/AP/GL/IV/OE/PR/BI/BR/RMA/ ..etc) based upon
about 30 years of collected source
I have for Chancery / Circuit Clerks for Fees, Fines and restitution and
land records et.all.

I'm trying to keep it generic as possible for the Supreme Court.

>From the Clerks view, the are elected officials for a particular
County/Jurisdiction. However, in some instances the may cover several
counties / courts (if those are small).

Courts are grouped in "districts" and we are going to using "company id"
numbers to signify those courts within the districts and all courts under
one
umbrella for the database.

Now the CLERKS have deputy clerks, who may OR may not be assigned to
multiple county/courts and may be limited to WHAT or what they cannot
do, but are designated by the "company" code to which court they will have
access to.
Add to that, the wants of our Office of the State Auditors our very own AOC
(Administrator of Courts and their auditors) it gets pretty
convulsed in a hurry.

Now looking at the ACCESS CONTROL stuff, we are really a flipped version of
that - GROUP and MEMBERSHIP before and controlling the
auth_user.as well as company id in the group and membership/permission
file.signifying what court the have jurisdiction to use. (Phew).

I hope I haven't totally confused you.

Thanks again ...
*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Thu, Dec 13, 2018 at 10:03 AM Anthony  wrote:

> On Wednesday, December 12, 2018 at 6:57:07 PM UTC-5, Ben Duncan wrote:
>>
>> Yes, I wanted to just use the auth_table.
>> Everything else is controlled outside of the normal mechs ..
>>
>
> If you don't want to use the Auth login mechanism, then I suppose you can
> write your own logic. Keep in mind you will then be responsible for
> updating the session with the appropriate auth data so Auth knows the user
> is logged in on each subsequent request. But really, I don't see why you
> would do that just to avoid having the list of group memberships
> automatically updated upon login -- what problem is that creating for you?
>
> 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.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group 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] How do I import Libraries in Web2py

2018-12-13 Thread Ben Duncan
Are you talking about running IN pythonanywhere cloud?

If you are talking about running locally but including the libraries, you
would install the libraries, then put the
include statements in models/0.py or models/db.py and modify the sys search
path as referenced in:

https://docs.python.org/2/tutorial/modules.html

Hope this helps ...

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Thu, Dec 13, 2018 at 9:57 AM Arindam Dasgupta 
wrote:

> Hi,
>
> I have a general question in my mind that how do I import a library in
> web2py.
> For example should I need a library like "openpyxl" or "matplotlib.pyplot"
> what do I do?  I am talking about the pythonanywhere framework available
> online through "https://www.pythonanywhere.com;.
>
> I should not expect that all the available libraries are already installed
> and I just have to import it at the top of my code. Also please let me know
> How do I find which libraries are available by default and which are not.
>
> Many thanks in advance for your help.
>
> Best Regards,
> Arindam
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [web2py] DAL reference to table define after

2018-12-13 Thread Ben Duncan
Ok, if you are asking about a having multiple references to multiple
tables, you can't..
For example I have the following foreign keyes defined for a AR Customer
record:

ALTER TABLE ar_cusmas
   ADD CONSTRAINT ar_cusmas_company_fkey
   FOREIGN KEY( company_number )
   REFERENCES company (company_number)
   ON DELETE CASCADE
   ;
ALTER TABLE ar_cusmas
   ADD CONSTRAINT ar_cusmas_client_dalfkey
   FOREIGN KEY( company_number,client_number )
   REFERENCES client (company_number,client_number)
   ON DELETE CASCADE
   ;
ALTER TABLE ar_cusmas
   ADD CONSTRAINT ar_cusmas_userid_fkey
   FOREIGN KEY( username )
   REFERENCES user_id (username)
   ;
ALTER TABLE ar_cusmas
   ADD CONSTRAINT ar_cusmas_gl_acct_fkey
   FOREIGN KEY( company_number,gl_ar_account )
   REFERENCES gl_chart (company_number,gl_account_num)
   ;
... and so on ...

With DAL you can only have ONE referenced table.
In my table generator system, notice I have created a fk named :
ar_cusmas_client_dalfkey
That I know will be the ONLY one to use when creating the DAL layout like:

db.define_table('ar_cusmas',
Field('company_number', type='reference client.company_number',
ondelete='CASCADE'),
Field('client_number', type='reference client.client_number',
ondelete='CASCADE'),
Field('prid_number', type='integer'),
Field('username', type='string', length=50),
etc...
primarykey=['company_number','client_number'],
migrate=False)

If you try and use a "reference" to both table "A" and to table "B", you
will get an error.

DAL only allows a singular (one) reference table.

I hope this helps and was what you were looking for ..

thanks ..


*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Thu, Dec 13, 2018 at 4:13 AM António Ramos  wrote:

>
> How can a table X reference a field in other table Y that is defined after
> table X ?
>
> I have 2 tables that have fields that reference each other table fields...
> and i get an error
>
> regards
> António
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group 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] lgoin_bare WTF???

2018-12-12 Thread Ben Duncan
Yes, I wanted to just use the auth_table.
Everything else is controlled outside of the normal mechs ..

Thanks
*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Wed, Dec 12, 2018 at 4:09 PM Anthony  wrote:

> login_bare() is intended to log in the user without the unnecessary form
> processing of login(). Is there some reason you wouldn't what user_groups
> updated upon login? It is the list of auth groups of which the user is a
> member.
>
> 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.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group 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: Bug in tools.py

2018-12-12 Thread Ben Duncan
Ok, got it fixed. WAS too busy studying the forest of code to notice my
mistake .
The "or not" threw me

Thanks ...

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Wed, Dec 12, 2018 at 1:08 PM Marcelo Huerta 
wrote:

> Please open your nearest Python interpreter and type at the ">>> " prompt:
>
> help("".strip)
>
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group 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] lgoin_bare WTF???

2018-12-12 Thread Ben Duncan
 From the Manual:
Manual Authentication

Some times you want to implement your own logic and do "manual" user login.
This can also be done by calling the function:

1

user = auth.login_bare(username, password)

login_bare returns user if the user exists and the password is valid, else
it returns False. username is the email if the "auth_user" table does not
have a "username" field.
*-*
However, the code in login_bare goes about and does this:
if ((user.registration_key is None or not user.registration_key.strip())
   and  password == user[settings.passfield])):
self.login_user(user)
return user

Which is calling login_user, which is trying to do a self.update_groups()

My understanding of login_bare, is that all it is suppose to do is check
that the user exists in the auth_user file.

Is this not true ?

Thanks ...




*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group 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] Bug in tools.py

2018-12-12 Thread Ben Duncan
in tools.py,  function :login_bare there is the command:

if ((user.registration_key is None or not user.registration_key.strip()) and
password == user[settings.passfield]):
self.login_user(user)
return user

strip requires the the import of string.method
Shouldn't there be a "import string" after the def login_bare ?

Thanks.

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group 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] Where does it GO?

2018-12-12 Thread Ben Duncan
Ok, thanks ..

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Wed, Dec 12, 2018 at 9:36 AM Christian Varas 
wrote:

> It goes to the console where web2py is running or in the error logs of
> apache or nginx if you are running web2py in one of those.
>
> Cheers.
> Chris.
>
> El mié., 12 dic. 2018 11:39 a. m., Ben Duncan 
> escribió:
>
>> If you put a "print" statement in you application (controller or view)
>> where does the output go?
>>
>> (such as 'print "Testpoint 1")
>>
>> Thanks ..
>>
>> *Ben Duncan*
>> DBA / Chief Software Architect
>> Mississippi State Supreme Court
>> Electronic Filing Division
>>
>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To unsubscribe from this group 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.
>

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


[web2py] Where does it GO?

2018-12-12 Thread Ben Duncan
If you put a "print" statement in you application (controller or view)
where does the output go?

(such as 'print "Testpoint 1")

Thanks ..

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group 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: login_bare not working

2018-12-11 Thread Ben Duncan
Your right: should be:
Controller:
def user_bare():
username, password = request.post_vars['username'],
request.post_vars['password']
if not auth.user:
   form = auth.login_bare(username, password)

return dict(form=form)

View:
{{extend 'layout.html'}}



 
 
  
 
 
  
 
 
   Submit
 
 

But now am getting:
web2py™ Version 2.17.2-stable+timestamp.2018.10.06.18.54.02
Python Python 2.7.13: /usr/bin/python (prefix: /opt/rh/python27/root/usr)
Traceback

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

Traceback (most recent call last):
  File "/data/web2py/web2py/gluon/restricted.py", line 219, in restricted
exec(ccode, environment)
  File "/data/web2py/web2py/applications/Mec/controllers/default.py"
<https://10.13.70.47/admin/default/edit/Mec/controllers/default.py>,
line 119, in 
  File "/data/web2py/web2py/gluon/globals.py", line 421, in 
self._caller = lambda f: f()
  File "/data/web2py/web2py/applications/Mec/controllers/default.py"
<https://10.13.70.47/admin/default/edit/Mec/controllers/default.py>,
line 21, in user_bare
form = auth.login_bare(username, password)
  File "/data/web2py/web2py/gluon/tools.py", line 2283, in login_bare
self.login_user(user)
  File "/data/web2py/web2py/gluon/authapi.py", line 739, in login_user
self.update_groups()
  File "/data/web2py/web2py/gluon/authapi.py", line 503, in update_groups
table_membership.user_id == self.user.id).select()
  File 
"/opt/rh/python27/root/usr/lib/python2.7/site-packages/pyDAL-17.11-py2.7.egg/pydal/objects.py",
line 109, in __getattr__
raise AttributeError
AttributeError

Error snapshot [image: help]
<https://10.13.70.47/admin/default/ticket/Mec/10.13.69.144.2018-12-11.12-51-58.8ec7b7f4-643a-4ea2-b28d-0f5b5364bf57#>
With session.auth showing the correct user record.

But should NOT login_bare bypass all the checking of auth_membership,
groups , etc ?

ie:
Frames

   -

   *File /data/web2py/web2py/gluon/restricted.py in restricted at line 219*
   code arguments variables
   -

   *File /data/web2py/web2py/applications/Mec/controllers/default.py in
at line 119* code arguments variables
   -

   *File /data/web2py/web2py/gluon/globals.py in  at line 421* code
   arguments variables
   -

   *File /data/web2py/web2py/applications/Mec/controllers/default.py in
   user_bare at line 21* code arguments variables
   -

   *File /data/web2py/web2py/gluon/tools.py in login_bare at line 2283* code
   arguments variables
   -

   *File /data/web2py/web2py/gluon/authapi.py in login_user at line 739*
   code arguments variables
   -

   *File /data/web2py/web2py/gluon/authapi.py in update_groups at line 503*
   code arguments variables
   -

   *File
   
/opt/rh/python27/root/usr/lib/python2.7/site-packages/pyDAL-17.11-py2.7.egg/pydal/objects.py
   in __getattr__ at line 109* code arguments variables
   Function argument list

   (self=, k='id')
   Code listing

   104.
   105.
   106.
   107.
   108.
   109.
   110.
   111.
   112.
   113.


   def __getattr__(self, k):
   try:
   return self.__getitem__(k)
   except KeyError:
       raise AttributeError

   def __copy__(self):
   return Row(self)


Thanks ...


*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Tue, Dec 11, 2018 at 11:19 AM Yoel Benitez Fonseca 
wrote:

> probably abastardi wants:
>
> username, password = request.post_vars['username'], 
> request.post_vars['password']
> if not auth.user:
>  auth.login_bare(username, password)
>
>
> What is that's for ... i can only guest...
>
>
> On Dec 11 2018, at 11:58 am, Anthony  wrote:
>
>
> What is the point of calling login_bare a second time after it has failed
> the first time?
>
>
> What I click to fire off the "bare login" all I get is an empty web page
>
> that says "None"
>
>
> Presumably your controller is returning None, but hard to say what's
> happening without the code.
>
> 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.
>
> [image: Open Tracking]
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.g

[web2py] login_bare not working

2018-12-11 Thread Ben Duncan
Ok, I followed this example and made changes to the db.py to use username
instead of email attribute.

In your controller, auth.login_bare is the trick:

email, password = request.post_vars['email'],
request.post_vars['password']if not auth.login_bare(email, password):
 db.auth_user.insert(
  first_name=None,
  last_name=None,
  email=email,
  password=db.auth_user.password.requires[0](password)[0]
 )
 auth.login_bare(email, password)

shortened it and changed it to:

username, password = request.post_vars['username'],
request.post_vars['password']if not auth.login_bare(username,
password):
 auth.login_bare(username, password)
with the view looking like:
 
 
  
 
 
  
 
 
   Submit
  

What I click to fire off the "bare login" all I get is an empty web page

that says "None"

What do i need to do to get login_bare to work ?

Thanks ...


*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group 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] DAL issues ....

2018-12-06 Thread Ben Duncan
Controller Code:

def company_login():

form = SQLFORM.factory(
Field('username', label = 'User Name', requires=IS_NOT_EMPTY()),
Field('password', 'password', label =
"Password",requires=IS_NOT_EMPTY()),
Field('Company', label = 'Court ID',

requires=IS_IN_DB(db,db.company.company_number,'%(company_name)s')),
submit_button=' Login ',
)

if form.process().accepted:
   response.flash = 'form accepted'
elif form.errors:
   response.flash = T('form has errors')

session.company = request.vars['Company']

Company_ID = session.company

if session.company :
   DbRows = db(db.company.company_number==Company_ID).select().first()
   session.company_data = DbRows
   session.company_name = DbRows.company_name
   session.company_ap_aging = DbRows.

return dict(form=form)

The reason I need this setup is that this is the Company Record that
controls all aspects of
the system (see ap_apaging_days). It also controls what sub-apps are on and
off ...



*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Thu, Dec 6, 2018 at 2:59 PM Jim S  wrote:

> I'd love to see the final controller code if you have the time?
>
> Also, I'm curious as to why you're putting all this in the session.  Why
> not just pass it in the dict being returned to the view?
>
> -Jim
>
> On Thursday, December 6, 2018 at 2:46:22 PM UTC-6, Ben Duncan wrote:
>>
>> Ok, YOU GUYS are awesome ...
>> Your replies gave me the insight I needed !
>>
>> Here is the explanation:
>>
>> A: in the database, the passes were for the "lookup" in the
>> SQLFORM.factory
>>SO there was the confusion there ...
>>
>> B: It seems there is a 2 passes thru the controller (which this group
>> gave me the hint at it)
>> The failure was at the first pass when nothing was set ...
>> putting this in:
>>
>> if session.company :
>>DbRows =
>> db(db.company.company_number==Company_ID).select(db.company.company_name).first()
>>session.company_data = DbRows
>>session.company_name = DbRows.company_name
>>
>> Allowed me to PASS unharmed and get what I needed.
>>
>> THANKS Again, group 
>>
>>
>> .
>> *Ben Duncan*
>> DBA / Chief Software Architect
>> Mississippi State Supreme Court
>> Electronic Filing Division
>>
>>
>> On Thu, Dec 6, 2018 at 2:21 PM Ben Duncan  wrote:
>>
>>> The request.vars get set from the SQL form in the controller
>>> Removed all the COMMENTS, and in the controller put a print and changed
>>> the code:
>>>
>>> DbRows =
>>> db(db.company.company_number==Company_ID).select(db.company.company_name).first()
>>> print DbRows['company_name']
>>> session.company_data = DbRows
>>> return dict(form=form,DbRows=DbRows)
>>>
>>> And still getting a failure now on the print line ...
>>>
>>> Ticket ID
>>>
>>> 10.13.69.144.2018-12-06.13-53-08.f35db77f-72f8-4749-82e9-90eda4c32141
>>>  'NoneType' object has no attribute
>>> '__getitem__' Version
>>> web2py™ Version 2.17.2-stable+timestamp.2018.10.06.18.54.02
>>> Python Python 2.7.13: /usr/bin/python (prefix:
>>> /opt/rh/python27/root/usr) Traceback
>>>
>>> 1.
>>> 2.
>>> 3.
>>> 4.
>>> 5.
>>> 6.
>>> 7.
>>> 8.
>>> 9.
>>> 10.
>>>
>>> Traceback (most recent call last):
>>>   File "/data/web2py/web2py/gluon/restricted.py", line 219, in restricted
>>> exec(ccode, environment)
>>>   File "/data/web2py/web2py/applications/Mec/controllers/default.py" 
>>> <https://10.13.70.47/admin/default/edit/Mec/controllers/default.py>, line 
>>> 101, in 
>>>   File "/data/web2py/web2py/gluon/globals.py", line 421, in 
>>> self._caller = lambda f: f()
>>>   File "/data/web2py/web2py/applications/Mec/controllers/default.py" 
>>> <https://10.13.70.47/admin/default/edit/Mec/controllers/default.py>, line 
>>> 87, in company_login
>>> print DbRows['company_name']
>>> TypeError: 'NoneType' object has no attribute '__getitem__'
>>>
>>>
>>>
>>> It's very strange how :
>>>  session.company_data = DbRows
>>> Gets passed.
>>>
>>> However, looking at the postgres logs:
>>>  2018-12-06 14:18:31.482 CST SessId: 5c0981bd.6e70  TrxId: 0>LOG:
>>> statement: S

Re: [web2py] DAL issues ....

2018-12-06 Thread Ben Duncan
Ok, YOU GUYS are awesome ...
Your replies gave me the insight I needed !

Here is the explanation:

A: in the database, the passes were for the "lookup" in the SQLFORM.factory
   SO there was the confusion there ...

B: It seems there is a 2 passes thru the controller (which this group gave
me the hint at it)
The failure was at the first pass when nothing was set ...
putting this in:

if session.company :
   DbRows =
db(db.company.company_number==Company_ID).select(db.company.company_name).first()
   session.company_data = DbRows
   session.company_name = DbRows.company_name

Allowed me to PASS unharmed and get what I needed.

THANKS Again, group ....


.
*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Thu, Dec 6, 2018 at 2:21 PM Ben Duncan  wrote:

> The request.vars get set from the SQL form in the controller
> Removed all the COMMENTS, and in the controller put a print and changed
> the code:
>
> DbRows =
> db(db.company.company_number==Company_ID).select(db.company.company_name).first()
> print DbRows['company_name']
> session.company_data = DbRows
> return dict(form=form,DbRows=DbRows)
>
> And still getting a failure now on the print line ...
>
> Ticket ID
>
> 10.13.69.144.2018-12-06.13-53-08.f35db77f-72f8-4749-82e9-90eda4c32141
>  'NoneType' object has no attribute
> '__getitem__' Version
> web2py™ Version 2.17.2-stable+timestamp.2018.10.06.18.54.02
> Python Python 2.7.13: /usr/bin/python (prefix: /opt/rh/python27/root/usr)
> Traceback
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
>
> Traceback (most recent call last):
>   File "/data/web2py/web2py/gluon/restricted.py", line 219, in restricted
> exec(ccode, environment)
>   File "/data/web2py/web2py/applications/Mec/controllers/default.py" 
> <https://10.13.70.47/admin/default/edit/Mec/controllers/default.py>, line 
> 101, in 
>   File "/data/web2py/web2py/gluon/globals.py", line 421, in 
> self._caller = lambda f: f()
>   File "/data/web2py/web2py/applications/Mec/controllers/default.py" 
> <https://10.13.70.47/admin/default/edit/Mec/controllers/default.py>, line 87, 
> in company_login
> print DbRows['company_name']
> TypeError: 'NoneType' object has no attribute '__getitem__'
>
>
>
> It's very strange how :
>  session.company_data = DbRows
> Gets passed.
>
> However, looking at the postgres logs:
>  2018-12-06 14:18:31.482 CST SessId: 5c0981bd.6e70  TrxId: 0>LOG:
> statement: SELECT "company"."company_name", "company"."company_number" FROM
> "company" WHERE ("company"."company_number" IS NOT NULL) ORDER BY
> "company"."company_name", "company"."company_number";
> < 2018-12-06 14:18:31.488 CST SessId: 5c0981bd.6e70  TrxId: 0>LOG:
> statement: SELECT "company"."company_name" FROM "company" WHERE
> ("company"."company_number" IS NULL);
> < 2018-12-06 14:18:31.505 CST SessId: 5c0981bd.6e70  TrxId: 0>LOG:
> statement: COMMIT
> < 2018-12-06 14:18:35.282 CST SessId: 5c0981bd.6e70  TrxId: 0>LOG:
> statement: BEGIN
> < 2018-12-06 14:18:35.282 CST SessId: 5c0981bd.6e70  TrxId: 0>LOG:
> statement: SELECT 1;
> < 2018-12-06 14:18:35.475 CST SessId: 5c0981bd.6e70  TrxId: 0>LOG:
> statement: SELECT "company"."company_name", "company"."company_number" FROM
> "company" WHERE ("company"."company_number" IS NOT NULL) ORDER BY
> "company"."company_name", "company"."company_number";
> < 2018-12-06 14:18:35.485 CST SessId: 5c0981bd.6e70  TrxId: 0>LOG:
> statement: SELECT "company"."company_name" FROM "company" WHERE
> ("company"."company_number" = 13);
> < 2018-12-06 14:18:35.505 CST SessId: 5c0981bd.6e70  TrxId: 0>LOG:
> statement: COMMIT
>
> It seems to be making 2 passes thru the DB
>
> Allows the  the session variable to be set
> *Ben Duncan*
> DBA / Chief Software Architect
> Mississippi State Supreme Court
> Electronic Filing Division
>
>
> On Thu, Dec 6, 2018 at 1:30 PM Val K  wrote:
>
>> Maybe I don't understand something, but I think that when the controller
>> is requested for the first time there is no any request.vars and
>> request.vars['Company'] too. Just in case: form.process() doesn't interrupt
>> controller execution
>>
>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/boo

Re: [web2py] DAL issues ....

2018-12-06 Thread Ben Duncan
The request.vars get set from the SQL form in the controller
Removed all the COMMENTS, and in the controller put a print and changed the
code:

DbRows =
db(db.company.company_number==Company_ID).select(db.company.company_name).first()
print DbRows['company_name']
session.company_data = DbRows
return dict(form=form,DbRows=DbRows)

And still getting a failure now on the print line ...

Ticket ID

10.13.69.144.2018-12-06.13-53-08.f35db77f-72f8-4749-82e9-90eda4c32141
 'NoneType' object has no attribute
'__getitem__' Version
web2py™ Version 2.17.2-stable+timestamp.2018.10.06.18.54.02
Python Python 2.7.13: /usr/bin/python (prefix: /opt/rh/python27/root/usr)
Traceback

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

Traceback (most recent call last):
  File "/data/web2py/web2py/gluon/restricted.py", line 219, in restricted
exec(ccode, environment)
  File "/data/web2py/web2py/applications/Mec/controllers/default.py"
<https://10.13.70.47/admin/default/edit/Mec/controllers/default.py>,
line 101, in 
  File "/data/web2py/web2py/gluon/globals.py", line 421, in 
self._caller = lambda f: f()
  File "/data/web2py/web2py/applications/Mec/controllers/default.py"
<https://10.13.70.47/admin/default/edit/Mec/controllers/default.py>,
line 87, in company_login
print DbRows['company_name']
TypeError: 'NoneType' object has no attribute '__getitem__'



It's very strange how :
 session.company_data = DbRows
Gets passed.

However, looking at the postgres logs:
 2018-12-06 14:18:31.482 CST SessId: 5c0981bd.6e70  TrxId: 0>LOG:
statement: SELECT "company"."company_name", "company"."company_number" FROM
"company" WHERE ("company"."company_number" IS NOT NULL) ORDER BY
"company"."company_name", "company"."company_number";
< 2018-12-06 14:18:31.488 CST SessId: 5c0981bd.6e70  TrxId: 0>LOG:
statement: SELECT "company"."company_name" FROM "company" WHERE
("company"."company_number" IS NULL);
< 2018-12-06 14:18:31.505 CST SessId: 5c0981bd.6e70  TrxId: 0>LOG:
statement: COMMIT
< 2018-12-06 14:18:35.282 CST SessId: 5c0981bd.6e70  TrxId: 0>LOG:
statement: BEGIN
< 2018-12-06 14:18:35.282 CST SessId: 5c0981bd.6e70  TrxId: 0>LOG:
statement: SELECT 1;
< 2018-12-06 14:18:35.475 CST SessId: 5c0981bd.6e70  TrxId: 0>LOG:
statement: SELECT "company"."company_name", "company"."company_number" FROM
"company" WHERE ("company"."company_number" IS NOT NULL) ORDER BY
"company"."company_name", "company"."company_number";
< 2018-12-06 14:18:35.485 CST SessId: 5c0981bd.6e70  TrxId: 0>LOG:
statement: SELECT "company"."company_name" FROM "company" WHERE
("company"."company_number" = 13);
< 2018-12-06 14:18:35.505 CST SessId: 5c0981bd.6e70  TrxId: 0>LOG:
statement: COMMIT

It seems to be making 2 passes thru the DB

Allows the  the session variable to be set
*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Thu, Dec 6, 2018 at 1:30 PM Val K  wrote:

> Maybe I don't understand something, but I think that when the controller
> is requested for the first time there is no any request.vars and
> request.vars['Company'] too. Just in case: form.process() doesn't interrupt
> controller execution
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [web2py] Re: DAL issues ....

2018-12-06 Thread Ben Duncan
Here is something strange as well - working thru the web2py console,
everything works:

[web2py@su-postgres-ben-3 web2py]$ python ./web2py.py -S Mec -M
web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2018
Version 2.17.2-stable+timestamp.2018.10.06.18.54.02
Database drivers available: psycopg2, pymysql, imaplib, sqlite3, pg8000,
pyodbc
WARNING:web2py:import IPython error; use default python shell
Python 2.7.13 (default, Feb  8 2017, 06:30:30)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-16)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> session.company_id = '5'
>>> Company_ID = session.company_id
>>> print Company_ID
5
>>> DbRows =
db(db.company.company_number==Company_ID).select(db.company.company_name).first()
>>> type(DbRows['company_name'])

>>> DbRows['company_name']
'Number 5 Company'
>>> session.company_data = DbRows
>>> type(DbRows['company_name'])

>>> print session.company_data['company_name']
Number 5 Company
>>>type(DbRows)

>>>





*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Thu, Dec 6, 2018 at 12:22 PM Ben Duncan  wrote:

> Well I was thinking that, BUT:  I'm ALMOST convinced there is a bug in the
> latest web2py:
>
> CODE
> --
> Snippet of controllers/default.py
>
> session.company = request.vars['Company']
> Company_ID = "This is a %s of type %s " % (session.company,
> type(session.company))
> Company_ID = session.company
>
> DbRows =
> db(db.company.company_number==Company_ID).select(db.company.company_name).first()
> # Co_Name = DbRows['company_name']
>
> session.company_data = DbRows
>
> From view/default/company_login.html:
> {{extend 'layout.html'}}
> 
>
>  onclick="location.href='{{=URL('index')}}'"/>
>
> HOME
>
> Input form
> {{=form}}
> Submitted variables
> {{=BEAUTIFY(request.vars)}}
> {{=(request.vars)}}
>
> Company vars: {{=(request.vars['Company'])}}
> Company session: {{=(session.company)}}
> session data: {{=(session.company_data)}}
>
> Will Display The following:
> (top of form omitted ...)
> . Submitted variables
> Company :
> 5
> password :
> makeit1
> username :
> b...@linux4ms.net
>  'makeit1', '_formkey': '65ee8396-aac0-4b5c-a255-00be7e7b01ca', '_formname':
> 'no_table/create'}> Company vars: 5 Company session: 5 session data:  {'company_name': 'Number 5 Company'}>
>
> ___
>
> However, any type of referencing or attempt to do anything with either
> session.company_date or DbRows
> always gives a "Nonetype" error of various subtypes (such as __getitem__)
>
> Uncommenting the controller code  of  "# Co_Name = DbRows['company_name']"
> gives the error:
>
> Ticket ID
>
> 10.13.69.144.2018-12-06.12-17-59.81fd7ae1-6523-47ad-94c7-7b1b480179bd
>  'NoneType' object has no attribute
> '__getitem__' Version
> web2py™ Version 2.17.2-stable+timestamp.2018.10.06.18.54.02
> Python Python 2.7.13: /usr/bin/python (prefix: /opt/rh/python27/root/usr)
> Traceback
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
>
> Traceback (most recent call last):
>   File "/data/web2py/web2py/gluon/restricted.py", line 219, in restricted
> exec(ccode, environment)
>   File "/data/web2py/web2py/applications/Mec/controllers/default.py" 
> <https://10.13.70.47/admin/default/edit/Mec/controllers/default.py>, line 98, 
> in 
>   File "/data/web2py/web2py/gluon/globals.py", line 421, in 
> self._caller = lambda f: f()
>   File "/data/web2py/web2py/applications/Mec/controllers/default.py" 
> <https://10.13.70.47/admin/default/edit/Mec/controllers/default.py>, line 84, 
> in company_login
> Co_Name = DbRows['company_name']
> TypeError: 'NoneType' object has no attribute '__getitem__'
>
>
> As one can see , the Row item exists, it just seems there is no way to get
> to it ...
>
> Any other ideas ?
>
>
> *Ben Duncan*
> DBA / Chief Software Architect
> Mississippi State Supreme Court
> Electronic Filing Division
>
>
> On Thu, Dec 6, 2018 at 9:09 AM Leonel Câmara 
> wrote:
>
>> What's happening here is that DbRows can become None in this line
>>
>>DbRows =
>> db(db.company.company_number==Company_ID).select(db.compa

Re: [web2py] Re: DAL issues ....

2018-12-06 Thread Ben Duncan
Well I was thinking that, BUT:  I'm ALMOST convinced there is a bug in the
latest web2py:

CODE
--
Snippet of controllers/default.py

session.company = request.vars['Company']
Company_ID = "This is a %s of type %s " % (session.company,
type(session.company))
Company_ID = session.company

DbRows =
db(db.company.company_number==Company_ID).select(db.company.company_name).first()
# Co_Name = DbRows['company_name']

session.company_data = DbRows

>From view/default/company_login.html:
{{extend 'layout.html'}}




HOME

Input form
{{=form}}
Submitted variables
{{=BEAUTIFY(request.vars)}}
{{=(request.vars)}}

Company vars: {{=(request.vars['Company'])}}
Company session: {{=(session.company)}}
session data: {{=(session.company_data)}}

Will Display The following:
(top of form omitted ...)
. Submitted variables
Company :
5
password :
makeit1
username :
b...@linux4ms.net
 Company vars: 5 Company session: 5 session data: 
___

However, any type of referencing or attempt to do anything with either
session.company_date or DbRows
always gives a "Nonetype" error of various subtypes (such as __getitem__)

Uncommenting the controller code  of  "# Co_Name = DbRows['company_name']"
gives the error:

Ticket ID

10.13.69.144.2018-12-06.12-17-59.81fd7ae1-6523-47ad-94c7-7b1b480179bd
 'NoneType' object has no attribute
'__getitem__' Version
web2py™ Version 2.17.2-stable+timestamp.2018.10.06.18.54.02
Python Python 2.7.13: /usr/bin/python (prefix: /opt/rh/python27/root/usr)
Traceback

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

Traceback (most recent call last):
  File "/data/web2py/web2py/gluon/restricted.py", line 219, in restricted
exec(ccode, environment)
  File "/data/web2py/web2py/applications/Mec/controllers/default.py"
<https://10.13.70.47/admin/default/edit/Mec/controllers/default.py>,
line 98, in 
  File "/data/web2py/web2py/gluon/globals.py", line 421, in 
self._caller = lambda f: f()
  File "/data/web2py/web2py/applications/Mec/controllers/default.py"
<https://10.13.70.47/admin/default/edit/Mec/controllers/default.py>,
line 84, in company_login
Co_Name = DbRows['company_name']
TypeError: 'NoneType' object has no attribute '__getitem__'


As one can see , the Row item exists, it just seems there is no way to get
to it ...

Any other ideas ?


*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Thu, Dec 6, 2018 at 9:09 AM Leonel Câmara  wrote:

> What's happening here is that DbRows can become None in this line
>
>DbRows =
> db(db.company.company_number==Company_ID).select(db.company.company_name).first()
>
> So when you do DbRows['company_name'] you can get that error.
>
> Basically you need to check if DbRows is None and raise HTTP(404)
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group 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] DAL issues ....

2018-12-06 Thread Ben Duncan
How can something that seems so simple, be so hard?

I can't seem to get a SINGLE field from the database from DAL:

First is the Error Message (Or on of the many types - but the latest one),
then the code

What AM I doing wrong here ?

Als always, thanks ...

Error Message:
Error ticket for "Mec" Ticket ID

10.13.69.144.2018-12-06.07-32-29.8fda8fd6-fe14-47f4-b508-14ce2346465e
 'NoneType' object has no attribute
'__getitem__' Version
web2py™ Version 2.17.2-stable+timestamp.2018.10.06.18.54.02
Python Python 2.7.13: /usr/bin/python (prefix: /opt/rh/python27/root/usr)
Traceback

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

Traceback (most recent call last):
  File "/data/web2py/web2py/gluon/restricted.py", line 219, in restricted
exec(ccode, environment)
  File "/data/web2py/web2py/applications/Mec/controllers/default.py"
<https://10.13.70.47/admin/default/edit/Mec/controllers/default.py>,
line 96, in 
  File "/data/web2py/web2py/gluon/globals.py", line 421, in 
self._caller = lambda f: f()
  File "/data/web2py/web2py/applications/Mec/controllers/default.py"
<https://10.13.70.47/admin/default/edit/Mec/controllers/default.py>,
line 87, in company_login
session.company_name = DbRows['company_name']
TypeError: 'NoneType' object has no attribute '__getitem__'

Error snapshot [image: help]
<https://10.13.70.47/admin/default/ticket/Mec/10.13.69.144.2018-12-06.07-32-29.8fda8fd6-fe14-47f4-b508-14ce2346465e#>

('NoneType' object has no attribute
'__getitem__')
 Code Here
--
 Ok - Code for controller/default.py

def company_login():
company.company_name,orderby=db.company.company_name)form =
SQLFORM.factory(
Field('username', label = 'User Name', requires=IS_NOT_EMPTY()),
Field('password', 'password', label =
"Password",requires=IS_NOT_EMPTY()),
Field('Company', label = 'Court ID',

requires=IS_IN_DB(db,db.company.company_number,'%(company_name)s')),
submit_button=' Login ',
)

  if form.process().accepted:
   response.flash = 'form accepted'
   elif form.errors:
   response.flash = T('form has errors')

   session.company = request.vars['Company']
   Company_ID = request.vars['Company']
   DbRows =
db(db.company.company_number==Company_ID).select(db.company.company_name).first()
session.company_name = DbRows['company_name']

return dict(form=form)





Thanks again ...


*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group 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] Unable to display dropdown lists in forms

2018-12-04 Thread Ben Duncan
Here is a sample I did when I found some OLD web2py forums. I tested with a
dictionary then
with a "in" DB ..
In controller/default.py:

def company_login():
# Read the company file into a dictionary
company =
db(db.company).select(db.company.company_number,db.company.company_name,orderby=db.company.company_name)

# Create a form using the sets
form = SQLFORM.factory(
Field('username', requires=IS_NOT_EMPTY()),
Field('password', 'password', requires=IS_NOT_EMPTY()),
Field('Company',
requires=IS_IN_DB(db,db.company.company_number,'%(company_name)s')))
#Field('Company', requires=IS_IN_SET(company)))

# Note: IS_IN_SET is fugly, anyone know a way to "format" it for display?

if form.process().accepted:
#   redirect(URL('index'))
   response.flash = 'form accepted'
elif form.errors:
   response.flash = T('form has errors')

return dict(form=form)

In views/default/company_login.html :

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


-
Ok, my NEXT questions along this thread:
I need to display the values returned from the sqlform, any ideas on this ?

thanks ..

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Tue, Dec 4, 2018 at 9:08 AM sandeep patel 
wrote:

> @Arindam: Try the following code instead
>
> def test():
> form = FORM(LABEL("File(s):"), INPUT(_name='pic_upload', _type='file',
> _multiple=''),
>   BR(), LABEL("Comments:"), INPUT(_name='comments'),
>   BR(), LABEL("Print Size:"), INPUT(_name='print_size'),
>   BR(), LABEL("copies:"), INPUT(_name='copies'))
> form.append(XML(' id="names">'))
> form.append(XML('submit'))
>
> return locals()
>
> Hope this works for you
>
> Thanks
> SP
>
> On Tue, Dec 4, 2018 at 8:02 PM Lovedie JC  wrote:
>
>> I have done something like that. Let me retrieve it in 3hrs
>>
>> On 4 Dec 2018 5:17 PM, "Ben Duncan"  wrote:
>>
>> I was working on trying to figure out the EXACT same thing !
>>
>> Thanks ..
>>
>> *Ben Duncan*
>> DBA / Chief Software Architect
>> Mississippi State Supreme Court
>> Electronic Filing Division
>>
>>
>> On Tue, Dec 4, 2018 at 6:40 AM Arindam Dasgupta 
>> wrote:
>>
>>> Hi,
>>> I need to display a drop down list in my form but have no idea how to do
>>> it. I have the following arrangements :
>>>
>>> Model :
>>>
>>> db.define_table('orders',
>>>
>>> Field('comments' ,type='string'),
>>> Field('print_size',requires=IS_IN_SET(['5x3.5', '6x4',
>>> '6x4.5', '5x7', '5x7.5', '6x8', '6x9', '12x8', '12x10',
>>>  '12x12', '12x15', '12x18', '12x24', '12x30',
>>> '12x36']),default='6x4'),
>>>
>>> Field('paper_type',requires=IS_IN_SET(['Matte','Glossy']),default='Matte'),
>>> Field('copies',requires=IS_IN_SET(mylist),default=1),
>>> Field('cart',type='boolean' ,default='False'),
>>> Field('checkout',type='boolean' ,default='False'),
>>> Field('pic_upload' ,'upload',autodelete=True),
>>> Field('order_id' , type='integer',default= 0),
>>> Field('price' , type='float' , default=1),
>>> Field('unit_price' , type='float' , default=1),
>>> Field('order_status' ,
>>> requires=IS_IN_SET(['Delivered','Not Delivered']) , default='Not
>>> Delivered'),
>>>
>>> auth.signature
>>> )
>>>
>>> Controller :
>>>
>>> def multiple_upload():
>>>   import datetime
>>>
>>>   form = FORM(LABEL("File(s):"), INPUT(_name='pic_upload', _type='file',
>>> _multiple=''),
>>>   BR(), LABEL("Comments:"), INPUT(_name='comments'),
>>>   BR(), LABEL("Print Size:"), INPUT(_name='print_size'),
>>>   BR(), LABEL("Paper Type:"),INPUT(_name='paper_type'
>>> ,requires=IS_IN_SET(['Matte','Glossy']) ),
>>>   BR(), LABEL("copies:"), INPUT(_name='copies'),
>>>   BR(),INPUT(_type='submit'))
>>>
>>> return dict(form=form)
>>>
>>>
>>> View:
>>>
>>> {{extend 'layout.html'}}
>>> This is the default/multiple_upload.html template
>>> {{=form}}
>>>
>>> In the paper t

Re: [web2py] Unable to display dropdown lists in forms

2018-12-04 Thread Ben Duncan
I was working on trying to figure out the EXACT same thing !

Thanks ..

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Tue, Dec 4, 2018 at 6:40 AM Arindam Dasgupta 
wrote:

> Hi,
> I need to display a drop down list in my form but have no idea how to do
> it. I have the following arrangements :
>
> Model :
>
> db.define_table('orders',
>
> Field('comments' ,type='string'),
> Field('print_size',requires=IS_IN_SET(['5x3.5', '6x4',
> '6x4.5', '5x7', '5x7.5', '6x8', '6x9', '12x8', '12x10',
>'12x12', '12x15', '12x18', '12x24', '12x30',
> '12x36']),default='6x4'),
>
> Field('paper_type',requires=IS_IN_SET(['Matte','Glossy']),default='Matte'),
> Field('copies',requires=IS_IN_SET(mylist),default=1),
> Field('cart',type='boolean' ,default='False'),
> Field('checkout',type='boolean' ,default='False'),
> Field('pic_upload' ,'upload',autodelete=True),
> Field('order_id' , type='integer',default= 0),
> Field('price' , type='float' , default=1),
> Field('unit_price' , type='float' , default=1),
> Field('order_status' ,
> requires=IS_IN_SET(['Delivered','Not Delivered']) , default='Not
> Delivered'),
>
> auth.signature
> )
>
> Controller :
>
> def multiple_upload():
>   import datetime
>
>   form = FORM(LABEL("File(s):"), INPUT(_name='pic_upload', _type='file',
> _multiple=''),
>   BR(), LABEL("Comments:"), INPUT(_name='comments'),
>   BR(), LABEL("Print Size:"), INPUT(_name='print_size'),
>   BR(), LABEL("Paper Type:"),INPUT(_name='paper_type'
> ,requires=IS_IN_SET(['Matte','Glossy']) ),
>   BR(), LABEL("copies:"), INPUT(_name='copies'),
>   BR(),INPUT(_type='submit'))
>
> return dict(form=form)
>
>
> View:
>
> {{extend 'layout.html'}}
> This is the default/multiple_upload.html template
> {{=form}}
>
> In the paper type field I need to display a drop down with values ('Matte'
> , 'Glossy').
> Can you please show me how to do that.I dont want to use SQL form or
> SQLFORM.FACTORY .
> Thanks in advance for your kind suggestions.
>
> Best Regards,
> Arindam
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [web2py] Re: Migrations

2018-11-27 Thread Ben Duncan
LOL - Understand, can throw down C with the Best of them, write
applications (myriad of programming languages)  and setup Databases and
design them in  my sleep,
but this is my first in a career that spans over 30 years, of having to do
some SERIOUS web programming.

Beginning to feel like a Newbie ..

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Tue, Nov 27, 2018 at 1:02 PM Dave S  wrote:

>
>
> On Monday, November 26, 2018 at 4:42:10 AM UTC-8, Ben Duncan wrote:
>>
>> Thanks Dave !!!
>>
>> That makes sense.
>>
>> I tried a few tables with "fake migration" (for grins and giggles) turned
>> on and the code that generates the database/ stuff choked and puked all over
>> the "foreign keys".
>>
>
> It might be of interest (says the firmware geek with 1 semester DB creds)
> to have a minimal example that illustrates the problem, but of course that
> would have to fit within the project schedule, as well.
>
>
>>
>> I went back and left it as is, with everything expected as a "external"
>> table, whcih is just as well, since I will have to dove tail this with
>> a e-filing systems at some point.
>>
>> Thanks again ...
>>
>> *Ben Duncan*
>> DBA / Chief Software Architect
>> Mississippi State Supreme Court
>> Electronic Filing Division
>>
>
> Happy to help ... this group has been good to me, and sometimes I can pay
> it forward.
>
> /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.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group 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: Hierarchy (BOM) using closure table with triggers in DAL?

2018-11-26 Thread Ben Duncan
What database are you using ?

In our e-file system, we have something similar with  court cases, but we
use db functions to do the heavy lifting
for use, since in postgres they can be called with a select directly ...


*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Sat, Nov 24, 2018 at 10:31 AM Val K  wrote:

>
> running example:
>
> # fake table in which result of recursive select will be temporary stored
> # id-values will be inherited from parent_child table
> db.define_table('entry_collector',
> Field('child', 'integer'),
> Field('xpath', 'json'), # array of ids,  xpath[0] == root,
> xpath[-1] == child
> Field('root', 'integer'),
> Field('xdepth', 'integer'),
> migrate_enabled = False,
> fake_migrate = True
> )
>
>
> def with_recursive(parent, child, roots_select, q, *fields,
> **select_kwargs):
> """
> parent, child  - fields obj ( like  db.parent_child.parent,
> db.parent_child.child )
> roots_select - sql string (like 'select 123 as id' or
> db(db.person.id.belongs([11,22,33])._select(db.person.id))
> q, fields, select_kwargs  - args that will pass to dal:
> db(q).select(*fields, **select_kwargs)
> select_kwargs may include 'entry_collector' - name of fake table for
> recursive (default is 'entry_collector')
> returns a regular rows dal object (nothing new)
> """
>
> entry_collector = select_kwargs.pop('entry_collector',
> 'entry_collector')
> args = Storage(
> entry = parent.table._tablename,
> parent = parent.name,
> child  = child.name,
> entry_collector = entry_collector,
> roots = roots_select
> )
>
> rec_sql_s = \
> """
> WITH RECURSIVE
> %(entry_collector)s(id, child, xpath, root, xdepth) AS
> (SELECT NULL, id, "[" || id || "]", id, 0 FROM (%(roots)s)
>  UNION
>  SELECT  %(entry)s.id,
>  %(entry)s.%(child)s,
>  rtrim(xpath,"]") || "," || %(entry)s.%(child)s || "]",
>  %(entry_collector)s.root,
>  %(entry_collector)s.xdepth + 1
>  FROM %(entry_collector)s
>  JOIN %(entry)s ON
>  NOT instr(%(entry_collector)s.xpath,
>  %(entry)s.%(parent)s || "," )
>  AND %(entry)s.%(parent)s = %(entry_collector)s.child
>  ORDER BY 5 DESC /* means BY xdepth  */
>
> )
> """ % args
>
> q = db(q)
> dal_select = q._db._adapter._select_aux
> def patch_select(*args, **kwargs):
> if args:
> is_recursive = False
> for fld in args[1]:
> if  fld.table._tablename == 'entry_collector':
> is_recursive = True
> break
> if is_recursive:
> args = list(args)
> args[0] = rec_sql_s + args[0]
> print 'with rec: ', args[0]
> return dal_select(*args, **kwargs)
>
> q._db._adapter._select_aux = patch_select
> try:
> ret = q.select(*(fields + (db[entry_collector].id,)),
>  **select_kwargs)
> finally:
> q._db._adapter._select_aux = dal_select
>return ret
>
>
>
>
> On Thursday, November 22, 2018 at 2:41:23 AM UTC+3, BigBaaadBob wrote:
>>
>> The use case is manufacturing. Large complicated manufacturing with
>> special requirements. And SAP need not apply... :-)
>>
>> On Wednesday, November 21, 2018 at 1:26:56 PM UTC-8, Dave S wrote:
>>>
>>>
>>>
>>> On Wednesday, November 21, 2018 at 10:33:13 AM UTC-8, BigBaaadBob wrote:
>>>>
>>>> I'm just trying to find a good solid way of doing the BOM pattern using
>>>> the DAL, and pretty much all of the decent articles I've found say the
>>>> Closure Table method is the best trade-off, especially for large-ish and
>>>> deep-ish BOM structures.
>>>>
>>>
>>> It would be interesting to hear your use case.  Are you into a
>>> scheduling problem like the airport/flight example?  Or an organizational
>>> example where you need to quickly find the director in the hierarchy above
>>> one us grunts?
>>>
>>>
>>>> But, I'm not dogmatic. How would you code up a version using "with
>>>> recursive" queries using the DAL? If you post a running example it would be
>

Re: [web2py] Re: Migrations

2018-11-26 Thread Ben Duncan
Thanks Dave !!!

That makes sense.

I tried a few tables with "fake migration" (for grins and giggles) turned
on and the code that generates the database/ stuff choked and puked all over
the "foreign keys".

I went back and left it as is, with everything expected as a "external"
table, whcih is just as well, since I will have to dove tail this with
a e-filing systems at some point.

Thanks again ...

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Wed, Nov 21, 2018 at 3:35 PM Dave S  wrote:

>
>
> On Wednesday, November 21, 2018 at 5:32:29 AM UTC-8, Ben Duncan wrote:
>>
>> Ok, I turned migration on for tables, and it gave errors because of
>> foreign keyes.
>> Everything looks exactly like the docs spell out.
>>
>> I'm not sure I see the reasoning for the stuff in directory 'database'.
>>
>
> It's the DAL's representation of the schema, with hints on how to
> translate it for the flavor of DB backend in use (through a driver, like
> pgsql).  If the table changes (in models/mytables.py), the migrate steps
> update the database/*.table files and generate the appropriate SQL
> instructions to get the backend to match.  Fake migrate skips the generate,
> and is used when the changes already are in place on the backend.
>
>
>>
>> I'm going ahead putting back migration=False on all the tables, since It
>> works that way and these
>> are external tables.
>>
>> Anyone see any problems with that ?
>>
>>
> Productiion should normally have migration=False.  When it is needed, it
> only needs to be True for one access (barring errors).
>
>
>
>> Thanks ...
>>
>> *Ben Duncan*
>> DBA / Chief Software Architect
>> Mississippi State Supreme Court
>> Electronic Filing Division
>>
>>
>
> /dps
>
>
>>
>> On Wed, Nov 21, 2018 at 6:57 AM Ben Duncan  wrote:
>>
>>> I tried enable fake migrations (Backend has tables), nothing was created
>>> in databases, but everything works as it should ..
>>> *Ben Duncan*
>>> DBA / Chief Software Architect
>>> Mississippi State Supreme Court
>>> Electronic Filing Division
>>>
>>>
>>> On Tue, Nov 20, 2018 at 4:20 PM Dave S  wrote:
>>>
>>>>
>>>>
>>>> On Tuesday, November 20, 2018 at 8:30:29 AM UTC-8, Ben Duncan wrote:
>>>>>
>>>>> Is it necessary to enable or even do migrations in the DAL (creating
>>>>> database/ entries) if the database and the tables are already preexisting 
>>>>> ?
>>>>>
>>>>> Thanks ...
>>>>>
>>>>> *Ben Duncan*
>>>>> DBA / Chief Software Architect
>>>>> Mississippi State Supreme Court
>>>>> Electronic Filing Division
>>>>>
>>>>
>>>>
>>>> Let's see if I get it right:
>>>>
>>>> new table design: enable migrations
>>>> new field in existing design: enable migrations
>>>> new definition, backend has table:enable fake_migrations
>>>>
>>>> /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+un...@googlegroups.com.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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

2018-11-21 Thread Ben Duncan
Ok, I turned migration on for tables, and it gave errors because of foreign
keyes.
Everything looks exactly like the docs spell out.

I'm not sure I see the reasoning for the stuff in directory 'database'.

I'm going ahead putting back migration=False on all the tables, since It
works that way and these
are external tables.

Anyone see any problems with that ?

Thanks ...

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Wed, Nov 21, 2018 at 6:57 AM Ben Duncan  wrote:

> I tried enable fake migrations (Backend has tables), nothing was created
> in databases, but everything works as it should ..
> *Ben Duncan*
> DBA / Chief Software Architect
> Mississippi State Supreme Court
> Electronic Filing Division
>
>
> On Tue, Nov 20, 2018 at 4:20 PM Dave S  wrote:
>
>>
>>
>> On Tuesday, November 20, 2018 at 8:30:29 AM UTC-8, Ben Duncan wrote:
>>>
>>> Is it necessary to enable or even do migrations in the DAL (creating
>>> database/ entries) if the database and the tables are already preexisting ?
>>>
>>> Thanks ...
>>>
>>> *Ben Duncan*
>>> DBA / Chief Software Architect
>>> Mississippi State Supreme Court
>>> Electronic Filing Division
>>>
>>
>>
>> Let's see if I get it right:
>>
>> new table design: enable migrations
>> new field in existing design: enable migrations
>> new definition, backend has table:enable fake_migrations
>>
>> /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.
>>
>

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

2018-11-21 Thread Ben Duncan
I tried enable fake migrations (Backend has tables), nothing was created in
databases, but everything works as it should ..
*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Tue, Nov 20, 2018 at 4:20 PM Dave S  wrote:

>
>
> On Tuesday, November 20, 2018 at 8:30:29 AM UTC-8, Ben Duncan wrote:
>>
>> Is it necessary to enable or even do migrations in the DAL (creating
>> database/ entries) if the database and the tables are already preexisting ?
>>
>> Thanks ...
>>
>> *Ben Duncan*
>> DBA / Chief Software Architect
>> Mississippi State Supreme Court
>> Electronic Filing Division
>>
>
>
> Let's see if I get it right:
>
> new table design: enable migrations
> new field in existing design: enable migrations
> new definition, backend has table:enable fake_migrations
>
> /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.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group 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] Migrations

2018-11-20 Thread Ben Duncan
Is it necessary to enable or even do migrations in the DAL (creating
database/ entries) if the database and the tables are already preexisting ?

Thanks ...

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group 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: Issue with pydal - default

2018-11-10 Thread Ben Duncan
Ok, great thanks ...

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Fri, Nov 9, 2018 at 2:19 PM Dave S  wrote:

>
>
> On Friday, November 9, 2018 at 5:31:18 AM UTC-8, Ben Duncan wrote:
>>
>> Ok, I'm checking my DAL layouts with s simply pydal test program and I've
>> run into this:
>>
>> [postgres@su-postgres-ben-3 mec_layouts]$ ./pydaltest2.py
>> Traceback (most recent call last):
>>   File "./pydaltest2.py", line 289, in 
>> Field('created_datetime', type='datetime', default=request.now),
>> NameError: name 'request' is not defined
>>
>
>
> The variable request  is a web2py global, but when you're running pydal
> standalone you don't have the web2py globals.
>
> You might try
>
> import datetime
> if "request" not in globals():
>request["now"] = datetime.datetime.now()
>
>
> before your table defines.  (Or, if you always be running standalone, just
> change the default.)
>
>
> /dps
>
> The top of my program looks like :
>>
>> import os, sys, string, copy, time
>> import getopt
>> from types import *
>>
>>
>> from pydal import DAL , Field
>> db = DAL("postgres://postgres:postgres@localhost:7103/ac03303_live",
>> pool_size=10, migrate_enabled=False, fake_migrate_all=True )
>>
>> db.define_table ...
>> db.define_table ... (etc)
>> db.define_table('cookie_s',
>> Field('company_number', type='reference company', ondelete='CASCADE'),
>> Field('prid', type='integer'),
>> Field('value', type='string', length=255),
>> Field('java_ready', type='boolean'),
>> Field('content', type='string', length=255),
>> Field('created_datetime', type='datetime', default=request.now),
>> Field('expire', type='datetime'),
>> Field('machine_id', type='string', length=255),
>> Field('browser_session', type='integer'),
>> Field('server_session', type='integer'),
>> primarykey=['company_number','prid'],
>> migrate=False)
>>
>> It's blowing up on the
>> Field('created_datetime', type='datetime', default=request.now),
>>
>> What Am I doing wrong ?
>>
>> Thanks ..
>>
>>
>>
>> *Ben Duncan*
>> DBA / Chief Software Architect
>> Mississippi State Supreme Court
>> Electronic Filing Division
>>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group 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] Issue with pydal - default

2018-11-09 Thread Ben Duncan
Ok, I'm checking my DAL layouts with s simply pydal test program and I've
run into this:

[postgres@su-postgres-ben-3 mec_layouts]$ ./pydaltest2.py
Traceback (most recent call last):
  File "./pydaltest2.py", line 289, in 
Field('created_datetime', type='datetime', default=request.now),
NameError: name 'request' is not defined

The top of my program looks like :

import os, sys, string, copy, time
import getopt
from types import *


from pydal import DAL , Field
db = DAL("postgres://postgres:postgres@localhost:7103/ac03303_live",
pool_size=10, migrate_enabled=False, fake_migrate_all=True )

db.define_table ...
db.define_table ... (etc)
db.define_table('cookie_s',
Field('company_number', type='reference company', ondelete='CASCADE'),
Field('prid', type='integer'),
Field('value', type='string', length=255),
Field('java_ready', type='boolean'),
Field('content', type='string', length=255),
Field('created_datetime', type='datetime', default=request.now),
Field('expire', type='datetime'),
Field('machine_id', type='string', length=255),
Field('browser_session', type='integer'),
Field('server_session', type='integer'),
primarykey=['company_number','prid'],
migrate=False)

It's blowing up on the
Field('created_datetime', type='datetime', default=request.now),

What Am I doing wrong ?

Thanks ..



*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division

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


  1   2   >