Re: [web2py] web2py 2.19.1 is OUT

2020-03-24 Thread 'jim kaubisch' via web2py-users
Hi Nico,

Just want to make sure I understand.

You say 'web2py 2.19.1 binaries come "with embedded Python 2.7.16 or 3.7.4" 
' ??
My reading is that one MUST get web2py source in order to use other 
versions of Python? Am I understanding correctly?

We are on macOS Catalina, python 3.7.6 and, given that python 3.8.2 claims 
better integration with Catalina and python.org saying "We plan to continue 
to provide bugfix releases for 3.7.x until mid 2020...", going back to 
3.7.4 doesn't appeal.

Thanks
Jim


On Sunday, March 22, 2020 at 4:01:40 PM UTC-7, Nico Zanferrari wrote:
>
> Hello,
>
> the 2.19.1 web2py binaries are ready to be tested & used, with embedded 
> Python 2.7.16 or 3.7.4. Grab them from my repository 
>  .
> It has taken me a lot of time for updating to the latest PyInstaller 3.6 
> and find a new missing import ;-)
>
> @Massimo: please update the Legacy and Normal binaries on 
> http://www.web2py.com/init/default/download accordingly.
>
> Cheers,
> Nico
>
>
> Il giorno dom 22 mar 2020 alle ore 03:50 Lovedie JC  > ha scritto:
>
>> I've updated it.
>> Flawless 
>> 
>> Good work. Much appreciated. 
>> Regards 
>>
>> On Sun, Mar 22, 2020, 04:28 Christian Varas > > wrote:
>>
>>> Thanks! 
>>>
>>> El El sáb, 21 de mar. de 2020 a la(s) 18:52, Massimo Di Pierro <
>>> massimo...@gmail.com > escribió:
>>>
 Sorry it took so long.

 Web2py 2.19.1 is finally out.

 It contains many small bug fixes including better support for python 
 3.6, 3.7, and 3.8

 https://travis-ci.org/github/web2py/web2py

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

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

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/1cd0493c-b16c-4f7b-932b-48a3336581d4%40googlegroups.com.


[web2py] Re: web2py broken with Python 3.8

2020-03-13 Thread 'jim kaubisch' via web2py-users
Hi Villas,

Then I'm confused... 

I've got 15k+ lines of reasonably complex web2py based Python 3.7.6 code. 
I'm thinking ahead to when it would be wise/necessary to migrate to 3.8

Massimo said "Both web2py and py4web are currently incompatible with python 
3.8" (beginning of December) and later said "Works for me right now." 
(middle of January). 
He explained the reasons for the problems and I interpreted his second note 
as implying he fixed things.

My question is - if there were code changes to accommodate the 3.8 
incompatibilities, how does one access them given that the official version 
of web2py hasn't changed in nearly a year ?
Was also hoping that Woody would respond to say if he tried it, as he 
planned to, and what the outcome was

Am I misunderstanding something?

Thanks


On Thursday, March 12, 2020 at 11:19:57 AM UTC-7, villas wrote:
>
> web2py itself is designed to work on both versions of python.
>
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the 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/ac57c0a7-60e9-4e9c-bb17-77aa3b8d4ce2%40googlegroups.com.


[web2py] Re: web2py broken with Python 3.8

2020-03-12 Thread 'jim kaubisch' via web2py-users
Hi,

How does one access the changes made in web2py to use Python 3.8? when I 
fire it up it tells me its up-to-date with 
2.18.5-stable+timestamp.2019.04.08.04.22.03

I presume that version doesn't have the changes ??

Thanks

On Friday, March 6, 2020 at 2:26:10 PM UTC-8, jim kaubisch wrote:
>
> What was the result of 3.8 for you when you tried it? 
>
> On Wednesday, January 15, 2020 at 9:36:55 AM UTC-8, Woody wrote:
>>
>> Good news! I'll give it a try.
>>
>> On Friday, December 6, 2019 at 10:56:48 AM UTC-5, Woody wrote:
>>>
>>> web2py is broken with Python 3.8. I asked a question about this a few 
>>> days ago and was told that it would be fixed. Looking at the open issues 
>>> for w2p, I don't see open issues related to fixing these incompatibilities. 
>>> I would be interested in some discussion about specifically what the 
>>> incompatibilities are, which open issues are addressing these problems and 
>>> the time frame to fix. What's the scale of these problems? Is it possible 
>>> to manually patch the problems?
>>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the 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/0eab61e1-6cce-46b6-bb8d-d25844247d3f%40googlegroups.com.


[web2py] Re: web2py broken with Python 3.8

2020-03-06 Thread 'jim kaubisch' via web2py-users
What was the result of 3.8 for you when you tried it? 

On Wednesday, January 15, 2020 at 9:36:55 AM UTC-8, Woody wrote:
>
> Good news! I'll give it a try.
>
> On Friday, December 6, 2019 at 10:56:48 AM UTC-5, Woody wrote:
>>
>> web2py is broken with Python 3.8. I asked a question about this a few 
>> days ago and was told that it would be fixed. Looking at the open issues 
>> for w2p, I don't see open issues related to fixing these incompatibilities. 
>> I would be interested in some discussion about specifically what the 
>> incompatibilities are, which open issues are addressing these problems and 
>> the time frame to fix. What's the scale of these problems? Is it possible 
>> to manually patch the problems?
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the 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/ba69-c27c-42ae-b53d-2cf8648e3e44%40googlegroups.com.


[web2py] File chooser dialog

2020-02-04 Thread 'jim kaubisch' via web2py-users
I need to upload videos to YouTube. I do NOT want to also upload those 
files to the web2py uploads mechanism
If I use a "normal" upload field I get a dialog to choose a file . How do I 
access that dialog for a non-upload field in SQLFORM.factory

I've looked but don't see how. 

Thanks

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/03f5dad8-1ce3-4d76-8d0b-8b4624611a4e%40googlegroups.com.


[web2py] Kaspersky Internet Security says http://www.web2pyslices.com/home?content<...> is a phishing site.

2020-02-04 Thread 'jim kaubisch' via web2py-users
I'm surprised. Does this make sense to anyone else?

*It goes on to say ...*


*Blocked by Web Anti-Virus*

Reason: phishing link
Detection method: databases

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the 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/bc342cf7-2fff-4f6f-871f-7dbfc1e25d9d%40googlegroups.com.


[web2py] MYSQL 8 / web2py compatibility

2019-12-22 Thread 'jim kaubisch' via web2py-users
Hi,

Just in the process of migrating my web2py apps from macos 10.14 (Mojave) 
to 10.15 (Catalina). 
Most things seem to be going fine but migrating mysql isn't. 
Have been using v5.7 for years successfully with multiple versions of macos 
and web2py but now seem stuck

I've looked through mysql related questions on this group and the online 
book but see no statement that mysql v8 IS compatible with the current 
version of web2py. Please, what is the situation???

As a corollary, do any of you know the state of mysql support  (5.7 or 8) 
for Catalina? The mysql site is silent on the topic. 

This is an unexpected stumbling block 

Thanks for your help !!

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


[web2py] Bug? uploaded file is deleted by delete_record() even if record versioning enabled

2019-10-19 Thread 'jim kaubisch' via web2py-users
As expected, when RECORD VERSIONING is enabled, a db record deletion causes 
the RECORD to be archived with all the record contents maintained rather 
than being deleted. 
And if the record is reactivated, all the record contents are restored 

However, if the record has an upload field and autodelete=True  is 
specified, the ACTUAL FILE is deleted. 

In my opinion this produces an inconsistent result. The archived db record 
retains the path - but now to a non-existent file.
if delete() and record_delete() don't mean truly delete, then the 
autodelete shouldn't either

with autodelete
Field('the_file', 'upload' , label=T('Audio File')
 , writable=True
 , autodelete=True
 , default=None
 , 
uploadfolder=os.path.join(request.folder,'uploads/resources/audio')
),

and the result of a record delete is...

archive_x2m: archive base_table record = audios[10]

archive_x2m: uploaded audio file path = 
/Applications/web2py_dev/applications/MFMCurrAssetMgr/uploads/resources/audio/audios.the_file.b96db9904e30d353.6131343035323731312e6d7033.mp3

archive_x2m: Does uploaded file exists BEFORE delete_record(), i.e. 
os.path.exists(full_path)? -  True

archive_x2m:   >> execute "db(db.audios.id == record_id).delete()"

archive_x2m: Does uploaded file exist AFTER delete_record(), i.e. 
os.path.exists(full_path)? -  False

archive_x2m: Done !




the following without autodelete...
Field('the_file', 'upload' , label=T('Audio File')
 , writable=True
 , default=None
 , 
uploadfolder=os.path.join(request.folder,'uploads/resources/audio')

),


and the result

archive_x2m: archive base_table record = audios[30]

archive_x2m: uploaded audio file path = 
/Applications/web2py_dev/applications/MFMCurrAssetMgr/uploads/resources/audio/audios.the_file.bd416488d5bffdf5.6131343035323733322e6d7033.mp3

archive_x2m: Does uploaded file exists BEFORE delete_record(), i.e. 
os.path.exists(full_path)? -  True

archive_x2m:   >> execute "db(db.audios.id == record_id).delete()"

archive_x2m: Does uploaded file exist AFTER delete_record(), i.e. 
os.path.exists(full_path)? -  True

archive_x2m: Done !



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


[web2py] Re: I want to delete the file created as a result of an upload field.

2019-10-18 Thread 'jim kaubisch' via web2py-users
Thanks, Dave. Your suggestion made the answer click for me. Embarrassingly, 
for some reason I got it in my head that both the upload directory and the 
upload file name were located in the db record for a given item :-(  Once 
it clicked that the directory comes from the schema and only the filename 
comes from the db record it all worked of course.

On Tuesday, October 8, 2019 at 11:30:59 AM UTC-7, jim kaubisch wrote:
>
>
> In several forms I have fields like to one below
>
> Field('the_file', 'upload' , label=T('Audio File *'), 
>  default = False,
> 
>  uploadfolder=os.path.join(request.folder,'uploads/resources/audio')
>  ),
>
>
> When I delete the db record containing the result of processing the field 
> above, I also want to delete the actual uploaded file.
>
> If I "print"  db.audios.the_file I get a sensible file name, e.g. 
> "audios.the_file.87f39e4b2eac56a2.7331343035323830332e706466.mp3"
> but -  if I pass db.audios.the_file to os.path.join, I get an exception - 
> "EXCEPTION 
> = join() argument must be str or bytes, not 'Field'"
> and  - if I pass str(db.audios.the_file) to os.path.join I end up with 
> something ending in 'uploads/resources/audio/the_file'
>
> Simple question. How do I get the name of the uploaded file in a form I 
> can use in os.path.join
>
> Thanks
>

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


[web2py] Re: I want to delete the file created as a result of an upload field.

2019-10-11 Thread 'jim kaubisch' via web2py-users
Thanks Dave,
below is a version of the code as is, inches a variant of what you 
suggested I think...

# 
---
@auth.requires(auth.has_membership(role='super'))
def del_op_audios():
try:
# Before we delete the db references, find the uploaded file 
name/path
#
upload_path_name = db.audios.the_file.uploadfolder

#try to get the name of the uploaded file (not original file)
#  - what does this need to be???
#   print db.audios.the_file and you get a sensible filename, e.g. 
"audios.the_file.87f39e4b2eac56a2.7331343035323830332e706466.mp3"
#   but I don't seem to be able to get that name as a string to 
pass to os.path.join
upload_file_name = db.audios.the_file.??? or ??

print(f'upload_file = "{upload_file_name}"')
print(f'upload_path = "{upload_path_name}"')

# since we've got record_versioning turned on, we can't truly 
delete the record
#   with a "del db.audios[request.vars.record_id]"
# so go directly to db and delete the record
#   - Relying on the SQL CASCADE being enabled
#
db.executesql(f'DELETE FROM audios WHERE 
id={request.vars.record_id};')

# Commit the changes
db.commit()

# Now that the record is gone, delete the associated uploaded file
# something like this ...
#
os.remove(os.path.join(request.folder, upload_path_name, 
upload_file_name)) 

session.op_result = 'Success - DELETE successful'
except Exception as why:
session.op_result = f'Failed - {why}'

redirect(URL('default', 'list_all_rows'))


What am I missing?


On Tuesday, October 8, 2019 at 11:30:59 AM UTC-7, jim kaubisch wrote:
>
>
> In several forms I have fields like to one below
>
> Field('the_file', 'upload' , label=T('Audio File *'), 
>  default = False,
> 
>  uploadfolder=os.path.join(request.folder,'uploads/resources/audio')
>  ),
>
>
> When I delete the db record containing the result of processing the field 
> above, I also want to delete the actual uploaded file.
>
> If I "print"  db.audios.the_file I get a sensible file name, e.g. 
> "audios.the_file.87f39e4b2eac56a2.7331343035323830332e706466.mp3"
> but -  if I pass db.audios.the_file to os.path.join, I get an exception - 
> "EXCEPTION 
> = join() argument must be str or bytes, not 'Field'"
> and  - if I pass str(db.audios.the_file) to os.path.join I end up with 
> something ending in 'uploads/resources/audio/the_file'
>
> Simple question. How do I get the name of the uploaded file in a form I 
> can use in os.path.join
>
> Thanks
>

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


[web2py] Re: I want to delete the file created as a result of an upload field.

2019-10-09 Thread 'jim kaubisch' via web2py-users


On Tuesday, October 8, 2019 at 11:30:59 AM UTC-7, jim kaubisch wrote:
>
>
> In several forms I have fields like to one below
>
> Field('the_file', 'upload' , label=T('Audio File *'), 
>  default = False,
> 
>  uploadfolder=os.path.join(request.folder,'uploads/resources/audio')
>  ),
>
>
> When I delete the db record containing the result of processing the field 
> above, I also want to delete the actual uploaded file.
>
> If I "print"  db.audios.the_file I get a sensible file name, e.g. 
> "audios.the_file.87f39e4b2eac56a2.7331343035323830332e706466.mp3"
> but -  if I pass db.audios.the_file to os.path.join, I get an exception - 
> "EXCEPTION 
> = join() argument must be str or bytes, not 'Field'"
> and  - if I pass str(db.audios.the_file) to os.path.join I end up with 
> something ending in 'uploads/resources/audio/the_file'
>
> Simple question. How do I get the name of the uploaded file in a form I 
> can use in os.path.join
>
> Thanks
>


turns out, I don't think auto delete works for me.

I'm using "record_versioning", hence record delete doesn't actually delete 
the record and, as far as I can tell, there is no "I really mean delete not 
archive" option.
As far as I can tell, my only option (which I'm using) is to go directly to 
the db and delete the record there (DELETE xxx FROM yyy WHERE id=zzz). 
That indeed deletes the record and cascades, but bypasses the web2py "auto 
delete". After the deletion the uploaded files remain:-(

Seems that without being able to get to the filename of the uploaded file 
there's no way to delete it, and if you delete the db record you've lost 
the only reference to the file so its now an orphan

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the 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/03b362cd-0b59-42d8-a9e7-83962181c5c5%40googlegroups.com.


[web2py] Re: I want to delete the file created as a result of an upload field.

2019-10-08 Thread 'jim kaubisch' via web2py-users


On Tuesday, October 8, 2019 at 11:30:59 AM UTC-7, jim kaubisch wrote:
>
>
> In several forms I have fields like to one below
>
> Field('the_file', 'upload' , label=T('Audio File *'), 
>  default = False,
> 
>  uploadfolder=os.path.join(request.folder,'uploads/resources/audio')
>  ),
>
>
> When I delete the db record containing the result of processing the field 
> above, I also want to delete the actual uploaded file.
>
> If I "print"  db.audios.the_file I get a sensible file name, e.g. 
> "audios.the_file.87f39e4b2eac56a2.7331343035323830332e706466.mp3"
> but -  if I pass db.audios.the_file to os.path.join, I get an exception - 
> "EXCEPTION 
> = join() argument must be str or bytes, not 'Field'"
> and  - if I pass str(db.audios.the_file) to os.path.join I end up with 
> something ending in 'uploads/resources/audio/the_file'
>
> Simple question. How do I get the name of the uploaded file in a form I 
> can use in os.path.join
>
> Thanks
>

Just stumbled on the "autodelete" attribute in field definitions - which 
serves my needs at the moment, but would still be useful to know how to get 
at the filename for cases when you don't want auto delete

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the 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/d1c4778a-5224-4c92-9d22-0ecebe32aea3%40googlegroups.com.


[web2py] I want to delete the file created as a result of an upload field.

2019-10-08 Thread 'jim kaubisch' via web2py-users

In several forms I have fields like to one below

Field('the_file', 'upload' , label=T('Audio File *'), 
 default = False,

 uploadfolder=os.path.join(request.folder,'uploads/resources/audio')
 ),


When I delete the db record containing the result of processing the field 
above, I also want to delete the actual uploaded file.

If I "print"  db.audios.the_file I get a sensible file name, e.g. 
"audios.the_file.87f39e4b2eac56a2.7331343035323830332e706466.mp3"
but -  if I pass db.audios.the_file to os.path.join, I get an exception - 
"EXCEPTION 
= join() argument must be str or bytes, not 'Field'"
and  - if I pass str(db.audios.the_file) to os.path.join I end up with 
something ending in 'uploads/resources/audio/the_file'

Simple question. How do I get the name of the uploaded file in a form I can 
use in os.path.join

Thanks

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


[web2py] Re: upload - can I get the path to original file

2019-10-08 Thread 'jim kaubisch' via web2py-users


On Friday, October 4, 2019 at 12:07:06 PM UTC-7, jim kaubisch wrote:
>
> Hi
>
> In a file upload, I want to store both the original filename AND the path 
> to the original file (to cover the case of files with the same name but 
> from different folders)
> I'm successfully getting the filename from 
> "request.vars.the_file.filename" as documented, but is there somewhere I 
> can retrieve the path?
>
> Thanks
>

Thanks, Dave
As I read your reply, I remembered I'd hit this issue previously :-(  

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the 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/06c6d54b-d895-42ca-976d-11866b82805e%40googlegroups.com.


[web2py] upload - can I get the path to original file

2019-10-04 Thread 'jim kaubisch' via web2py-users
Hi

In a file upload, I want to store both the original filename AND the path 
to the original file (to cover the case of files with the same name but 
from different folders)
I'm successfully getting the filename from "request.vars.the_file.filename" 
as documented, but is there somewhere I can retrieve the path?

Thanks

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/d1c61d6f-2e89-47c8-913b-843e28a8d182%40googlegroups.com.


[web2py] Re: Adding custom attributes to fields and tables

2019-07-30 Thread 'jim kaubisch' via web2py-users
Similar question, but maybe simpler?

I have a table name which, for various reasons, isn't very human reader 
friendly (crowner). I'd like to add a table attribute (e.g. print_name = 
'Copyright Owners') to be used for table display instead of the table name 
itself
Does that mean db.table._extra = {'print_name' : 'Copyright Owners'} or ??? 
If so, how do I access that attribute? db.table.['print_name'] ???
Thanks

On Sunday, April 22, 2018 at 3:15:03 AM UTC-7, xelomac wrote:
>
> I want to add a custom attribute so that I can decide which customwidget 
> has to be used for a form field connected to that field.
> Example:
>
> db.define_table('person',
> Field('salutation', mycustomwidget='select2', label = T('Salutation'), 
> requires=IS_IN_SET(GENDER), represent=lambda v, r: GENDER[v]),
> Field('first_name', label = T('First Name')),
> format = '%(last_name)s')
>
>
> I had no luck defining that custom attribute the way it is described in 
> the book. How and and where would I define such a custom attribute 
> 'mycustomwidget' for the table 'person' or even better for all tables?
>
> Adding attributes to fields and tables
>
> If you need to add custom attributes to fields, you can simply do this:
>
> 1
>
> db.table.field.extra = {}
>
> "extra" is not a keyword ; it's a custom attributes now attached to the 
> field object. You can do it with tables too but they must be preceded by an 
> underscore to avoid naming conflicts with fields:
>
> 1
>
> db.table._extra = {} 
>
>
>

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


[web2py] Re: requires IS_IN_DB multiple and zero

2019-05-27 Thread 'jim kaubisch' via web2py-users

Thanks, Dave, that did the trick. 

>From the little I've tried, "command" seems to work (with Safari) for both 
single and Multiple. Haven't tried other browsers or the other platforms yet

On Saturday, May 25, 2019 at 9:49:28 PM UTC-7, jim kaubisch wrote:
>
> Hi and thanks for the suggestions - 
>
>  You seem to be saying:
>   single   - the user should click on "select one" to NOT select 
> ANY - when it's normal semantics is to force the user to selects one?
>  multiple -  if 10 things are selected and you want to unselect 1, 
> you need to unselect all 10, remember 9 and and start over again?
>
>
If your browser is running on windows or linux, try holding down the 
control key and clikcing on the unwanted selected item.  On a Mac, the 
command key might do the same.  On phones and tablets, I dunno.
I don't have an app with a MULTIPLE to try this on.  Also, some behaviors 
aren't uniform across browsers, much less libraries, so this may work for 
one user and not for another.
 

> Am I misinterpreting?
>
> I was hoping for something simpler/cleaner like - clicking on an entry 
> currently selected unselects it; clicking on it again, reselects it.
>
>
The control key feature is basically toggling the selection, but it 
isolates the item being clicked.  Contrast that with SHIFT-click, which is 
used for ranges.

Good luck!

/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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/242517cf-d6a4-4bf4-907e-d5bdec77ed28%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: requires IS_IN_DB multiple and zero

2019-05-25 Thread 'jim kaubisch' via web2py-users
Hi and thanks for the suggestions - 

 You seem to be saying:
  single   - the user should click on "select one" to NOT select 
ANY - when it's normal semantics is to force the user to selects one?
 multiple -  if 10 things are selected and you want to unselect 1, 
you need to unselect all 10, remember 9 and and start over again?

Am I misinterpreting?

I was hoping for something simpler/cleaner like - clicking on an entry 
currently selected unselects it; clicking on it again, reselects it.

On Saturday, May 25, 2019 at 12:25:18 PM UTC-7, villas wrote:
>
> *Multiple = False*
>
> IS_IN_SET(['a', 'b', 'c'], zero=T('choose one'))
> To unselect, click 'choose one' instead of whatever was selected.
>
> *Multiple = True*
> Unselect/remove everything which was previously selected.
>  
> ...then submit the form.
>
>
> On Saturday, 25 May 2019 01:32:23 UTC+1, jim kaubisch wrote:
>>
>> old posting, but have a related question - 
>>
>> In a form dropdown, certainly multiple but probably under some 
>> circumstances single, how do I un-select a previous choice without choosing 
>> an alternative? Simple example is - currently I have chosen 3 elements of 
>> the list, a, b, c and now want to unselect b without choosing an 
>> alternative. i.e. I want the resulting list to be a,c (or even empty if I 
>> unselect all three), but I see no way of doing that. The "single" case is I 
>> have made a choice, now want to undo that choice, i.e. end up with an empty 
>> list
>>
>> Am I missing something obvious?
>>
>> Thanks
>>
>> On Wednesday, January 30, 2013 at 2:41:16 AM UTC-8, Thomas Bellembois 
>> wrote:
>>>
>>> Hello web2py community, 
>>>
>>> I have a multiple select widget: 
>>>
>>> db.PRODUCT.class_of_compounds.requires=[IS_EMPTY_OR(IS_IN_DB(db, 
>>> db.CLASS_OF_COMPOUNDS.id, label=db.CLASS_OF_COMPOUNDS._format, 
>>> multiple=True, sort=db.CLASS_OF_COMPOUNDS.label, zero='choose'))] 
>>>
>>> The "zero" field does not appear. If I change multiple from True to 
>>> False it appears. 
>>> I have probably missed something in the documentation... 
>>>
>>> How can a user then unselect an item ? 
>>>
>>> Regards, 
>>>
>>> Thomas 
>>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the 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/32307a41-ac94-4af6-a977-e8b1d3767978%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: requires IS_IN_DB multiple and zero

2019-05-24 Thread 'jim kaubisch' via web2py-users
old posting, but have a related question - 

In a form dropdown, certainly multiple but probably under some 
circumstances single, how do I un-select a previous choice without choosing 
an alternative? Simple example is - currently I have chosen 3 elements of 
the list, a, b, c and now want to unselect b without choosing an 
alternative. i.e. I want the resulting list to be a,c (or even empty if I 
unselect all three), but I see no way of doing that. The "single" case is I 
have made a choice, now want to undo that choice, i.e. end up with an empty 
list

Am I missing something obvious?

Thanks

On Wednesday, January 30, 2013 at 2:41:16 AM UTC-8, Thomas Bellembois wrote:
>
> Hello web2py community, 
>
> I have a multiple select widget: 
>
> db.PRODUCT.class_of_compounds.requires=[IS_EMPTY_OR(IS_IN_DB(db, 
> db.CLASS_OF_COMPOUNDS.id, label=db.CLASS_OF_COMPOUNDS._format, 
> multiple=True, sort=db.CLASS_OF_COMPOUNDS.label, zero='choose'))] 
>
> The "zero" field does not appear. If I change multiple from True to 
> False it appears. 
> I have probably missed something in the documentation... 
>
> How can a user then unselect an item ? 
>
> Regards, 
>
> Thomas 
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the 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/4e843503-477b-4d79-8539-392495de32fb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Issue with db.export_to_csv_file and Python 3.7

2019-03-04 Thread 'jim kaubisch' via web2py-users

Leonel has copied the solution over to GitHub

On Saturday, March 2, 2019 at 3:22:22 AM UTC-8, Kevin Keller wrote:
>
> Could you make sure that your solutiona are reflected in the github 
> tickets for export and import problems please?
>
> Sure that would make it easier for Massimo to fix and merge the fixes for 
> 2.18.3
>

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


[web2py] Re: Issue with db.export_to_csv_file and Python 3.7

2019-03-01 Thread 'jim kaubisch' via web2py-users
been looking around some more. turns out this is a duplicate of this open 
item - https://github.com/web2py/web2py/issues/2013

Have looked more closely at the 3.x docs for csv and open as well as the 
code for export_to_csv_file in pydal. 

- the csv docs say 'w' only as Leonel suggested (not surprising),  and say 
to specify "newline = ''. 
- adding the encoding as suggested by Dave results in 
  
  with open(session.db_backup_name, 'w', encoding='utf-8', newline='') 
as backup_file:

which results in - SUCCESS at least so it seems. The claim is that the 
backup is successful. I haven't yet tried to restore the saved backup 

On Friday, March 1, 2019 at 1:41:25 PM UTC-8, Dave S wrote:
>
>
>
> On Friday, March 1, 2019 at 12:43:21 PM UTC-8, jim kaubisch wrote:
>>
>> Thanks, Leonel,
>>
>> In a different app (not web2py) I hit this issue pickle and the change 
>> you suggest solved the problem
>> Unfortunately, in the web2py and db.export_to_csv_file context, when I 
>> make the change you suggest, the error message just changes to
>>
>> 01/Mar/2019-12:32:27: INFO : backups  : 303   | backing 
>> db up as 
>> "applications/MFMCurrAssetMgr/private/_backups/bup_010319_123226/MFMCurrAssetMgr-db.csv"
>> 01/Mar/2019-12:32:27: WARNING : backups : 309   | - db backup 
>> Failed: exception: "'ascii' codec can't encode character '\u2019' in 
>> position 12: ordinal not in range(128)"
>>
>
>
> You probably need to specify an encoding in the open(), look at
> https://docs.python.org/3/library/functions.html#open>
>
> (which is also where the 'wb' -> 'w' is really explained)
>
> /dps
>
>
>>
>> On Friday, March 1, 2019 at 11:43:26 AM UTC-8, Leonel Câmara wrote:
>>>
>>> You actually have to open it using only 'w' instead of 'wb' in python 3 
>>> so change it to:
>>>
>>> with open(session.db_backup_name, 'w', newline=''):
>>>
>>> See:
>>> https://docs.python.org/3/library/csv.html?highlight=csv#csv.writer
>>>
>>>
>>>

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


[web2py] Re: Issue with db.export_to_csv_file and Python 3.7

2019-03-01 Thread 'jim kaubisch' via web2py-users
Thanks, Leonel,

In a different app (not web2py) I hit this issue pickle and the change you 
suggest solved the problem
Unfortunately, in the web2py and db.export_to_csv_file context, when I make 
the change you suggest, the error message just changes to

01/Mar/2019-12:32:27: INFO : backups  : 303   | backing db 
up as 
"applications/MFMCurrAssetMgr/private/_backups/bup_010319_123226/MFMCurrAssetMgr-db.csv"
01/Mar/2019-12:32:27: WARNING : backups : 309   | - db backup 
Failed: exception: "'ascii' codec can't encode character '\u2019' in 
position 12: ordinal not in range(128)"


On Friday, March 1, 2019 at 11:43:26 AM UTC-8, Leonel Câmara wrote:
>
> You actually have to open it using only 'w' instead of 'wb' in python 3 so 
> change it to:
>
> with open(session.db_backup_name, 'w', newline=''):
>
> See:
> https://docs.python.org/3/library/csv.html?highlight=csv#csv.writer
>
>
>

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

2019-03-01 Thread 'jim kaubisch' via web2py-users
The snippet below is code that has been working for years with web2py 
2.16/2.17 and Python 2.7
It fails with web2py 2.18.2 and Python 3.7.2.

The log says:

01/Mar/2019-10:33:34: INFO  : backups : 303   | backing up 
db as 
"applications/MFMCurrAssetMgr/private/_backups/bup_010319_103334/MFMCurrAssetMgr-db.csv"
01/Mar/2019-10:33:34: WARNING : backups : 309   | - db backup 
Failed: exception: "a bytes-like object is required, not 'str'"

but the file is being created in "wb" mode, so why?
Am I missing something or is there 


Enter code here...#
#
# Backup the db
#
logger.info(f'backing up db as "{session.db_backup_name}"')
with open(session.db_backup_name, 'wb') as backup_file:
try:
db.export_to_csv_file(backup_file)
logger.info(f'- db backup successful')
except Exception as why:
logger.warning(f'- db backup Failed: exception: 
"{why}"')
raise




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

2019-03-01 Thread 'jim kaubisch' via web2py-users
Hi,
I've successfully used this API for several years in this app (but with 
Python 2.7). never seen this in the past. 
Happens, not surprisingly, when importing/initializing the YouTube Data 
API. No other Google API's used
Environment is web2py 2.18.2, Python 3.7.2, macOS Mojave

These are the imports in this module:

import os
import sys
PY2K = sys.version_info[0] == 2

import json
import errno
if PY2K:
import httplib
else:
import http.client
import httplib2

# Google YouTube API related imports
from apiclient.discoveryimport build
from apiclient.errors   import HttpError
from apiclient.http import MediaFileUpload
from oauth2client.clientimport flow_from_clientsecrets
from oauth2client.file  import Storage
from oauth2client.tools import argparser, run_flow

from time import strftime
from operator import itemgetter

and here is the stream of tracebacks

Traceback (most recent call last):
  File "... /web2py/gluon/custom_import.py", line 77, in custom_importer
return NATIVE_IMPORTER(oname, globals, locals, fromlist, level)
ModuleNotFoundError: No module named 'google'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File " ... /web2py/gluon/custom_import.py", line 98, in custom_importer
return base_importer(pname, globals, locals, fromlist, level)
  File " ... /web2py/gluon/custom_import.py", line 137, in __call__
result = NATIVE_IMPORTER(name, globals, locals, fromlist, level)
ModuleNotFoundError: No module named 
'applications.MFMCurrAssetMgr.modules.google'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File " ... /web2py/gluon/custom_import.py", line 102, in custom_importer
return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
ModuleNotFoundError: No module named 'google'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File 
"/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/googleapiclient/discovery_cache/__init__.py",
 
line 36, in autodetect
from google.appengine.api import memcache
  File " ... /web2py/gluon/custom_import.py", line 104, in custom_importer
raise ImportError(e1, import_tb)  # there an import error in the module
ImportError: (ModuleNotFoundError("No module named 
'applications.MFMCurrAssetMgr.modules.google'"), )

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File " ... /web2py/gluon/custom_import.py", line 77, in custom_importer
return NATIVE_IMPORTER(oname, globals, locals, fromlist, level)
ModuleNotFoundError: No module named 'oauth2client.contrib.locked_file'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File " ... /web2py/gluon/custom_import.py", line 98, in custom_importer
return base_importer(pname, globals, locals, fromlist, level)
  File " ... /web2py/gluon/custom_import.py", line 137, in __call__
result = NATIVE_IMPORTER(name, globals, locals, fromlist, level)
ModuleNotFoundError: No module named 
'applications.MFMCurrAssetMgr.modules.oauth2client'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File " ... /web2py/gluon/custom_import.py", line 102, in custom_importer
return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
ModuleNotFoundError: No module named 'oauth2client.contrib.locked_file'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File 
"/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/googleapiclient/discovery_cache/file_cache.py",
 
line 33, in 
from oauth2client.contrib.locked_file import LockedFile
  File " ... /web2py/gluon/custom_import.py", line 104, in custom_importer
raise ImportError(e1, import_tb)  # there an import error in the module
ImportError: (ModuleNotFoundError("No module named 
'applications.MFMCurrAssetMgr.modules.oauth2client'"), )

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File " ... /web2py/gluon/custom_import.py", line 77, in custom_importer
return NATIVE_IMPORTER(oname, globals, locals, fromlist, level)
ModuleNotFoundError: No module named 'oauth2client.locked_file'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File " ... /web2py/gluon/custom_import.py", line 98, in custom_importer
return base_importer(pname, globals, locals, fromlist, level)
  File " ... /web2py/gluon/custom_import.py", line 137, in __call__
result = NATIVE_IMPORTER(name, globals, locals, fromlist, level)
ModuleNotFoundError: No module named 

[web2py] Re: invalid function (default/user) when migrating code to Python 3

2019-02-28 Thread 'jim kaubisch' via web2py-users
closing this. No code changes, one day the screen seemed to "flash" and 
instead of failing it started work properly.
Have now updated to 2.18.2 and it seems to work fine so far


On Thursday, February 21, 2019 at 3:08:52 PM UTC-8, jim kaubisch wrote:
>
>
> Hi, starting with an app that’s been running for several months running 
> web2py 2.17.1 and Python 2.7.14 on maOS 10.14.3 (Mojave), I’m embarked on 
> an app migration to Python 3 using web2py 2.17.2 and Python 3.7.2.
>
>
> This isn’t the first app I’ve converted to Python 3 and and I’ve got a 
> pretty good sense for what conversion issues look like - and this problem 
> seems different 
>
>
> I’m stuck and any help would be very appreciated. Thanks in advance
>
>
> 
>
> When I try to run to run the migrated app, problems arise almost 
> immediately
>
>
> 1. Starting web2py up using Python 3 seems to work fine. The welcome and 
> example apps seem to run fine
>
> 2 I can log in as admin
>
> 3. The list of apps is displayed as normal, including my migrated one
>
>
> 4. Selecting my app, I expect to need to login, but without any further 
> action, the browser screen says “Invalid function (default/user)” and 
> that’s the end of the story.
>
> * Note:* default/user code is unaltered from the we2py distribution
>
> * Note:* default/index is marked “@auth.requires_login()“ and is never 
> reached
>
> * Note*: Remove the “requires_login”, index is reached and appears to 
> run, but then the app then  hangs presumably because the next step wants 
> the user login
>
>
>
> Below is the start of the log:
>
>
> Last login: Thu Feb 21 13:16:46 on ttys003
>
> startDweb2pyPyV3.sh ; exit;
>
> startDweb2pyPyV3.sh ; exit;
>
>
> web2py Web Framework
>
> Created by Massimo Di Pierro, Copyright 2007-2019
>
> Version 2.17.2-stable+timestamp.2018.10.06.18.54.02
>
> Database drivers available: sqlite3, imaplib, pymysql, pyodbc
>
>
> please visit:
>
> http://127.0.0.1:8000/
>
> use "kill -SIGTERM 20701" to shutdown the web2py server
>
>
>
> /web2py/gluon/contrib/pymysql/cursors.py:166: Warning: (3090, "Changing 
> sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be removed in a 
> future release.")
>
>   result = self._query(query)
>
>
> In default
>
> default: app_dir: web2py/applications/MFMCurrAssetMgr_P3
>
> default: history_path: web2py/applications/MFMCurrAssetMgr_P3/private/_logs
>
> default: HISTORYLOGFILE: 
> web2py/applications/MFMCurrAssetMgr_P3/private/_logs/history.log
>
>
> INFO:root:  Don’t know where this comes from
>
> Logging Started - (V P3.0.1 Alpha) at 13:58:11 on 21-Feb-2019
>
>
> *<>*
>
>
> DEBUG:Rocket.Errors.Thread-2:Sending Headers: 'HTTP/1.1 303 SEE 
> OTHER\r\nLocation: 
> /MFMCurrAssetMgr_P3/default/user/login?_next=/MFMCurrAssetMgr_P3/default/index\r\nSet-Cookie:
>   
> session_id_mfmcurrassetmgr_p3=127.0.0.1-1d9e475c-9ae5-48c7-98fe-b517da06d765; 
> HttpOnly; Path=/; SameSite=Lax\r\nContent-Type: text/html; 
> charset=UTF-8\r\nDate: Thu, 21 Feb 2019 21:58:11 GMT\r\nServer: Rocket 
> 1.2.6 Python/3.7.2\r\nContent-Length: 122\r\nConnection: keep-alive\r\n\r\n'
>
>
> DEBUG:Rocket.Errors.Thread-2:Finally closing output and sock_file
>
> INFO:Rocket.Requests:127.0.0.1 - "GET /MFMCurrAssetMgr_P3/default/index 
> HTTP/1.1" - 303 122
>
> DEBUG:Rocket.Errors.Thread-2:Serving a request
>
> DEBUG:Rocket.Errors.Thread-2:Getting sock_file
>
> DEBUG:Rocket.Errors.ThreadPool:Examining ThreadPool. 10 threads and 0 Q'd 
> conxions
>
> DEBUG:Rocket.Errors.Thread-2:Sending Headers: 'HTTP/1.1 404 NOT 
> FOUND\r\nweb2py_error: invalid function (default/user)\r\nSet-Cookie:  
> session_id_mfmcurrassetmgr_p3=127.0.0.1-1d9e475c-9ae5-48c7-98fe-b517da06d765; 
> HttpOnly; Path=/; SameSite=Lax\r\nContent-Type: text/html; 
> charset=UTF-8\r\nContent-Length: 66\r\nDate: Thu, 21 Feb 2019 21:58:11 
> GMT\r\nServer: Rocket 1.2.6 Python/3.7.2\r\nConnection: keep-alive\r\n\r\n'
>
> DEBUG:Rocket.Errors.Thread-2:Finally closing output and sock_file
>
> INFO:Rocket.Requests:127.0.0.1 - "GET 
> /MFMCurrAssetMgr_P3/default/user/login?_next=/MFMCurrAssetMgr_P3/default/index
>  
> HTTP/1.1" - 404 66
>
> DEBUG:Rocket.Errors.Thread-2:Serving a request
>
> DEBUG:Rocket.Errors.Thread-2:Getting sock_file
>
> DEBUG:Rocket.Errors.ThreadPool:Examining ThreadPool. 10 threads and 0 Q'd 
> conxions
>
> DEBUG:Rocket.Errors.ThreadPool:Examining ThreadPool. 10 threads and 0 Q'd 
> conxions
>
> DEBUG:Rocket.Errors.ThreadPool:Examining ThreadPool. 10 threads and 0 Q'd 
> conxions
>
> DEBUG:Rocket.Errors.ThreadPool:Examining ThreadPool. 10 threads and 0 Q'd 
> conxions
>
> DEBUG:Rocket.Errors.Thread-3:Finally closing output and sock_file
>
> DEBUG:Rocket.Errors.Thread-3:Socket timed out
>
> DEBUG:Rocket.Errors.ThreadPool:Examining ThreadPool. 10 threads and 0 Q'd 
> conxions
>
> DEBUG:Rocket.Monitor:In "receive timed-out connections" loop.
>
> DEBUG:Rocket.Monitor:Received a timed out connection.
>
> DEBUG:Rocket.Monitor:Adding connection to monitor list.
>
> 

[web2py] invalid function (default/user) when migrating code to Python 3

2019-02-21 Thread 'jim kaubisch' via web2py-users

Hi, starting with an app that’s been running for several months running 
web2py 2.17.1 and Python 2.7.14 on maOS 10.14.3 (Mojave), I’m embarked on 
an app migration to Python 3 using web2py 2.17.2 and Python 3.7.2.


This isn’t the first app I’ve converted to Python 3 and and I’ve got a 
pretty good sense for what conversion issues look like - and this problem 
seems different 


I’m stuck and any help would be very appreciated. Thanks in advance




When I try to run to run the migrated app, problems arise almost immediately


1. Starting web2py up using Python 3 seems to work fine. The welcome and 
example apps seem to run fine

2 I can log in as admin

3. The list of apps is displayed as normal, including my migrated one


4. Selecting my app, I expect to need to login, but without any further 
action, the browser screen says “Invalid function (default/user)” and 
that’s the end of the story.

* Note:* default/user code is unaltered from the we2py distribution

* Note:* default/index is marked “@auth.requires_login()“ and is never 
reached

* Note*: Remove the “requires_login”, index is reached and appears to run, 
but then the app then  hangs presumably because the next step wants the 
user login



Below is the start of the log:


Last login: Thu Feb 21 13:16:46 on ttys003

startDweb2pyPyV3.sh ; exit;

startDweb2pyPyV3.sh ; exit;


web2py Web Framework

Created by Massimo Di Pierro, Copyright 2007-2019

Version 2.17.2-stable+timestamp.2018.10.06.18.54.02

Database drivers available: sqlite3, imaplib, pymysql, pyodbc


please visit:

http://127.0.0.1:8000/

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



/web2py/gluon/contrib/pymysql/cursors.py:166: Warning: (3090, "Changing sql 
mode 'NO_AUTO_CREATE_USER' is deprecated. It will be removed in a future 
release.")

  result = self._query(query)


In default

default: app_dir: web2py/applications/MFMCurrAssetMgr_P3

default: history_path: web2py/applications/MFMCurrAssetMgr_P3/private/_logs

default: HISTORYLOGFILE: 
web2py/applications/MFMCurrAssetMgr_P3/private/_logs/history.log


INFO:root:  Don’t know where this comes from

Logging Started - (V P3.0.1 Alpha) at 13:58:11 on 21-Feb-2019


*<>*


DEBUG:Rocket.Errors.Thread-2:Sending Headers: 'HTTP/1.1 303 SEE 
OTHER\r\nLocation: 
/MFMCurrAssetMgr_P3/default/user/login?_next=/MFMCurrAssetMgr_P3/default/index\r\nSet-Cookie:
  
session_id_mfmcurrassetmgr_p3=127.0.0.1-1d9e475c-9ae5-48c7-98fe-b517da06d765; 
HttpOnly; Path=/; SameSite=Lax\r\nContent-Type: text/html; 
charset=UTF-8\r\nDate: Thu, 21 Feb 2019 21:58:11 GMT\r\nServer: Rocket 
1.2.6 Python/3.7.2\r\nContent-Length: 122\r\nConnection: keep-alive\r\n\r\n'


DEBUG:Rocket.Errors.Thread-2:Finally closing output and sock_file

INFO:Rocket.Requests:127.0.0.1 - "GET /MFMCurrAssetMgr_P3/default/index 
HTTP/1.1" - 303 122

DEBUG:Rocket.Errors.Thread-2:Serving a request

DEBUG:Rocket.Errors.Thread-2:Getting sock_file

DEBUG:Rocket.Errors.ThreadPool:Examining ThreadPool. 10 threads and 0 Q'd 
conxions

DEBUG:Rocket.Errors.Thread-2:Sending Headers: 'HTTP/1.1 404 NOT 
FOUND\r\nweb2py_error: invalid function (default/user)\r\nSet-Cookie:  
session_id_mfmcurrassetmgr_p3=127.0.0.1-1d9e475c-9ae5-48c7-98fe-b517da06d765; 
HttpOnly; Path=/; SameSite=Lax\r\nContent-Type: text/html; 
charset=UTF-8\r\nContent-Length: 66\r\nDate: Thu, 21 Feb 2019 21:58:11 
GMT\r\nServer: Rocket 1.2.6 Python/3.7.2\r\nConnection: keep-alive\r\n\r\n'

DEBUG:Rocket.Errors.Thread-2:Finally closing output and sock_file

INFO:Rocket.Requests:127.0.0.1 - "GET 
/MFMCurrAssetMgr_P3/default/user/login?_next=/MFMCurrAssetMgr_P3/default/index 
HTTP/1.1" - 404 66

DEBUG:Rocket.Errors.Thread-2:Serving a request

DEBUG:Rocket.Errors.Thread-2:Getting sock_file

DEBUG:Rocket.Errors.ThreadPool:Examining ThreadPool. 10 threads and 0 Q'd 
conxions

DEBUG:Rocket.Errors.ThreadPool:Examining ThreadPool. 10 threads and 0 Q'd 
conxions

DEBUG:Rocket.Errors.ThreadPool:Examining ThreadPool. 10 threads and 0 Q'd 
conxions

DEBUG:Rocket.Errors.ThreadPool:Examining ThreadPool. 10 threads and 0 Q'd 
conxions

DEBUG:Rocket.Errors.Thread-3:Finally closing output and sock_file

DEBUG:Rocket.Errors.Thread-3:Socket timed out

DEBUG:Rocket.Errors.ThreadPool:Examining ThreadPool. 10 threads and 0 Q'd 
conxions

DEBUG:Rocket.Monitor:In "receive timed-out connections" loop.

DEBUG:Rocket.Monitor:Received a timed out connection.

DEBUG:Rocket.Monitor:Adding connection to monitor list.

DEBUG:Rocket.Errors.Thread-2:Finally closing output and sock_file

DEBUG:Rocket.Errors.Thread-2:Socket timed out

DEBUG:Rocket.Errors.ThreadPool:Examining ThreadPool. 10 threads and 0 Q'd 
conxions

DEBUG:Rocket.Monitor:In "receive timed-out connections" loop.

DEBUG:Rocket.Monitor:Received a timed out connection.

DEBUG:Rocket.Monitor:Adding connection to monitor list.

DEBUG:Rocket.Monitor:Flushing stale connection: 127.0.0.1:8000

DEBUG:Rocket.Errors.ThreadPool:Examining ThreadPool. 10 threads and 0 Q'd 
conxions


[web2py] Re: Salesforce access code works standalone but fails from within web2py app

2018-06-19 Thread 'jim kaubisch' via web2py-users
Solved... 

Ultimately an out-of-date simple_salesforce, 
but complicated by the fact that my pip v9.0.1 attempt to upgrade  
simple_salesforce (and even pip  itself) also failed with a TLSV1 failure.

Stumbled upon this link - which had an answer that worked for me to get out 
of this apparent infinite loop :-(

 
https://brianchan.us/2018/04/17/pip-install-error-ssl-tlsv1_alert_protocol_version/

Might be for use to others

On Tuesday, June 19, 2018 at 9:06:29 AM UTC-7, jim kaubisch wrote:
>
> HI,
>
>
> One of the apps I’m writing involves interaction with Salesforce. 
>
>
> I’ve written a context manager to implement access to our Salesforce 
> account (using “simple_salesforce” as the access mechanism). 
>
>
> When run as a standalone program access and data retrieval work fine, but 
> imported into my web2py app and called from there, it fails with
>
>
>Failed to open SF connection. 
>
>
>Msg= HTTPSConnectionPool(host='login.salesforce.com', port=443): 
>
> Max retries exceeded with url: /services/Soap/u/29.0 (Caused by 
> SSLError(SSLError(1, 
>
> u'[SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake 
> failure (_ssl.c:661)'),))
>
>
> There’s no particular reason why anyone would know what the problem might 
> be, but I’m asking just in case :-(
>
>
> Thanks
>

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


[web2py] Salesforce access code works standalone but fails from within web2py app

2018-06-19 Thread 'jim kaubisch' via web2py-users
 

HI,


One of the apps I’m writing involves interaction with Salesforce. 


I’ve written a context manager to implement access to our Salesforce 
account (using “simple_salesforce” as the access mechanism). 


When run as a standalone program access and data retrieval work fine, but 
imported into my web2py app and called from there, it fails with


   Failed to open SF connection. 


   Msg= HTTPSConnectionPool(host='login.salesforce.com', port=443): 

Max retries exceeded with url: /services/Soap/u/29.0 (Caused by 
SSLError(SSLError(1, 

u'[SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake 
failure (_ssl.c:661)'),))


There’s no particular reason why anyone would know what the problem might 
be, but I’m asking just in case :-(


Thanks

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


[web2py] Re: Clarification please on autocomplete widget...

2018-06-19 Thread 'jim kaubisch' via web2py-users
Thanks, Anthony.

because there may be MANY values in the field, what I would actually be 
perfectly happy with is a list as you describe it, 
but one that is the result of a db query, 

e.g. a list of names of all schools whose "Field('district_id'   , 
'reference districts', label=T('District')" is 2. 

Tried doing that yesterday without success. 


On Tuesday, June 19, 2018 at 4:05:08 AM UTC-7, Anthony wrote:
>
> No, as the example in the book shows, by "list", it just means a list 
> generated from the contents of a single field in a database table (in 
> contrast to the reference field option, which submits integer ID values 
> from a reference field but searches and displays the corresponding values 
> from an alternative field).
>
> There are other autocomplete widgets you can use, but if you really want 
> to use the web2py widget, I suppose you could just put your list in a 
> database table.
>
> Anthony
>
> On Monday, June 18, 2018 at 11:59:27 PM UTC-4, jim kaubisch wrote:
>>
>> What am I misunderstanding... ??
>>
>> Building a form with fields that really need to be autocompleted 
>> (potentially 1,000+ possible values). 
>>
>> Looked at the book which says "two possible uses for the autocomplete 
>> widget: to autocomplete a field that takes a value from a *list* or to 
>> autocomplete a *reference field*"
>> I assumed that "list" meant an ordinary Python list object, but when I 
>> try:
>>
>>   fields = []
>>   ...
>>
>>  name_list = ['name1', 'name2']
>>   fields.append(Field('school', 'string' , label=T('School Name?')
>>  , 
>> widget=SQLFORM.widgets.autocomplete(request , name_list, limitby=(0,10), 
>> min_length=0)
>>  , requires=IS_NOT_EMPTY()))
>>...
>>
>>   enter_data_form=SQLFORM.factory(*fields, table_name='enter_data')
>>
>> I get the following:
>>  'list' object has no 
>> attribute 'tablename'
>>
>> which I interpret to mean that 'list' in this case means something 
>> different than I expected.
>>
>> What am I doing wrong?
>>
>> Thanks
>>
>>
>>

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


[web2py] Clarification please on autocomplete widget...

2018-06-18 Thread 'jim kaubisch' via web2py-users
What am I misunderstanding... ??

Building a form with fields that really need to be autocompleted 
(potentially 1,000+ possible values). 

Looked at the book which says "two possible uses for the autocomplete widget: 
to autocomplete a field that takes a value from a *list* or to autocomplete 
a *reference field*"
I assumed that "list" meant an ordinary Python list object, but when I try:

  fields = []
  ...

 name_list = ['name1', 'name2']
  fields.append(Field('school', 'string' , label=T('School Name?')
 , 
widget=SQLFORM.widgets.autocomplete(request , name_list, limitby=(0,10), 
min_length=0)
 , requires=IS_NOT_EMPTY()))
   ...

  enter_data_form=SQLFORM.factory(*fields, table_name='enter_data')

I get the following:
 'list' object has no attribute 
'tablename'

which I interpret to mean that 'list' in this case means something 
different than I expected.

What am I doing wrong?

Thanks


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


[web2py] Re: "unarchive" a record?

2018-06-18 Thread 'jim kaubisch' via web2py-users
Thanks for your inputs. Used it, checked to make sure the results were as I 
expected them to be. Good progress on this since then...

On Tuesday, June 12, 2018 at 9:45:46 AM UTC-7, Anthony wrote:
>
> current.update_record(name=version.name, description=version.description)
>>
>>
> And note, if you have a lot of fields to update, the above can be 
> simplified to:
>
> current.update_record(**db.record._filter_fields(version))
>
> Anthony
>
>

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


[web2py] "unarchive" a record?

2018-06-11 Thread 'jim kaubisch' via web2py-users
Hi,

I'm probably missing something obvious since I don't see anyone asking this 
but here it goes...

I want to archive a db record but, at a later date, I may want to unarchive 
it, i.e. make it current again and I'm not sure I understand how to do that 
coherently 

 - I have record versioning enabled 
 - I can see that when I "delete" a record in table "abc", its "is_active" 
field is set to False and the abc_archive table gets a new entry for the 
deleted record

But, if I now want to reverse the process, i.e. make the record current, 
what do I need to do (and leave the db in a state where, if I later 
re-archive that record, things are consistent? )
  - Only set "is_active" to true? 
  - What about the records in the archive table? Delete/modify those 
records? - if I later re-archive that record, I need things to be consistent

Ideally, I'd like a ongoing modification history
 - record was originally created 3 years ago, archived last year, 
re-activated 3 months ago and re-archived yesterday...

Thanks,
Jim


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


[web2py] Re: is response.menu cached?

2018-06-11 Thread 'jim kaubisch' via web2py-users
Embarrassing :( Yes, I read that a long time ago but forgot. Thank you both 
for your response - Jim

On Friday, May 25, 2018 at 12:07:14 PM UTC-7, Anthony wrote:
>
> To further clarify, there is nothing special about the filename "menu.py" 
> (or any of the files in the /models folder) -- all the files in the folder 
> are executed (unless you explicitly specify response.models_to_run or use 
> sub-folders to run model files conditionally).
>
> Anthony
>
> On Friday, May 25, 2018 at 2:18:08 PM UTC-4, Nico de Groot wrote:
>>
>> If you leave the copy in the model folder it still is active. .py  files 
>> are all executed in alphabetical order at every request. If you want to 
>> keep a backup use another suffix.
>>
>> Nico de Groot
>>
>

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


[web2py] Re: is response.menu cached?

2018-05-25 Thread 'jim kaubisch' via web2py-users

Its beginning to look like this problem IS in web2py - 

The actions I took -
  - duplicate menu.py (macOS names the copy "menu copy.py) and rename the 
original file something like menu_old.py and leave that renamed file in the 
models directory as reference backup
  - using the menu copy.py as a starting point, rename it menu.py  and 
experiment with the proposed changes, save the file and restart the app to 
see the result

  and the result seems, at least for me, to be that AS LONG AS THE 
MENU_OLD.PY file remains in the models directory, web2py continues to pick 
IT up as menu.py, rather than the modified file

It seems, if I remove the menu_old file from the models directory, web2py 
is then triggered to look for menu.py again and picks up the new file

At least that's the way it looks right now. Anyone seen something similar?


On Friday, May 25, 2018 at 9:11:15 AM UTC-7, jim kaubisch wrote:
>
> Only two "compile" options show, no "remove compiled" option. I assume 
> that the app is NOT compiled?
>
> Stumbled on the answer...
> I'm using TextMate2 to edit. Once I not only saved but CLOSED the menu.py 
> file and reopened it, it all worked like normal - presumably some corner 
> case bug :-(
>
> Thanks for coming to the rescue !
>
> On Thursday, May 24, 2018 at 10:34:11 PM UTC-7, 黄祥 wrote:
>>
>> ok, target spotted, seems your webapp is compiled, so please uncompile 
>> your web app first (via web2py app admin), then change your code (menu), 
>> then refresh your browser.
>>
>> best regards,
>> stifan
>>
>

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


[web2py] Re: is response.menu cached?

2018-05-25 Thread 'jim kaubisch' via web2py-users
Only two "compile" options show, no "remove compiled" option. I assume that 
the app is NOT compiled?

Stumbled on the answer...
I'm using TextMate2 to edit. Once I not only saved but CLOSED the menu.py 
file and reopened it, it all worked like normal - presumably some corner 
case bug :-(

Thanks for coming to the rescue !

On Thursday, May 24, 2018 at 10:34:11 PM UTC-7, 黄祥 wrote:
>
> ok, target spotted, seems your webapp is compiled, so please uncompile 
> your web app first (via web2py app admin), then change your code (menu), 
> then refresh your browser.
>
> best regards,
> stifan
>

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


[web2py] Re: is response.menu cached?

2018-05-24 Thread 'jim kaubisch' via web2py-users
Yes to the first and third of your questions. Not sure what you mean by 
incognito or how to achieve it
Also, by the way, Chrome is my usual browser but tried a second (Safari) 
and third browser (FireFox). All identical results. Don't think I've EVER 
used Firefox with web2py before

On Thursday, May 24, 2018 at 9:05:04 PM UTC-7, 黄祥 wrote:
>
> had you compile your app?
> had you tried to remove the cache in browser or tried in incognito, and do 
> load refresh (shift f5) the page?
>
> best regards,
> stifan
>

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


[web2py] Re: is response.menu cached?

2018-05-24 Thread 'jim kaubisch' via web2py-users
Sorry, the environment is - web2py version 2.16.1, Rocket 1.2.6, python 
2.7.14, macOS 10.13.4

On Thursday, May 24, 2018 at 8:49:41 PM UTC-7, jim kaubisch wrote:
>
> Hi,
>
> I've never had this issue in the past, but when I change the definition of 
> response.menu (.../models/menu.py),  the change is not reflected on the web 
> page. 
> I edit the definition (as many times before) and if I restart the app, or 
> even web2py, the displayed menu displays as it was before the change.
> If I print out the value of response.menu after I change it, I see the NEW 
> update. When I "beautify" response.menu in the view, I see the OLD version
>
> It has the feeling of the menu being cached?? I've looked in this forum 
> and the manual and have not found an answer :-(
>
> Thanks,
> Jim
>
>

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


[web2py] is response.menu cached?

2018-05-24 Thread 'jim kaubisch' via web2py-users
Hi,

I've never had this issue in the past, but when I change the definition of 
response.menu (.../models/menu.py),  the change is not reflected on the web 
page. 
I edit the definition (as many times before) and if I restart the app, or 
even web2py, the displayed menu displays as it was before the change.
If I print out the value of response.menu after I change it, I see the NEW 
update. When I "beautify" response.menu in the view, I see the OLD version

It has the feeling of the menu being cached?? I've looked in this forum and 
the manual and have not found an answer :-(

Thanks,
Jim

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


[web2py] Re: Mac OSX server startup files

2018-05-24 Thread 'jim kaubisch' via web2py-users
Thank you to all !! 
Followed the instructions and it works!!  

As a heads up, I looked at the Apple docs and this is now a deprecated 
method - but still works, thank goodness

On Thursday, September 28, 2017 at 4:42:07 PM UTC-7, 黄祥 wrote:
>
> just test to create the service for web2py that running from source, 
> status worked (start, stop and restart), pls change the path with your 
> web2py path:
> e.g. 
> touch ~/Downloads/web2py
> chmod +x ~/Downloads/web2py
> vi  ~/Downloads/web2py
>
> #!/bin/sh
> . /etc/rc.common
>
> StartService( )
> {
> ConsoleMessage "Starting web2py"
> python /path/web2py/web2py.py --nogui --no-banner -a 'a' -i 0.0.0.0 -p 
> 8000 -d /path/web2py/web2py.pid &
> }
>
> StopService( )
> {
> ConsoleMessage "Stopping web2py"
> kill `cat /path/web2py/web2py.pid`
> }
>
> RestartService( )
> {
> ConsoleMessage "Restarting web2py"
> StopService
> StartService
> }
>
> RunService "$1"
>
> n.b.
> - source /path/bin/activate do not work when using virtual environment, 
> error : /path/bin/activate: line 58: PS1: unbound variable
> - if you prefer to put *.pid file in /var/run or other folder that need 
> root privilege pls ensure the user have a root privilege (sudo)
>
> best regards,
> stifan
>

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


[web2py] Re: web2py_osx.zip seems way out of date ???

2018-02-23 Thread 'jim kaubisch' via web2py-users


On Wednesday, February 7, 2018 at 10:47:19 AM UTC-8, jim kaubisch wrote:
>
> Hi,
>
> I needed to directed my attention away from my web2py project a few months 
> ago but am now trying to get back into it. 
> A wise Step 1 would seem to be to update from 2.14.6 to the current 
> version (2.16.1 I assume).
>
> First tried from source but got 
>
> Traceback (most recent call last):
>
>   File "web2py.py", line 21, in 
>
> import gluon.widget
>
>   File “./Development/web2py/gluon/__init__.py", line 38, in 
>
> from .dal import DAL, Field
>
>   File “./Development/web2py/gluon/dal.py", line 17, in 
>
> from pydal.migrator import Migrator, InDBMigrator
>
> ImportError: cannot import name InDBMigrator
>
>
> I still have 2.14.6 installed (in a separate sub-tree) - is that the 
> problem?
>
>
> so I downloaded the mac "mac_osx.zip" to try that but - 
>
> after unzipping, when I try to run the resulting web2py/web2py.app I just 
> get a pop up saying "web2py error". 
>
> When I look at the file info for the web2py.app file it says Version 
> 2.4.7, dated 29 May, 2013
>
>
> What am I doing wrong? 
>
> The app file info certainly doesn't look encouraging. 
>
> I assume having 2 versions of web2py in separate sub-trees shouldn't be a 
> problem
>
>
> Thanks,
>
> Jim
>
>
>

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


[web2py] Re: web2py_osx.zip seems way out of date ???

2018-02-23 Thread 'jim kaubisch' via web2py-users
Thanks for the reply, Dave.

There have been a number of issues surrounding the last couple of versions 
of Mac OS which come down to the fact that Apple has tightened security of 
the core of the system, As a result of that, some third party code doesn't 
always run because its trying to do things that it probably should never 
have been able to do, and that are no longer permitted - I was tearing my 
hair out the last couple of days trying to update my version of pyinstaller 
with pip failing no matter what I did because the system would not allow it 
to delete old files that it expected to be able to :(

The problem here may ultimately be tied up with this general issue. I will 
keep poking at it. It seems I'm the only one who has the problem :(

Jim

On Thursday, February 15, 2018 at 2:05:26 AM UTC-8, Dave S wrote:
>
> On Wednesday, February 14, 2018 at 6:23:44 PM UTC-8, jim kaubisch wrote:
>>
>> Has no-one else had this problem?
>>
>
> I run web2py on Windows or on linux, and having multiple versions has not 
> been a problem.  That's the way I usually upgrade, copying my applications 
> across, and looking for js/css/appadmin changes.   Lets me switch back 
> easily, and I'm not running anywhere that the size of web2py makes for a 
> problem.
>
> I don't often use a Mac, so I don't know how that environment changes 
> things, other than some of the key labels.
>
> /dps
>  
>
>>
>>
>> On Wednesday, February 7, 2018 at 10:47:19 AM UTC-8, jim kaubisch wrote:
>>>
>>> Hi,
>>>
>>> I needed to directed my attention away from my web2py project a few 
>>> months ago but am now trying to get back into it. 
>>> A wise Step 1 would seem to be to update from 2.14.6 to the current 
>>> version (2.16.1 I assume).
>>>
>>> First tried from source but got 
>>>
>>> Traceback (most recent call last):
>>>
>>>   File "web2py.py", line 21, in 
>>>
>>> import gluon.widget
>>>
>>>   File “./Development/web2py/gluon/__init__.py", line 38, in 
>>>
>>> from .dal import DAL, Field
>>>
>>>   File “./Development/web2py/gluon/dal.py", line 17, in 
>>>
>>> from pydal.migrator import Migrator, InDBMigrator
>>>
>>> ImportError: cannot import name InDBMigrator
>>>
>>>
>>> I still have 2.14.6 installed (in a separate sub-tree) - is that the 
>>> problem?
>>>
>>>
>>> so I downloaded the mac "mac_osx.zip" to try that but - 
>>>
>>> after unzipping, when I try to run the resulting web2py/web2py.app I 
>>> just get a pop up saying "web2py error". 
>>>
>>> When I look at the file info for the web2py.app file it says Version 
>>> 2.4.7, dated 29 May, 2013
>>>
>>>
>>> What am I doing wrong? 
>>>
>>> The app file info certainly doesn't look encouraging. 
>>>
>>> I assume having 2 versions of web2py in separate sub-trees shouldn't be 
>>> a problem
>>>
>>>
>>> Thanks,
>>>
>>> Jim
>>>
>>>
>>>

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


[web2py] Re: web2py_osx.zip seems way out of date ???

2018-02-14 Thread 'jim kaubisch' via web2py-users
Has no-one else had this problem?


On Wednesday, February 7, 2018 at 10:47:19 AM UTC-8, jim kaubisch wrote:
>
> Hi,
>
> I needed to directed my attention away from my web2py project a few months 
> ago but am now trying to get back into it. 
> A wise Step 1 would seem to be to update from 2.14.6 to the current 
> version (2.16.1 I assume).
>
> First tried from source but got 
>
> Traceback (most recent call last):
>
>   File "web2py.py", line 21, in 
>
> import gluon.widget
>
>   File “./Development/web2py/gluon/__init__.py", line 38, in 
>
> from .dal import DAL, Field
>
>   File “./Development/web2py/gluon/dal.py", line 17, in 
>
> from pydal.migrator import Migrator, InDBMigrator
>
> ImportError: cannot import name InDBMigrator
>
>
> I still have 2.14.6 installed (in a separate sub-tree) - is that the 
> problem?
>
>
> so I downloaded the mac "mac_osx.zip" to try that but - 
>
> after unzipping, when I try to run the resulting web2py/web2py.app I just 
> get a pop up saying "web2py error". 
>
> When I look at the file info for the web2py.app file it says Version 
> 2.4.7, dated 29 May, 2013
>
>
> What am I doing wrong? 
>
> The app file info certainly doesn't look encouraging. 
>
> I assume having 2 versions of web2py in separate sub-trees shouldn't be a 
> problem
>
>
> Thanks,
>
> Jim
>
>
>

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


[web2py] Re: web2py_osx.zip seems way out of date ???

2018-02-11 Thread 'jim kaubisch' via web2py-users
Thank you, Massimo !!

Is there any reason that one could not have 2 versions of web2py on disk at 
the same time? 
The reason for wanting that is that is conservatism
   - Having thousands of lines of code developed under 2.14.6 and migrating 
them to 2.16.1
 if something doesn't work under the new version, being able to go back 
to the old might be useful to identify issues

What is the reason for the "ImportError: cannot import name InDBMigrator" 
error. Same error whether separately downloading source or using the 
builtin web2py "update" option 

Thanks

On Wednesday, February 7, 2018 at 10:47:19 AM UTC-8, jim kaubisch wrote:
>
> Hi,
>
> I needed to directed my attention away from my web2py project a few months 
> ago but am now trying to get back into it. 
> A wise Step 1 would seem to be to update from 2.14.6 to the current 
> version (2.16.1 I assume).
>
> First tried from source but got 
>
> Traceback (most recent call last):
>
>   File "web2py.py", line 21, in 
>
> import gluon.widget
>
>   File “./Development/web2py/gluon/__init__.py", line 38, in 
>
> from .dal import DAL, Field
>
>   File “./Development/web2py/gluon/dal.py", line 17, in 
>
> from pydal.migrator import Migrator, InDBMigrator
>
> ImportError: cannot import name InDBMigrator
>
>
> I still have 2.14.6 installed (in a separate sub-tree) - is that the 
> problem?
>
>
> so I downloaded the mac "mac_osx.zip" to try that but - 
>
> after unzipping, when I try to run the resulting web2py/web2py.app I just 
> get a pop up saying "web2py error". 
>
> When I look at the file info for the web2py.app file it says Version 
> 2.4.7, dated 29 May, 2013
>
>
> What am I doing wrong? 
>
> The app file info certainly doesn't look encouraging. 
>
> I assume having 2 versions of web2py in separate sub-trees shouldn't be a 
> problem
>
>
> Thanks,
>
> Jim
>
>
>

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


[web2py] Re: Add conditional sub-menu

2018-02-08 Thread 'jim kaubisch' via web2py-users
this is an old thread, but I needed to do add a conditional piece to a menu 
- but had trouble with all the options below.

Then I realized that response.menu is a list, hence rather than 

if (auth.user_id != None) and ((auth.has_membership(role = 'admin'))):
response.menu += [('Admin',  False,  URL('admin')), ]


the following:

if (auth.user_id != None) and ((auth.has_membership(role = 'admin'))):
response.menu.append( [('Admin',  False,  URL('admin')), ])


worked for me :-) 

Mine actually included simple dropdown submenus...

if (auth.user_id != None) and (auth.has_membership(role = 'admin')):
response.menu.append ([' Admin',  False,  None,
[
['Show Meta Data' , False, URL('my_admin', 
'show_meta_data' , vars=dict(meta_op='meta_show'))],
['Backup Database', False, URL('my_admin', 
'backup_database', vars=dict(db_op  ='db_backup'))],
['Backup Database', False, URL('my_admin', 
'backup_database', vars=dict(db_op  ='db_restore'))]
]
 ])


On Wednesday, April 11, 2012 at 9:24:29 AM UTC-7, Omi Chiba wrote:
>
> The following menu works. It's add "Admin" menu next to "Price List" if 
> the user has role "admin". Now, I want to add the "Admin" menu as sub-menu 
> of "Price List" where it's right after the "Cut Charge Tables". How can I 
> do this ?
>
> response.menu = [('Home', False, URL('home','default','index'), []),
> (SPAN('Price List',_style='color:yellow'), True, 
> URL('pricelist','default','index'), 
> [('Guideline',  False,  URL('pricelist','default','guideline')),
>  ('Multiplier Tables',  False, 
>  URL('pricelist','default','multitable')),
>  ('Cut Charge Tables',  False,  URL('pricelist','default','cuttable')),
> ])]
>
> if (auth.user_id != None) and ((auth.has_membership(role = 'admin'))):
> response.menu += [('Admin',  False,  URL('admin')), ]
>

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


[web2py] Re: web2py_osx.zip seems way out of date ???

2018-02-07 Thread 'jim kaubisch' via web2py-users
Just to clarify, the web2py.app file in the "mac_osx.zip" is the one that 
looks to be out of date

On Wednesday, February 7, 2018 at 10:47:19 AM UTC-8, jim kaubisch wrote:
>
> Hi,
>
> I needed to directed my attention away from my web2py project a few months 
> ago but am now trying to get back into it. 
> A wise Step 1 would seem to be to update from 2.14.6 to the current 
> version (2.16.1 I assume).
>
> First tried from source but got 
>
> Traceback (most recent call last):
>
>   File "web2py.py", line 21, in 
>
> import gluon.widget
>
>   File “./Development/web2py/gluon/__init__.py", line 38, in 
>
> from .dal import DAL, Field
>
>   File “./Development/web2py/gluon/dal.py", line 17, in 
>
> from pydal.migrator import Migrator, InDBMigrator
>
> ImportError: cannot import name InDBMigrator
>
>
> I still have 2.14.6 installed (in a separate sub-tree) - is that the 
> problem?
>
>
> so I downloaded the mac "mac_osx.zip" to try that but - 
>
> after unzipping, when I try to run the resulting web2py/web2py.app I just 
> get a pop up saying "web2py error". 
>
> When I look at the file info for the web2py.app file it says Version 
> 2.4.7, dated 29 May, 2013
>
>
> What am I doing wrong? 
>
> The app file info certainly doesn't look encouraging. 
>
> I assume having 2 versions of web2py in separate sub-trees shouldn't be a 
> problem
>
>
> Thanks,
>
> Jim
>
>
>

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


[web2py] web2py_osx.zip seems way out of date ???

2018-02-07 Thread 'jim kaubisch' via web2py-users
Hi,

I needed to directed my attention away from my web2py project a few months 
ago but am now trying to get back into it. 
A wise Step 1 would seem to be to update from 2.14.6 to the current version 
(2.16.1 I assume).

First tried from source but got 

Traceback (most recent call last):

  File "web2py.py", line 21, in 

import gluon.widget

  File “./Development/web2py/gluon/__init__.py", line 38, in 

from .dal import DAL, Field

  File “./Development/web2py/gluon/dal.py", line 17, in 

from pydal.migrator import Migrator, InDBMigrator

ImportError: cannot import name InDBMigrator


I still have 2.14.6 installed (in a separate sub-tree) - is that the 
problem?


so I downloaded the mac "mac_osx.zip" to try that but - 

after unzipping, when I try to run the resulting web2py/web2py.app I just 
get a pop up saying "web2py error". 

When I look at the file info for the web2py.app file it says Version 2.4.7, 
dated 29 May, 2013


What am I doing wrong? 

The app file info certainly doesn't look encouraging. 

I assume having 2 versions of web2py in separate sub-trees shouldn't be a 
problem


Thanks,

Jim


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


[web2py] Re: Mac OSX server startup files

2017-09-28 Thread 'jim kaubisch' via web2py-users
Hi,

I want/need to install web2py on macOS Server. 
The instructions below seem pretty clear. However, they were written 6+ 
years ago and macOS , macOS Server and web2py all have evolved since then.

Before putting effort into trying the instructions, I'd greatly appreciate 
knowing - Does anyone have recent experience  installing web2py on macOS 
Server  (my current environment is Sierra, Server 5.3 and, at this point, 
web2py 2.14.6). 

Thanks,
Jim


On Wednesday, February 2, 2011 at 2:06:03 AM UTC-8, rif wrote:
>
> I made web2py autostart on a mac osx server conforming to tutorial 
> .
>
> Install web2py in /Applications folder.
> The StartupParameters.plist must be placed in the /Library/StartupItems/ 
> (if you don't have one already).
> Then create a directory named web2py in the same location 
> (/Library/StartupItems/) and place the web2py shell file in it.
> Make web2py file executable like this: chmod 
> +x /Library/StartupItems/web2py/web2py
>
> You can use the following command now:
>
> sudo /Library/StartupItems/web2py/web2py start
> sudo /Library/StartupItems/web2py/web2py restart
> sudo /Library/StartupItems/web2py/web2py stop
>
> The autostart feature is not tested as I created them on a production 
> server and I cannot restart it.
>
> StartupParameters.plist:
>
>   "file://localhost/System/Library/DTDs/PropertyList.dtd">  version="0.9">  Description web2py 
> Provides  web2py  
> Requires  Network  
> OrderPreference Late  
>
> web2py:
> #!/bin/sh . /etc/rc.common StartService( ) { ConsoleMessage "Starting 
> web2py" /Applications/web2py.app/Contents/MacOS/web2py -a "" -i 
> 0.0.0.0 -p 8000 -d /var/run/web2py.pid & } StopService( ) { ConsoleMessage 
> "Stopping web2py" kill `cat /var/run/web2py.pid` } RestartService( ) { 
> ConsoleMessage "Restarting web2py" StopService StartService } RunService 
> "$1"
>

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


[web2py] Re: Please: A simple template for accessing the same db from web2py and standalone

2017-08-14 Thread 'jim kaubisch' via web2py-users
Anthony,

Thank you VERY much for reply.

Out of it I take that 

(1) unless one is dealing with a pretty basic db, almost inevitably one 
starts including web2py specific pieces that make sharing considerably more 
complicated than just "from gluon import DAL, Field" :(  In my case, 
besides record versioning, validators etc.  there's a trivial example - I 
specify the path to the uploads folder as relative to "request.folder"  :)

(2) As you say, unless there really is a very strong argument for stepping 
outside the web2py environment, it really is just easier (and probably more 
future proof) to extend the app to include the formerly standalone 
functions (in a much extended modules directory) or, perhaps a separate 
web2py app e.g. where the db is shared but where the user populations are 
different. btw, how DOES one best share models between two web2py apps

Thanks again,
Jim

On Sunday, August 13, 2017 at 3:18:54 PM UTC-7, jim kaubisch wrote:
>
> I have good reason to want to create a database using a web2py app, but 
> also access the db from a standalone app that does tons of data processing 
> but basically does not need/want any user interaction
> The web2py app makes sure all data is consistent, supports the user in 
> entering valid data, manages YouTube videos, and media maps on a website 
> etc - lots of reasons for an interactive app.
> The standalone app does LOTS of data processing on the definitions created 
> via the web2py app as well as other files. 
> Its interface (for non-tech people) is simply click on "Import", followed 
> by "Prepare" followed by "Deploy" - no UI wanted or needed (Logs are kept 
> of what happened)
>
> I’ve looked, but so far have not found a complete explanation of how to 
> access the same database both with web2py and standalone.
>
> 1. the book says;
>
> "
>  The web2py DAL can be used in a non-web2py environment via
> 1. from gluon import DAL, Field
> 2. # also consider: from gluon.validators import *
>"
>
>YET in the standalone, shouldn’t it be 
>
> from pydal import DAL, Field ?
>
> 2. Whichever I use, the db connection is made (good news) but, 
> next problem I hit is that when I import my db model definition into 
> the standalone, I get:
>
> NameError: "name 'T' is not defined"
> module body in dev.pyDAL_test.py at line 8
> import mfm_media_model
> module body in mfm_media_model.py at line 73
> Field('db_version',   'string' , label=T('DB Version')  , 
> writable=False),
>
> ... and there would be others once I got past this one
> I have found no explanation of how to access the definitions of T and 
> other helpers :(
>
> It would be really helpful to have even a simple template of how to 
> implement access to a common database defined in web2py and standalone.
> I’ve looked and haven’t found one.
>
> 1. what to include in the model imports to define the standalone db access?
> from gluon? or from pydal? import DAL, Field? Or does it even matter?
>
> 2. What to include to import the same table definitions on both 
> sides, 
>  including the helpers defined in the book for table 
> definitions?
>
> 3. What about the question of “migrate_enabled”. presumably 
>only set to True in one app? What are the gotchas, if any?
>
> 4. Is there anything else that’s required or, based on experience,
>wise to do include/exclude/avoid etc to make things work
>
> Apologies if I have missed someone's explanation or am not understanding 
> something so obvious that I should be embarrassed to be asking
>
> Thanks,
> Jim
>
>

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


[web2py] Please: A simple template for accessing the same db from web2py and standalone

2017-08-13 Thread 'jim kaubisch' via web2py-users
I have good reason to want to create a database using a web2py app, but 
also access the db from a standalone app that does tons of data processing 
but basically does not need/want any user interaction
The web2py app makes sure all data is consistent, supports the user in 
entering valid data, manages YouTube videos, and media maps on a website 
etc - lots of reasons for an interactive app.
The standalone app does LOTS of data processing on the definitions created 
via the web2py app as well as other files. 
Its interface (for non-tech people) is simply click on "Import", followed 
by "Prepare" followed by "Deploy" - no UI wanted or needed (Logs are kept 
of what happened)

I’ve looked, but so far have not found a complete explanation of how to 
access the same database both with web2py and standalone.

1. the book says;

"
 The web2py DAL can be used in a non-web2py environment via
1. from gluon import DAL, Field
2. # also consider: from gluon.validators import *
   "

   YET in the standalone, shouldn’t it be 

from pydal import DAL, Field ?

2. Whichever I use, the db connection is made (good news) but, 
next problem I hit is that when I import my db model definition into 
the standalone, I get:

NameError: "name 'T' is not defined"
module body in dev.pyDAL_test.py at line 8
import mfm_media_model
module body in mfm_media_model.py at line 73
Field('db_version',   'string' , label=T('DB Version')  , 
writable=False),

... and there would be others once I got past this one
I have found no explanation of how to access the definitions of T and 
other helpers :(

It would be really helpful to have even a simple template of how to 
implement access to a common database defined in web2py and standalone.
I’ve looked and haven’t found one.

1. what to include in the model imports to define the standalone db access?
from gluon? or from pydal? import DAL, Field? Or does it even matter?

2. What to include to import the same table definitions on both 
sides, 
 including the helpers defined in the book for table 
definitions?

3. What about the question of “migrate_enabled”. presumably 
   only set to True in one app? What are the gotchas, if any?

4. Is there anything else that’s required or, based on experience,
   wise to do include/exclude/avoid etc to make things work

Apologies if I have missed someone's explanation or am not understanding 
something so obvious that I should be embarrassed to be asking

Thanks,
Jim

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


[web2py] Re: redirect fails with only an error ticket from deep inside the framework

2017-08-09 Thread 'jim kaubisch' via web2py-users
Thanks to both of you. 
I saw that line in the error ticket but dismissed it since the web2py 
access worked, the driver "must be there". Dumb :(

installed pymysql and reran my little test and it did indeed connect but 
generated the following:

cursors.py:166: 

 Warning: (3090, u"Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. 
It will be removed in a future release.")
  result = self._query(query)

Does that look familiar? Something to take note of? Briefly ldid a search 
for it but found nothing

Thanks again
Jim

On Tuesday, August 8, 2017 at 8:14:39 PM UTC-7, Anthony wrote:
>
> Looks like you don't have a Python MySQL driver installed on your system. 
> It works in web2py because web2py includes pymysql in /gluon/contrib (but 
> /gluon/contrib is not part of sys.path when running a Python program 
> outside of the web2py context).
>
> Anthony
>
> On Tuesday, August 8, 2017 at 9:42:27 PM UTC-4, jim kaubisch wrote:
>>
>> I would have thought so, but it fails !!!  What am I missing?
>>
>> about as basic as can be - 
>> a plain 2-line vanilla python app  (with a running mysql db, created with 
>> the same  "db = DAL('mysql://root:password@localhost/mfm_curr_lib', 
>> pool_size = 10) "  and accessed happily by the web2py app)
>>
>> from pydal import DAL, Field
>>
>> db = DAL('mysql://root:password@localhost/mfm_curr_lib', pool_size = 10)
>>
>>
>>  … produces 
>>
>>
>> RuntimeError: 'Failure to connect, tried 5 times:\nTraceback (most recent 
>> call last):\n File "/Library/Python/2.7/site-packages/pydal/base.py", line 
>> 455, in __init__\n self._adapter = adapter(**kwargs)\n File 
>> "/Library/Python/2.7/site-packages/pydal/adapters/__init__.py", line 40, in 
>> __call__\n obj = super(AdapterMeta, cls).__call__(*args, **kwargs)\n File 
>> "/Library/Python/2.7/site-packages/pydal/adapters/base.py", line 373, in 
>> __init__\n super(SQLAdapter, self).__init__(*args, **kwargs)\n File 
>> "/Library/Python/2.7/site-packages/pydal/adapters/base.py", line 50, in 
>> __init__\n self.find_driver()\n File 
>> "/Library/Python/2.7/site-packages/pydal/adapters/base.py", line 101, in 
>> find_driver\n str(self.drivers))\nRuntimeError: No driver of supported ones 
>> (\'MySQLdb\', \'pymysql\', \'mysqlconnector\') is available\n'
>>
>> module body in mfm_media_model.py at line 63
>>
>> db = DAL('mysql://root:password@localhost:3306/mfm_curr_lib/', pool_size 
>> = 10)
>>
>> function __call__ in base.py at line 170
>>
>> obj = super(MetaDAL, cls).__call__(*args, **kwargs)
>>
>> function __init__ in base.py at line 475
>>
>> "Failure to connect, tried %d times:\n%s" % (attempts, tb)
>> On Tuesday, August 8, 2017 at 6:01:16 PM UTC-7, Anthony wrote:
>>>
>>> Sure, you can access the same database from multiple applications 
>>> (web2py or not).
>>>
>>> On Tuesday, August 8, 2017 at 6:29:30 PM UTC-4, jim kaubisch wrote:

 Thanks, I think you're right. But its working now, so I'll revisit it 
 once the delivery heat is off.

 Please, on the related topic of my other post, I'm I missing something 
 by thinking I should be able to access the SAME mysql db both from web2py 
 as well as a standard Python program, assuming the same version of DAL? 
 In fact, the web2py app creates the db and uses it fine, but the 
 standalone app claims it can't connect to it.

 I haven't tried it, but what about 2 web2py apps? Can they access the 
 same (mysql) db

 Thanks

 On Tuesday, August 8, 2017 at 12:56:23 PM UTC-7, Anthony wrote:
>
> As I was developing the app, I realized that I was writing basically 
>> the same code over and over and over, just with slight differences, e.g. 
>> the table name, the criteria, the fields I wanted to return and their 
>> display order...
>> so a couple of dictionaries to define (1) the tableviews criteria and 
>> (2) ordered list of fields to return and the core becomes a small 
>> parameterization of basically the same db query - 10s of lines of code.
>>
>
> Sounds like something you could handle by abstracting everything into 
> a special function and maybe using Python argument unpacking:
>
> db(db.table).select(*list_of_fields, **dictonary_of_named_arguments)
>
> Anthony
>


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


[web2py] Re: redirect fails with only an error ticket from deep inside the framework

2017-08-08 Thread 'jim kaubisch' via web2py-users
I would have thought so, but it fails !!!  What am I missing?

about as basic as can be - 
a plain 2-line vanilla python app  (with a running mysql db, created with 
the same  "db = DAL('mysql://root:password@localhost/mfm_curr_lib', 
pool_size = 10) "  and accessed happily by the web2py app)

from pydal import DAL, Field

db = DAL('mysql://root:password@localhost/mfm_curr_lib', pool_size = 10)


 … produces 


RuntimeError: 'Failure to connect, tried 5 times:\nTraceback (most recent 
call last):\n File "/Library/Python/2.7/site-packages/pydal/base.py", line 
455, in __init__\n self._adapter = adapter(**kwargs)\n File 
"/Library/Python/2.7/site-packages/pydal/adapters/__init__.py", line 40, in 
__call__\n obj = super(AdapterMeta, cls).__call__(*args, **kwargs)\n File 
"/Library/Python/2.7/site-packages/pydal/adapters/base.py", line 373, in 
__init__\n super(SQLAdapter, self).__init__(*args, **kwargs)\n File 
"/Library/Python/2.7/site-packages/pydal/adapters/base.py", line 50, in 
__init__\n self.find_driver()\n File 
"/Library/Python/2.7/site-packages/pydal/adapters/base.py", line 101, in 
find_driver\n str(self.drivers))\nRuntimeError: No driver of supported ones 
(\'MySQLdb\', \'pymysql\', \'mysqlconnector\') is available\n'

module body in mfm_media_model.py at line 63

db = DAL('mysql://root:password@localhost:3306/mfm_curr_lib/', pool_size = 
10)

function __call__ in base.py at line 170

obj = super(MetaDAL, cls).__call__(*args, **kwargs)

function __init__ in base.py at line 475

"Failure to connect, tried %d times:\n%s" % (attempts, tb)
On Tuesday, August 8, 2017 at 6:01:16 PM UTC-7, Anthony wrote:
>
> Sure, you can access the same database from multiple applications (web2py 
> or not).
>
> On Tuesday, August 8, 2017 at 6:29:30 PM UTC-4, jim kaubisch wrote:
>>
>> Thanks, I think you're right. But its working now, so I'll revisit it 
>> once the delivery heat is off.
>>
>> Please, on the related topic of my other post, I'm I missing something by 
>> thinking I should be able to access the SAME mysql db both from web2py as 
>> well as a standard Python program, assuming the same version of DAL? 
>> In fact, the web2py app creates the db and uses it fine, but the 
>> standalone app claims it can't connect to it.
>>
>> I haven't tried it, but what about 2 web2py apps? Can they access the 
>> same (mysql) db
>>
>> Thanks
>>
>> On Tuesday, August 8, 2017 at 12:56:23 PM UTC-7, Anthony wrote:
>>>
>>> As I was developing the app, I realized that I was writing basically the 
 same code over and over and over, just with slight differences, e.g. the 
 table name, the criteria, the fields I wanted to return and their display 
 order...
 so a couple of dictionaries to define (1) the tableviews criteria and 
 (2) ordered list of fields to return and the core becomes a small 
 parameterization of basically the same db query - 10s of lines of code.

>>>
>>> Sounds like something you could handle by abstracting everything into a 
>>> special function and maybe using Python argument unpacking:
>>>
>>> db(db.table).select(*list_of_fields, **dictonary_of_named_arguments)
>>>
>>> Anthony
>>>
>>

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


[web2py] Re: redirect fails with only an error ticket from deep inside the framework

2017-08-08 Thread 'jim kaubisch' via web2py-users


On Monday, August 7, 2017 at 4:29:30 PM UTC-7, jim kaubisch wrote:
>
> Hi,
>
> The following failure suddenly started in a piece of code thats been 
> running error free for months. I can think of nothing I’ve changed that 
> would cause this to happen (famous last words, I know).
> I've tried for hours to find something to explain this, without any 
> success 
> ANY ideas would be greatly appreciated. My hope is that people with a 
> deeper understanding of the web2py framework might have ideas..
>
> Thanks in advance!!
> Jim
> -
> The last moments of life are as follows..
>
> two variables, s and db_str,  are generated dynamically but end up having 
> values as follows...
>
> s= " 0)>"
> db_str = "s.select(db[media_table].id, db[media_table].name, 
> db[media_table].akaname, db[media_table].category)"
>
> try:
>session.media_list = eval(db_str)
> except Exception as e:
>logger.debug('This is what happened: %s' % e)
>raise
>
> logger.debug("redirecting...")
> redirect(URL('default', 'list_rows'))
>
> No exception thrown, 
> the debug message is displayed, 
> but it never gets to “list_rows” it seems (First line in list_rows is 
> another debug message
>
>
> instead, the following …
>
> Error ticket for "mfm_test"
> Ticket ID 
> 127.0.0.1.2017-08-07.15-22-39.88b049a9-c5f0-4b47-9aba-600839871461
> Version web2py™
> Version 2.14.6-stable+timestamp.2016.05.10.00.21.47
>
> Traceback
> 1.Traceback (most recent call last):
> 2.  File "/Users/jimkaubisch 1/Dropbox 
> (MFM)/MfMCurrAdmin/Development/web2py/start/gluon/main.py", line 438, in 
> wsgibase
> 3.session.connect(request, response)
> 4. File "/Users/jimkaubisch 1/Dropbox 
> (MFM)/MfMCurrAdmin/Development/web2py/start/gluon/globals.py", line 965, in 
> connect
> 5.   session_pickled = pickle.dumps(self, pickle.HIGHEST_PROTOCOL)
> 6. File "/Library/Python/2.7/site-packages/pydal/objects.py", line 2946, 
> in __getstate__
> 7.   del ret['fields']
> 8. KeyError: 'fields'
> 9.
>
> In file: Framework
> 1.
>
>

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


[web2py] Re: redirect fails with only an error ticket from deep inside the framework

2017-08-08 Thread 'jim kaubisch' via web2py-users
Thanks, I think you're right. But its working now, so I'll revisit it once 
the delivery heat is off.

Please, on the related topic of my other post, I'm I missing something by 
thinking I should be able to access the SAME mysql db both from web2py as 
well as a standard Python program, assuming the same version of DAL? 
In fact, the web2py app creates the db and uses it fine, but the standalone 
app claims it can't connect to it.

I haven't tried it, but what about 2 web2py apps? Can they access the same 
(mysql) db

Thanks

On Tuesday, August 8, 2017 at 12:56:23 PM UTC-7, Anthony wrote:
>
> As I was developing the app, I realized that I was writing basically the 
>> same code over and over and over, just with slight differences, e.g. the 
>> table name, the criteria, the fields I wanted to return and their display 
>> order...
>> so a couple of dictionaries to define (1) the tableviews criteria and (2) 
>> ordered list of fields to return and the core becomes a small 
>> parameterization of basically the same db query - 10s of lines of code.
>>
>
> Sounds like something you could handle by abstracting everything into a 
> special function and maybe using Python argument unpacking:
>
> db(db.table).select(*list_of_fields, **dictonary_of_named_arguments)
>
> Anthony
>

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


[web2py] Re: redirect fails with only an error ticket from deep inside the framework

2017-08-08 Thread 'jim kaubisch' via web2py-users

Anthony,

uninstalled pydal 17.07, installed 16.11 instead (seemed the most likely 
candidate for being the right version) - 
things now work normally! 

Thanks for the pointer to the problem



On Monday, August 7, 2017 at 4:29:30 PM UTC-7, jim kaubisch wrote:
>
> Hi,
>
> The following failure suddenly started in a piece of code thats been 
> running error free for months. I can think of nothing I’ve changed that 
> would cause this to happen (famous last words, I know).
> I've tried for hours to find something to explain this, without any 
> success 
> ANY ideas would be greatly appreciated. My hope is that people with a 
> deeper understanding of the web2py framework might have ideas..
>
> Thanks in advance!!
> Jim
> -
> The last moments of life are as follows..
>
> two variables, s and db_str,  are generated dynamically but end up having 
> values as follows...
>
> s= " 0)>"
> db_str = "s.select(db[media_table].id, db[media_table].name, 
> db[media_table].akaname, db[media_table].category)"
>
> try:
>session.media_list = eval(db_str)
> except Exception as e:
>logger.debug('This is what happened: %s' % e)
>raise
>
> logger.debug("redirecting...")
> redirect(URL('default', 'list_rows'))
>
> No exception thrown, 
> the debug message is displayed, 
> but it never gets to “list_rows” it seems (First line in list_rows is 
> another debug message
>
>
> instead, the following …
>
> Error ticket for "mfm_test"
> Ticket ID 
> 127.0.0.1.2017-08-07.15-22-39.88b049a9-c5f0-4b47-9aba-600839871461
> Version web2py™
> Version 2.14.6-stable+timestamp.2016.05.10.00.21.47
>
> Traceback
> 1.Traceback (most recent call last):
> 2.  File "/Users/jimkaubisch 1/Dropbox 
> (MFM)/MfMCurrAdmin/Development/web2py/start/gluon/main.py", line 438, in 
> wsgibase
> 3.session.connect(request, response)
> 4. File "/Users/jimkaubisch 1/Dropbox 
> (MFM)/MfMCurrAdmin/Development/web2py/start/gluon/globals.py", line 965, in 
> connect
> 5.   session_pickled = pickle.dumps(self, pickle.HIGHEST_PROTOCOL)
> 6. File "/Library/Python/2.7/site-packages/pydal/objects.py", line 2946, 
> in __getstate__
> 7.   del ret['fields']
> 8. KeyError: 'fields'
> 9.
>
> In file: Framework
> 1.
>
>

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


[web2py] Re: redirect fails with only an error ticket from deep inside the framework

2017-08-07 Thread 'jim kaubisch' via web2py-users
Thanks, Anthony!!

That's good news. Please, what IS the right version number and where do I 
get it it? GitHub I would guess. Haven't had a chance to investigate yet

As for the eval choice, firstly I realize it may not be truly the best 
solution and I realize there are risks involved (eval), but its been a 
godsend to me.

As I was developing the app, I realized that I was writing basically the 
same code over and over and over, just with slight differences, e.g. the 
table name, the criteria, the fields I wanted to return and their display 
order...
so a couple of dictionaries to define (1) the tableviews criteria and (2) 
ordered list of fields to return and the core becomes a small 
parameterization of basically the same db query - 10s of lines of code.
Need a different view on the data? retrieve different fields? different 
order to the display of the data? A couple of minutes to add menu and 
dictionary entries and *no change of code* and you're there :)
Saved a LOT of duplicate code and effort.

BTW, what I'm developing is an INTERNAL web APP to manage thousands of 
media files and curricula activities in a non-technical environment 
(non-profit teaching ~25k kids music in elementary schools). Its NOT a 
webSITE.
So I guess I'm less a bit less concerned with the risks associated with 
eval than I might otherwise might be.


On Monday, August 7, 2017 at 4:29:30 PM UTC-7, jim kaubisch wrote:
>
> Hi,
>
> The following failure suddenly started in a piece of code thats been 
> running error free for months. I can think of nothing I’ve changed that 
> would cause this to happen (famous last words, I know).
> I've tried for hours to find something to explain this, without any 
> success 
> ANY ideas would be greatly appreciated. My hope is that people with a 
> deeper understanding of the web2py framework might have ideas..
>
> Thanks in advance!!
> Jim
> -
> The last moments of life are as follows..
>
> two variables, s and db_str,  are generated dynamically but end up having 
> values as follows...
>
> s= " 0)>"
> db_str = "s.select(db[media_table].id, db[media_table].name, 
> db[media_table].akaname, db[media_table].category)"
>
> try:
>session.media_list = eval(db_str)
> except Exception as e:
>logger.debug('This is what happened: %s' % e)
>raise
>
> logger.debug("redirecting...")
> redirect(URL('default', 'list_rows'))
>
> No exception thrown, 
> the debug message is displayed, 
> but it never gets to “list_rows” it seems (First line in list_rows is 
> another debug message
>
>
> instead, the following …
>
> Error ticket for "mfm_test"
> Ticket ID 
> 127.0.0.1.2017-08-07.15-22-39.88b049a9-c5f0-4b47-9aba-600839871461
> Version web2py™
> Version 2.14.6-stable+timestamp.2016.05.10.00.21.47
>
> Traceback
> 1.Traceback (most recent call last):
> 2.  File "/Users/jimkaubisch 1/Dropbox 
> (MFM)/MfMCurrAdmin/Development/web2py/start/gluon/main.py", line 438, in 
> wsgibase
> 3.session.connect(request, response)
> 4. File "/Users/jimkaubisch 1/Dropbox 
> (MFM)/MfMCurrAdmin/Development/web2py/start/gluon/globals.py", line 965, in 
> connect
> 5.   session_pickled = pickle.dumps(self, pickle.HIGHEST_PROTOCOL)
> 6. File "/Library/Python/2.7/site-packages/pydal/objects.py", line 2946, 
> in __getstate__
> 7.   del ret['fields']
> 8. KeyError: 'fields'
> 9.
>
> In file: Framework
> 1.
>
>

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


[web2py] Re: redirect fails with only an error ticket from deep inside the framework

2017-08-07 Thread 'jim kaubisch' via web2py-users
Hi Anthony,

Yes, indeed :( 
In connection with my other post, I updated pydal in case my problem there 
could be fixed by updating pydal to the latest version. Didn't realize :(

I'm at a critical stage of my project so don't really want to upgrade to 
the new web2py version right now. 
I assume I can fix the issue by going back to the "correct" version of 
pydal for 2.14.6? If its still available?

Is there something I need to watch out for when I try?

Thanks


On Monday, August 7, 2017 at 4:29:30 PM UTC-7, jim kaubisch wrote:
>
> Hi,
>
> The following failure suddenly started in a piece of code thats been 
> running error free for months. I can think of nothing I’ve changed that 
> would cause this to happen (famous last words, I know).
> I've tried for hours to find something to explain this, without any 
> success 
> ANY ideas would be greatly appreciated. My hope is that people with a 
> deeper understanding of the web2py framework might have ideas..
>
> Thanks in advance!!
> Jim
> -
> The last moments of life are as follows..
>
> two variables, s and db_str,  are generated dynamically but end up having 
> values as follows...
>
> s= " 0)>"
> db_str = "s.select(db[media_table].id, db[media_table].name, 
> db[media_table].akaname, db[media_table].category)"
>
> try:
>session.media_list = eval(db_str)
> except Exception as e:
>logger.debug('This is what happened: %s' % e)
>raise
>
> logger.debug("redirecting...")
> redirect(URL('default', 'list_rows'))
>
> No exception thrown, 
> the debug message is displayed, 
> but it never gets to “list_rows” it seems (First line in list_rows is 
> another debug message
>
>
> instead, the following …
>
> Error ticket for "mfm_test"
> Ticket ID 
> 127.0.0.1.2017-08-07.15-22-39.88b049a9-c5f0-4b47-9aba-600839871461
> Version web2py™
> Version 2.14.6-stable+timestamp.2016.05.10.00.21.47
>
> Traceback
> 1.Traceback (most recent call last):
> 2.  File "/Users/jimkaubisch 1/Dropbox 
> (MFM)/MfMCurrAdmin/Development/web2py/start/gluon/main.py", line 438, in 
> wsgibase
> 3.session.connect(request, response)
> 4. File "/Users/jimkaubisch 1/Dropbox 
> (MFM)/MfMCurrAdmin/Development/web2py/start/gluon/globals.py", line 965, in 
> connect
> 5.   session_pickled = pickle.dumps(self, pickle.HIGHEST_PROTOCOL)
> 6. File "/Library/Python/2.7/site-packages/pydal/objects.py", line 2946, 
> in __getstate__
> 7.   del ret['fields']
> 8. KeyError: 'fields'
> 9.
>
> In file: Framework
> 1.
>
>

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


[web2py] redirect fails with only an error ticket from deep inside the framework

2017-08-07 Thread 'jim kaubisch' via web2py-users
Hi,

The following failure suddenly started in a piece of code thats been 
running error free for months. I can think of nothing I’ve changed that 
would cause this to happen (famous last words, I know).
I've tried for hours to find something to explain this, without any success 
ANY ideas would be greatly appreciated. My hope is that people with a 
deeper understanding of the web2py framework might have ideas..

Thanks in advance!!
Jim
-
The last moments of life are as follows..

two variables, s and db_str,  are generated dynamically but end up having 
values as follows...

s= " 0)>"
db_str = "s.select(db[media_table].id, db[media_table].name, 
db[media_table].akaname, db[media_table].category)"

try:
   session.media_list = eval(db_str)
except Exception as e:
   logger.debug('This is what happened: %s' % e)
   raise

logger.debug("redirecting...")
redirect(URL('default', 'list_rows'))

No exception thrown, 
the debug message is displayed, 
but it never gets to “list_rows” it seems (First line in list_rows is 
another debug message


instead, the following …

Error ticket for "mfm_test"
Ticket ID 127.0.0.1.2017-08-07.15-22-39.88b049a9-c5f0-4b47-9aba-600839871461
Version web2py™
Version 2.14.6-stable+timestamp.2016.05.10.00.21.47

Traceback
1.Traceback (most recent call last):
2.  File "/Users/jimkaubisch 1/Dropbox 
(MFM)/MfMCurrAdmin/Development/web2py/start/gluon/main.py", line 438, in 
wsgibase
3.session.connect(request, response)
4. File "/Users/jimkaubisch 1/Dropbox 
(MFM)/MfMCurrAdmin/Development/web2py/start/gluon/globals.py", line 965, in 
connect
5.   session_pickled = pickle.dumps(self, pickle.HIGHEST_PROTOCOL)
6. File "/Library/Python/2.7/site-packages/pydal/objects.py", line 2946, in 
__getstate__
7.   del ret['fields']
8. KeyError: 'fields'
9.

In file: Framework
1.

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


[web2py] ACCESSING THE SAME DAL DATABASE FROM WEB2PY AND "STAND-ALONE" APP

2017-08-04 Thread 'jim kaubisch' via web2py-users
 

Hi,


I am trying to access the same mysql database in a web2py app (which 
created it) AND from a “stand-alone” python app (which primarily extracts 
information from it). 


I can access the the db from the web_2py app but access from the 
stand-alone fails with “RuntimeError: 'Failure to connect, tried 5 times…” 


Both apps are running on the same (macOS Sierra) system


What am I doing wrong?


Note below, the database definition is in file “mfm_media_model.py”


###

IN THE WEB2PY APP

###


>>> in appconfig.ini:


; db configuration

[db]

uri   = mysql://root:password@localhost/mfm_curr_lib 

migrate   = true

pool_size = 10 ; ignored for sqlite


>>> in db.py:


db = DAL(myconf.get('db.uri'),

 pool_size=myconf.get('db.pool_size'),

 migrate_enabled=myconf.get('db.migrate'),

 lazy_tables=True,

 check_reserved=['all'])


!!! All works well !!!




IN THE STAND-ALONE APP:




>>> in mfm_media_model.py:


 from pydal import DAL, Field


 either

   db = DAL('mysql://root:password@localhost/mfm_curr_lib', pool_size = 
10)

 or

   db = DAL('mysql://root:password@localhost:3306/mfm_curr_lib', 
pool_size = 10)


 … produces 


RuntimeError: 'Failure to connect, tried 5 times:\nTraceback (most recent 
call last):\n File "/Library/Python/2.7/site-packages/pydal/base.py", line 
455, in __init__\n self._adapter = adapter(**kwargs)\n File 
"/Library/Python/2.7/site-packages/pydal/adapters/__init__.py", line 40, in 
__call__\n obj = super(AdapterMeta, cls).__call__(*args, **kwargs)\n File 
"/Library/Python/2.7/site-packages/pydal/adapters/base.py", line 373, in 
__init__\n super(SQLAdapter, self).__init__(*args, **kwargs)\n File 
"/Library/Python/2.7/site-packages/pydal/adapters/base.py", line 50, in 
__init__\n self.find_driver()\n File 
"/Library/Python/2.7/site-packages/pydal/adapters/base.py", line 101, in 
find_driver\n str(self.drivers))\nRuntimeError: No driver of supported ones 
(\'MySQLdb\', \'pymysql\', \'mysqlconnector\') is available\n'

module body in mfm_media_model.py at line 63

db = DAL('mysql://root:M4Msings@localhost:3306/mfm_curr_lib/', pool_size = 
10)

function __call__ in base.py at line 170

obj = super(MetaDAL, cls).__call__(*args, **kwargs)

function __init__ in base.py at line 475

"Failure to connect, tried %d times:\n%s" % (attempts, tb)

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


[web2py] Re: Archived records not being written to archive file

2017-06-17 Thread 'jim kaubisch' via web2py-users
Hi Anthony,

re. the .editable, in the initial period of getting familiar with web2py I 
read something somewhere that made me believe you could mark a whole table 
as (un)editable. 
Obviously wrong. I've deleted that code. Thanks for pointing it out.

re. the non-use of auth.archive, yes, I saw that in Chapter 9 and avoided 
it until I could not get what seemed the "right thing" to work and started 
experimenting in desperation.
I read the auth chapter section but walked away with the impression that 
the automatically created archive tables were not visible to my code unless 
I declared them as per chapter 7.
I was wrong but would suggest that clarification in the book would be 
helpful for people new to the platform.

I removed the declarations and, indeed (1) the archive records written and 
(2) the table are visible to my code.

This problem is solved for me. I doubt I'd ever have found it without your 
help.
Much thanks,

Jim


On Thursday, June 15, 2017 at 8:06:57 PM UTC-7, jim kaubisch wrote:
>
> Hi,
>
>
> I’m stuck. Have looked at all documentation/discussion groups I think, but 
> the following just doesn’t write records to an archive file
>
> I’ve been struggling with this for a while now, so help would be VERY 
> appreciated. 
>
>
> The environment is MacOS 10.12.5,, Python 2.7, Web2py 2.14.6, MySQL  5.7
>
>
> Thanks
>
>
>
> the intent here is to enable record versioning, update a record, and 
> archive the previous record version in an archive file
>
>
> With the following code snippets, the form, if invoked after a record in a 
> table has been selected, updates the record
>
>- successful in the update i.e. the mediatitles record is correctly 
> updated
>
>- fails in the archive i.e. the old record is NOT written to the 
> mediatitles_archive table
>
>
> #
>
> # define database
>
> #
>
> standard db.py except for:
>
>
>- auth.define_tables(username=False, signature=True)
>
>- db._common_fields.append(auth.signature)
>
>
> … lots of tables defined
>
>
> auth.enable_record_versioning(db,
>
>   archive_db=None,
>
>   
> archive_names='%(tablename)s_archive',
>
>   
> current_record='current_record')
>
>
>  #
>
>  # - build form -
>
>  #
>
> in the controller,
>
>
> titles_form = SQLFORM.factory(
>
>Field('name' , 'string' , label=T('Unique Full Name'),  
> requires 
> =IS_NOT_EMPTY()),
>
>Field('akaname', 'string' , label=T('Display Name'), default = 
> None),
>
>Field('used_in'  , 'list:string', label=T('Used In'), requires= 
> IS_IN_SET( [ ('cur' ,'Curriculum'),  ('sup' ,'Supplemental Media'), ('tng' 
> ,'Training Media'), ('adm' ,'Administrative Media'),  ('dev' 
> ,'Development') ], multiple=True)),
>
>Field('videos','list:string', label=T('Video(s)'), requires = 
> IS_IN_DB(db, 'videos.id', '%(name)s', multiple=True)),
>
>Field('audios','list:string', label=T('Audio(s)'), requires = 
> IS_IN_DB(db, 'audios.id', '%(name)s', multiple=True)),
>
>Field('scores','list:string', label=T('Score(s)'), requires = 
> IS_IN_DB(db, 'scores.id', '%(name)s', multiple=True)),
>
>Field('tags'   ,'list:string', label=T('Tag(s)')   ,  requires 
> = IS_IN_DB(db, 'tags.id’   , '%(name)s', multiple=True)),
>
>table_name='titles_form_table')
>
> titles_form.add_button('Cancel', URL('list_rows'))
>
>
> #
>
> # if record update request
>
> #
>
> record_id = int(request.vars.record_id)
>
> the_record = db(db.mediatitles.id == record_id).select().first()
>
>
> …
>
>
> #
>
> # - process form -
>
> #
>
> if titles_form.process(onsuccess=auth.archive).accepted:
>
> the_record.update_record(name=titles_form.vars.name, 
>
>
> akaname=titles_form.vars.akaname, 
>
>
> used_in=titles_form.vars.used_in)
>
>
> # fix link tables for the many-to-many relationships
>
> #  old-new could be an overlapping list of values 
>
> # e.g. videos
>
> del_list = list(Set(save_video_vals) - Set(titles_form.vars.videos))
>
> add_list = list(Set(titles_form.vars.videos) - Set(save_video_vals))
>
>
> for next in add_list:
>
> db.videos_mediatitles.insert(mediatitle_id=record_id, video_id=next)
>
> for next in del_list:
>
> db((db.videos_mediatitles.mediatitle_id==record_id) & 
> (db.videos_mediatitles.video_id==next)).delete()
>
> ...
>
>
> redirect(URL('default', 'list_all_rows'))
>
>
>
>

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

[web2py] Re: Archived records not being written to archive file

2017-06-16 Thread 'jim kaubisch' via web2py-users
Hmmm, 

Chapter 7 of the book under "record versioning" says:

Should you wish to access the archive table you should define it in a model:

1
2
3

db.define_table('mytable_archive',
   Field('current_record', 'reference mytable'),
   db.mytable)


I want the option of looking into the Archive table (using 
db(query,ignore_common_filters=True).select() as per one of Massimo's 
postings), 
in order to, for example, run reports concerning the number and nature of 
changes, by whom over a period of time etc. - so I declared all the archive 
tables :( :(
Didn't want to have to go back later to include this capability and risk a 
failed db migration after the app goes live.

re. the ".editable" - lack of familiarity with what's going on. Was trying 
to protect against the potential of a form trying to edit the archive table 

Will need to ponder on this.

But at least I now know how to avoid the problem, though I'm not sure what 
the value is of a table which I can't access programmatically

Thanks for your help on this. I would never have found the problem !

Thanks, 
Jim

On Thursday, June 15, 2017 at 8:06:57 PM UTC-7, jim kaubisch wrote:
>
> Hi,
>
>
> I’m stuck. Have looked at all documentation/discussion groups I think, but 
> the following just doesn’t write records to an archive file
>
> I’ve been struggling with this for a while now, so help would be VERY 
> appreciated. 
>
>
> The environment is MacOS 10.12.5,, Python 2.7, Web2py 2.14.6, MySQL  5.7
>
>
> Thanks
>
>
>
> the intent here is to enable record versioning, update a record, and 
> archive the previous record version in an archive file
>
>
> With the following code snippets, the form, if invoked after a record in a 
> table has been selected, updates the record
>
>- successful in the update i.e. the mediatitles record is correctly 
> updated
>
>- fails in the archive i.e. the old record is NOT written to the 
> mediatitles_archive table
>
>
> #
>
> # define database
>
> #
>
> standard db.py except for:
>
>
>- auth.define_tables(username=False, signature=True)
>
>- db._common_fields.append(auth.signature)
>
>
> … lots of tables defined
>
>
> auth.enable_record_versioning(db,
>
>   archive_db=None,
>
>   
> archive_names='%(tablename)s_archive',
>
>   
> current_record='current_record')
>
>
>  #
>
>  # - build form -
>
>  #
>
> in the controller,
>
>
> titles_form = SQLFORM.factory(
>
>Field('name' , 'string' , label=T('Unique Full Name'),  
> requires 
> =IS_NOT_EMPTY()),
>
>Field('akaname', 'string' , label=T('Display Name'), default = 
> None),
>
>Field('used_in'  , 'list:string', label=T('Used In'), requires= 
> IS_IN_SET( [ ('cur' ,'Curriculum'),  ('sup' ,'Supplemental Media'), ('tng' 
> ,'Training Media'), ('adm' ,'Administrative Media'),  ('dev' 
> ,'Development') ], multiple=True)),
>
>Field('videos','list:string', label=T('Video(s)'), requires = 
> IS_IN_DB(db, 'videos.id', '%(name)s', multiple=True)),
>
>Field('audios','list:string', label=T('Audio(s)'), requires = 
> IS_IN_DB(db, 'audios.id', '%(name)s', multiple=True)),
>
>Field('scores','list:string', label=T('Score(s)'), requires = 
> IS_IN_DB(db, 'scores.id', '%(name)s', multiple=True)),
>
>Field('tags'   ,'list:string', label=T('Tag(s)')   ,  requires 
> = IS_IN_DB(db, 'tags.id’   , '%(name)s', multiple=True)),
>
>table_name='titles_form_table')
>
> titles_form.add_button('Cancel', URL('list_rows'))
>
>
> #
>
> # if record update request
>
> #
>
> record_id = int(request.vars.record_id)
>
> the_record = db(db.mediatitles.id == record_id).select().first()
>
>
> …
>
>
> #
>
> # - process form -
>
> #
>
> if titles_form.process(onsuccess=auth.archive).accepted:
>
> the_record.update_record(name=titles_form.vars.name, 
>
>
> akaname=titles_form.vars.akaname, 
>
>
> used_in=titles_form.vars.used_in)
>
>
> # fix link tables for the many-to-many relationships
>
> #  old-new could be an overlapping list of values 
>
> # e.g. videos
>
> del_list = list(Set(save_video_vals) - Set(titles_form.vars.videos))
>
> add_list = list(Set(titles_form.vars.videos) - Set(save_video_vals))
>
>
> for next in add_list:
>
> db.videos_mediatitles.insert(mediatitle_id=record_id, video_id=next)
>
> for next in del_list:
>
> db((db.videos_mediatitles.mediatitle_id==record_id) & 
> (db.videos_mediatitles.video_id==next)).delete()
>
> ...
>
>
> redirect(URL('default', 'list_all_rows'))
>
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 

[web2py] Re: Archived records not being written to archive file

2017-06-16 Thread 'jim kaubisch' via web2py-users
The auth.archive was an act of desperation - in case I had misinterpreted 
something in the book. A last-minute addition. Lack of it off made no 
difference to the outcome.
I'll try to generate a minimum app, but there are so many layers to the 
original that it might be hard to reproduce more simply - I'll try

On Thursday, June 15, 2017 at 8:06:57 PM UTC-7, jim kaubisch wrote:
>
> Hi,
>
>
> I’m stuck. Have looked at all documentation/discussion groups I think, but 
> the following just doesn’t write records to an archive file
>
> I’ve been struggling with this for a while now, so help would be VERY 
> appreciated. 
>
>
> The environment is MacOS 10.12.5,, Python 2.7, Web2py 2.14.6, MySQL  5.7
>
>
> Thanks
>
>
>
> the intent here is to enable record versioning, update a record, and 
> archive the previous record version in an archive file
>
>
> With the following code snippets, the form, if invoked after a record in a 
> table has been selected, updates the record
>
>- successful in the update i.e. the mediatitles record is correctly 
> updated
>
>- fails in the archive i.e. the old record is NOT written to the 
> mediatitles_archive table
>
>
> #
>
> # define database
>
> #
>
> standard db.py except for:
>
>
>- auth.define_tables(username=False, signature=True)
>
>- db._common_fields.append(auth.signature)
>
>
> … lots of tables defined
>
>
> auth.enable_record_versioning(db,
>
>   archive_db=None,
>
>   
> archive_names='%(tablename)s_archive',
>
>   
> current_record='current_record')
>
>
>  #
>
>  # - build form -
>
>  #
>
> in the controller,
>
>
> titles_form = SQLFORM.factory(
>
>Field('name' , 'string' , label=T('Unique Full Name'),  
> requires 
> =IS_NOT_EMPTY()),
>
>Field('akaname', 'string' , label=T('Display Name'), default = 
> None),
>
>Field('used_in'  , 'list:string', label=T('Used In'), requires= 
> IS_IN_SET( [ ('cur' ,'Curriculum'),  ('sup' ,'Supplemental Media'), ('tng' 
> ,'Training Media'), ('adm' ,'Administrative Media'),  ('dev' 
> ,'Development') ], multiple=True)),
>
>Field('videos','list:string', label=T('Video(s)'), requires = 
> IS_IN_DB(db, 'videos.id', '%(name)s', multiple=True)),
>
>Field('audios','list:string', label=T('Audio(s)'), requires = 
> IS_IN_DB(db, 'audios.id', '%(name)s', multiple=True)),
>
>Field('scores','list:string', label=T('Score(s)'), requires = 
> IS_IN_DB(db, 'scores.id', '%(name)s', multiple=True)),
>
>Field('tags'   ,'list:string', label=T('Tag(s)')   ,  requires 
> = IS_IN_DB(db, 'tags.id’   , '%(name)s', multiple=True)),
>
>table_name='titles_form_table')
>
> titles_form.add_button('Cancel', URL('list_rows'))
>
>
> #
>
> # if record update request
>
> #
>
> record_id = int(request.vars.record_id)
>
> the_record = db(db.mediatitles.id == record_id).select().first()
>
>
> …
>
>
> #
>
> # - process form -
>
> #
>
> if titles_form.process(onsuccess=auth.archive).accepted:
>
> the_record.update_record(name=titles_form.vars.name, 
>
>
> akaname=titles_form.vars.akaname, 
>
>
> used_in=titles_form.vars.used_in)
>
>
> # fix link tables for the many-to-many relationships
>
> #  old-new could be an overlapping list of values 
>
> # e.g. videos
>
> del_list = list(Set(save_video_vals) - Set(titles_form.vars.videos))
>
> add_list = list(Set(titles_form.vars.videos) - Set(save_video_vals))
>
>
> for next in add_list:
>
> db.videos_mediatitles.insert(mediatitle_id=record_id, video_id=next)
>
> for next in del_list:
>
> db((db.videos_mediatitles.mediatitle_id==record_id) & 
> (db.videos_mediatitles.video_id==next)).delete()
>
> ...
>
>
> redirect(URL('default', 'list_all_rows'))
>
>
>
>

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


[web2py] Re: Archived records not being written to archive file

2017-06-15 Thread 'jim kaubisch' via web2py-users
Sorry, Anthony. Yes, I meant the MySQL archive tables (mediatitles_archive 
in this case). 

I'm looking at the table(s) using the command line MySQL console.  This is 
what it says:

...a couple of sample records from the mediatitles table (id 511 is an 
 updated record created after logging in as an alternate user - the akaname 
changed)

mysql> select * from mediatitles;

| id  | name| akaname  
| progress  | used_in | cnt| is_active | created_on  | 
created_by | modified_on | modified_by |

| 510 | I’m On My Way   | I’m On My Way
| p16021491 | |cur|   |  0 |T  | 2017-06-14 14:18:09 | 1   
   | 2017-06-14 14:18:09 | 1   |

| 511 | (#R43) Mary Had A Little Lamb   | #R43 - Mary Had A Little Lamb 
Anne 4 | p16021544 | |cur|   |  0 |T  | 2017-06-14 14:18:09 | 1 
 | 2017-06-15 10:17:19 | 2   |
 
...and the mediatitles  archive table - empty :(

mysql> select * from mediatitles_archive;

Empty set (0.00 sec)


mysql> 



On Thursday, June 15, 2017 at 8:09:36 PM UTC-7, Anthony wrote:
>
> What do you mean by archive "file" -- archived records are written to a 
> database table? How are you checking for the archived records?
>
> Anthony
>
> On Thursday, June 15, 2017 at 11:06:57 PM UTC-4, jim kaubisch wrote:
>>
>> Hi,
>>
>>
>> I’m stuck. Have looked at all documentation/discussion groups I think, 
>> but the following just doesn’t write records to an archive file
>>
>> I’ve been struggling with this for a while now, so help would be VERY 
>> appreciated. 
>>
>>
>> The environment is MacOS 10.12.5,, Python 2.7, Web2py 2.14.6, MySQL  5.7
>>
>>
>> Thanks
>>
>>
>>
>> the intent here is to enable record versioning, update a record, and 
>> archive the previous record version in an archive file
>>
>>
>> With the following code snippets, the form, if invoked after a record in 
>> a table has been selected, updates the record
>>
>>- successful in the update i.e. the mediatitles record is correctly 
>> updated
>>
>>- fails in the archive i.e. the old record is NOT written to the 
>> mediatitles_archive table
>>
>>
>> #
>>
>> # define database
>>
>> #
>>
>> standard db.py except for:
>>
>>
>>- auth.define_tables(username=False, signature=True)
>>
>>- db._common_fields.append(auth.signature)
>>
>>
>> … lots of tables defined
>>
>>
>> auth.enable_record_versioning(db,
>>
>>   archive_db=None,
>>
>>   
>> archive_names='%(tablename)s_archive',
>>
>>   
>> current_record='current_record')
>>
>>
>>  #
>>
>>  # - build form -
>>
>>  #
>>
>> in the controller,
>>
>>
>> titles_form = SQLFORM.factory(
>>
>>Field('name' , 'string' , label=T('Unique Full Name'),  
>> requires 
>> =IS_NOT_EMPTY()),
>>
>>Field('akaname', 'string' , label=T('Display Name'), default 
>> = None),
>>
>>Field('used_in'  , 'list:string', label=T('Used In'), requires= 
>> IS_IN_SET( [ ('cur' ,'Curriculum'),  ('sup' ,'Supplemental Media'), ('tng' 
>> ,'Training Media'), ('adm' ,'Administrative Media'),  ('dev' 
>> ,'Development') ], multiple=True)),
>>
>>Field('videos','list:string', label=T('Video(s)'), requires = 
>> IS_IN_DB(db, 'videos.id', '%(name)s', multiple=True)),
>>
>>Field('audios','list:string', label=T('Audio(s)'), requires = 
>> IS_IN_DB(db, 'audios.id', '%(name)s', multiple=True)),
>>
>>Field('scores','list:string', label=T('Score(s)'), requires = 
>> IS_IN_DB(db, 'scores.id', '%(name)s', multiple=True)),
>>
>>Field('tags'   ,'list:string', label=T('Tag(s)')   ,  requires 
>> = IS_IN_DB(db, 'tags.id’   , '%(name)s', multiple=True)),
>>
>>table_name='titles_form_table')
>>
>> titles_form.add_button('Cancel', URL('list_rows'))
>>
>>
>> #
>>
>> # if record update request
>>
>> #
>>
>> record_id = int(request.vars.record_id)
>>
>> the_record = db(db.mediatitles.id == record_id).select().first()
>>
>>
>> …
>>
>>
>> #
>>
>> # - process form -
>>
>> #
>>
>> if titles_form.process(onsuccess=auth.archive).accepted:
>>
>> the_record.update_record(name=titles_form.vars.name, 
>>
>>
>> akaname=titles_form.vars.akaname, 
>>
>>
>> used_in=titles_form.vars.used_in)
>>
>>
>> # fix link tables for the many-to-many relationships
>>
>> #  old-new could be an overlapping list of values 
>>
>> # e.g. videos
>>
>> del_list = list(Set(save_video_vals) - Set(titles_form.vars.videos))
>>
>> add_list = list(Set(titles_form.vars.videos) - Set(save_video_vals))
>>
>>
>> for next in add_list:
>>
>> db.videos_mediatitles.insert(mediatitle_id=record_id, video_id=next)
>>
>> for next in del_list:
>>
>> db((db.videos_mediatitles.mediatitle_id==record_id) & 
>> 

[web2py] Archived records not being written to archive file

2017-06-15 Thread 'jim kaubisch' via web2py-users
 

Hi,


I’m stuck. Have looked at all documentation/discussion groups I think, but 
the following just doesn’t write records to an archive file

I’ve been struggling with this for a while now, so help would be VERY 
appreciated. 


The environment is MacOS 10.12.5,, Python 2.7, Web2py 2.14.6, MySQL  5.7


Thanks



the intent here is to enable record versioning, update a record, and 
archive the previous record version in an archive file


With the following code snippets, the form, if invoked after a record in a 
table has been selected, updates the record

   - successful in the update i.e. the mediatitles record is correctly 
updated

   - fails in the archive i.e. the old record is NOT written to the 
mediatitles_archive table


#

# define database

#

standard db.py except for:


   - auth.define_tables(username=False, signature=True)

   - db._common_fields.append(auth.signature)


… lots of tables defined


auth.enable_record_versioning(db,

  archive_db=None,

  
archive_names='%(tablename)s_archive',

  
current_record='current_record')


 #

 # - build form -

 #

in the controller,


titles_form = SQLFORM.factory(

   Field('name' , 'string' , label=T('Unique Full Name'),  requires 
=IS_NOT_EMPTY()),

   Field('akaname', 'string' , label=T('Display Name'), default = 
None),

   Field('used_in'  , 'list:string', label=T('Used In'), requires= 
IS_IN_SET( [ ('cur' ,'Curriculum'),  ('sup' ,'Supplemental Media'), ('tng' 
,'Training Media'), ('adm' ,'Administrative Media'),  ('dev' ,'Development')
 ], multiple=True)),

   Field('videos','list:string', label=T('Video(s)'), requires = 
IS_IN_DB(db, 'videos.id', '%(name)s', multiple=True)),

   Field('audios','list:string', label=T('Audio(s)'), requires = 
IS_IN_DB(db, 'audios.id', '%(name)s', multiple=True)),

   Field('scores','list:string', label=T('Score(s)'), requires = 
IS_IN_DB(db, 'scores.id', '%(name)s', multiple=True)),

   Field('tags'   ,'list:string', label=T('Tag(s)')   ,  requires = 
IS_IN_DB(db, 'tags.id’   , '%(name)s', multiple=True)),

   table_name='titles_form_table')

titles_form.add_button('Cancel', URL('list_rows'))


#

# if record update request

#

record_id = int(request.vars.record_id)

the_record = db(db.mediatitles.id == record_id).select().first()


…


#

# - process form -

#

if titles_form.process(onsuccess=auth.archive).accepted:

the_record.update_record(name=titles_form.vars.name, 

   
akaname=titles_form.vars.akaname, 

   
used_in=titles_form.vars.used_in)


# fix link tables for the many-to-many relationships

#  old-new could be an overlapping list of values 

# e.g. videos

del_list = list(Set(save_video_vals) - Set(titles_form.vars.videos))

add_list = list(Set(titles_form.vars.videos) - Set(save_video_vals))


for next in add_list:

db.videos_mediatitles.insert(mediatitle_id=record_id, video_id=next)

for next in del_list:

db((db.videos_mediatitles.mediatitle_id==record_id) & 
(db.videos_mediatitles.video_id==next)).delete()

...


redirect(URL('default', 'list_all_rows'))



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