Re: [web2py] Re: OperationalError when using datetime

2018-07-19 Thread Maurice Waka
Team, Anthony, thanks so much for the help.
Anthony, I believe, I've mentioned this before, in previous questions about
the other apps. You've helped me a lot and I appreciate very much. The
current issue is that, I am developing a system of q&a with the aim of
storing the questions for future machine learning purposes. That once a
user inputs a query, the question is stored in post (in storage.sqlite),
but at the same time, that question will be processed by other functions
and a reply send back to the user I want to retrieve that question to the
controller or modules for processing.
This is the controller code:
@mobilize
@auth.requires_login()
def view_searches():
if db(db.post).isempty():
"""If the  db is completely deleted then we get an error as the
iteration is over an empty table."""
db.post.insert(message="Well_hest")# well_hest is an internal
keyword/trigger word
dt=request.now
row = db(db.post.author== auth.user.id).select(db.post.ALL,
orderby=~db.post.created_on, limitby=(0,1)).first()
reports = row.message if row else None
return dict(reports=reports)
@mobilize
@auth.requires_login()
def search():
form = SQLFORM(db.post).process()
if form.accepts(request, formname=None):
return DIV("Message posted")
elif form.errors:
return TABLE(*[TR(k, v) for k, v in form.errors.items()])
return dict()

This is the html view:
{{extend "layout.html"}}



convForm - example


https://fonts.googleapis.com/css?family=Roboto";
rel="stylesheet">

https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css";
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
crossorigin="anonymous">













Yes
Sure!

















var rollbackTo = false;
var originalState = false;
function storeState(stateWrapper) {
rollbackTo = stateWrapper.current;
console.log("storeState called: ",rollbackTo);
}
function rollback(stateWrapper) {
console.log("rollback called: ", rollbackTo, originalState);
console.log("answers at the time of user input: ",
stateWrapper.answers);
if(rollbackTo!=false) {
if(originalState==false) {
originalState = stateWrapper.current.next;
console.log('stored original state');
}
stateWrapper.current.next = rollbackTo;
console.log('changed current.next to rollbackTo');
}
}
function restore(stateWrapper) {
if(originalState != false) {
stateWrapper.current.next = originalState;
console.log('changed current.next to originalState');
}
}
jQuery('#myform').submit(function() {
ajax('{{=URL('search')}}', '#myform', 'target');
return false;
});



With the code above, see the images attached.
You'll note that if I post a query like: 'testing 123' it will be posted to
the post table as shown in the image. But retrieving it back to the
controller, just for the purpose of retrieving what is posted, I get
'maurice' which is a previous post instead.
This is my biggest headache. That is why i tried getting a way to refresh
the Db, or using request.now (thinking that it will get the response with
current time)

On Thu, Jul 19, 2018 at 5:30 AM Anthony  wrote:

> On Wednesday, July 18, 2018 at 1:08:24 AM UTC-4, Maurice Waka wrote:
>>
>> I have two problems;
>>
>>1. When I successfully submit a form and try to retrieve the text for
>>processing in the controller, I tend to get the previously submitted text
>>and not the latest.
>>
>> What do you mean by this? What is the exact workflow, and what does your
> code look like? When a form is submitted, the controller action that
> handles the submission has access to the current submission (not the
> previous one).
>
>
>> def retrieve():
>> dt=request.now
>> row = db(db.post.author== auth.user.id).select(db.post.ALL, orderby=~
>> db.post.created_on == dt, limitby=(0,1)).first()
>>
>
> The above is not a valid "orderby" -- it must just be a field, not a
> query. There is no need for matching anything on request.now, and any
> inserts made during the current request would not match request.now
> exactly, as request.now is calculated before any of your app code 

Re: [web2py] Re: OperationalError when using datetime

2018-07-19 Thread Maurice Waka
Some more info, this is the module code:
Post = db.define_table('post',
   Field('author', 'reference auth_user',
default=auth.user_id, writable=False, readable=False),
   Field('message', 'text', requires=IS_NOT_EMPTY(),
 notnull=False, ),
   auth.signature
   )

On Thu, Jul 19, 2018 at 5:30 AM Anthony  wrote:

> On Wednesday, July 18, 2018 at 1:08:24 AM UTC-4, Maurice Waka wrote:
>>
>> I have two problems;
>>
>>1. When I successfully submit a form and try to retrieve the text for
>>processing in the controller, I tend to get the previously submitted text
>>and not the latest.
>>
>> What do you mean by this? What is the exact workflow, and what does your
> code look like? When a form is submitted, the controller action that
> handles the submission has access to the current submission (not the
> previous one).
>
>
>> def retrieve():
>> dt=request.now
>> row = db(db.post.author== auth.user.id).select(db.post.ALL, orderby=~
>> db.post.created_on == dt, limitby=(0,1)).first()
>>
>
> The above is not a valid "orderby" -- it must just be a field, not a
> query. There is no need for matching anything on request.now, and any
> inserts made during the current request would not match request.now
> exactly, as request.now is calculated before any of your app code runs (and
> therefore before any inserts can happen). Just order by created_on
> (descending) and take the first record. Anyway, this may not be what you
> really want -- if you're trying to get a given record right after it was
> inserted, this approach could lead to a race condition, as another record
> could be inserted before you do the read.
>
> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/nvgzq49Z9kA/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [web2py] Re: OperationalError when using datetime

2018-07-19 Thread Dave S


On Thursday, July 19, 2018 at 12:56:37 AM UTC-7, Maurice Waka wrote:
>
> Team, Anthony, thanks so much for the help.
> Anthony, I believe, I've mentioned this before, in previous questions 
> about the other apps. You've helped me a lot and I appreciate very much. 
> The current issue is that, I am developing a system of q&a with the aim of 
> storing the questions for future machine learning purposes. That once a 
> user inputs a query, the question is stored in post (in storage.sqlite), 
> but at the same time, that question will be processed by other functions 
> and a reply send back to the user I want to retrieve that question to the 
> controller or modules for processing.
> This is the controller code:
>

The controller code isn't too complicated, aside from the order-by 
problems, but I get lost in the html file.

SQLFORM will tell you the id of the record inserted
http://web2py.com/books/default/chapter/29/07/forms-and-validators#SQLFORM-and-insert-update-delete>
and that id can be stored in a session variable your view_searches()function 
can use.   But I would consider making the SQLFORM the primary page content 
in a conventional web2py view, and using the LOAD() helper function to 
update the view area.
http://web2py.com/books/default/chapter/29/12/components-and-plugins#LOAD>

/dps

 

> @mobilize
> @auth.requires_login()
> def view_searches():
> if db(db.post).isempty():
> """If the  db is completely deleted then we get an error as the 
> iteration is over an empty table."""
> db.post.insert(message="Well_hest")# well_hest is an internal 
> keyword/trigger word
> dt=request.now
> row = db(db.post.author== auth.user.id).select(db.post.ALL, 
> orderby=~db.post.created_on, limitby=(0,1)).first()
> reports = row.message if row else None
> return dict(reports=reports)
> @mobilize
> @auth.requires_login()
> def search():
> form = SQLFORM(db.post).process()
> if form.accepts(request, formname=None):
> return DIV("Message posted")
> elif form.errors:
> return TABLE(*[TR(k, v) for k, v in form.errors.items()])
> return dict()
>
> This is the html view:
> {{extend "layout.html"}}
> 
> 
> 
> convForm - example
> 
> 
> https://fonts.googleapis.com/css?family=Roboto"; 
> rel="stylesheet">
>  rel="stylesheet" type="text/css" />
> https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"; 
> integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
>  
> crossorigin="anonymous">
>  type="text/css" />
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>  enctype="multipart/form-data" method="post" id="myform" class="hidden">
> 
> Yes
> Sure!
> 
>  id="message" data-conv-question="Alright! First, tell me your full name, 
> please.|Okay! Please, tell me your name first.">
>  data-conv-question="{{=reports}}" data-no-answer="true">
> 
> 
> 
> 
> 
> 
> 
> 
> 
>  type="text/javascript">
>  type="text/javascript">
>  type="text/javascript">
>
> 
> var rollbackTo = false;
> var originalState = false;
> function storeState(stateWrapper) {
> rollbackTo = stateWrapper.current;
> console.log("storeState called: ",rollbackTo);
> }
> function rollback(stateWrapper) {
> console.log("rollback called: ", rollbackTo, originalState);
> console.log("answers at the time of user input: ", 
> stateWrapper.answers);
> if(rollbackTo!=false) {
> if(originalState==false) {
> originalState = stateWrapper.current.next;
> console.log('stored original state');
> }
> stateWrapper.current.next = rollbackTo;
> console.log('changed current.next to rollbackTo');
> }
> }
> function restore(stateWrapper) {
> if(originalState != false) {
> stateWrapper.current.next = originalState;
> console.log('changed current.next to originalState');
> }
> }
> jQuery('#myform').submit(function() {
> ajax('{{=URL('search')}}', '#myform', 'target');
> return false;
> });
> 
> 
> 
> With the code above, see the images attached. 
> You'll note that if I post a query like: 'testing 123' it will be posted 
> to the post table as shown in the image. But retrieving it back to the 
> co

[web2py] Re: BaseException: domain not in config []

2018-07-19 Thread Valdeck Rowe
Thanks very much - really appreciative.

Lesson: It helps to calmly work through things, regardless of external 
pressure

On Wednesday, July 18, 2018 at 9:21:36 PM UTC-5, Anthony wrote:
>
> You're view has this line:
>
> if host_name in myconf.take('domain.name'):
>
> But as the traceback indicated, there is no "domain" section in the 
> configuration file.
>
> Anthony
>
> On Wednesday, July 18, 2018 at 6:08:14 PM UTC-4, Valdeck Rowe wrote:
>>
>> Here is the entire user.html file just in case it proves helpful:
>>
>> {{#extend 'layout.html'}}
>> https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"; 
>> integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
>>  
>> crossorigin="anonymous">
>>
>> 
>> #web2py_user_form {
>>   margin-top: 15vh;
>> }
>> #web2py_user_form img{
>>   -webkit-box-shadow: outset 0 1px 1px rgba(0,0,0,.05);
>>   box-shadow: outset 0 1px 1px rgba(0,0,0,.05);
>> }
>> 
>>
>> {{
>> host_name = str(request.env.http_host)
>> host_name.replace(request.env.server_port, '')
>> }}
>> {{
>> if host_name in myconf.take('domain.name'):
>> redirect(URL(
>> 'set_team', 
>> 'group'))
>> pass
>> }}
>>
>> 
>> 
>> 
>> 
>> 
>> 
>> {{
>> if request.args(0)=='login':
>> if not 'register' in auth.settings.actions_disabled:
>> form.add_button(T('Sign Up'),URL(args='register', 
>> vars={'_next': request.vars._next} if request.vars._next else 
>> None),_class='btn btn-default')
>> pass
>> if not 'request_reset_password' in 
>> auth.settings.actions_disabled:
>> form.add_button(T('Lost 
>> Password'),URL(args='request_reset_password'),_class='btn btn-default')
>> pass
>> pass
>> =form
>> }}
>> 
>> 
>> 
>>
>>
>> {{block page_js}}
>> 
>> jQuery("#web2py_user_form input:visible:enabled:first").focus();
>> {{if request.args(0)=='register':}}
>> web2py_validate_entropy(jQuery('#auth_user_password'),100);
>> {{elif request.args(0)=='change_password':}}
>> web2py_validate_entropy(jQuery('#no_table_new_password'),100);
>> {{pass}}
>> 
>> {{end page_js}}
>>
>>
>> On Wednesday, July 18, 2018 at 4:31:38 PM UTC-5, Anthony wrote:
>>>
>>> We need to see your appconfig.ini and the line in user.html that is 
>>> presumably trying to access a setting from the config object. The error 
>>> indicates it's not finding what it's looking for.
>>
>>

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

2018-07-19 Thread Anthony
On Thursday, July 19, 2018 at 4:26:09 AM UTC-4, Lisandro wrote:
>
> Well, I owe you an apology, because I got confused regarding which app was 
> throwing the error and which web2py version was running. 
>
> Until recently, I was using a very old web2py version (2.10). This problem 
> was happening since long time ago (but not very frequently as I stated). 
> For that old web2py version, I had already applied the fix to my app:
>
> row.update_record(**data)
> row = db.content[row.id]
> row.update_tsv()
>

There must still be something else going on that we're not seeing. Even in 
web2py 2.10, there would have been no way to get the error in question, as 
the .update_record method could not turn a Row object into None.

I suppose the above code could generate this error if the record in 
question could be deleted in a separate HTTP request in between the 
execution of the first and second lines above. Is that possible (i.e., is 
there some other action that could be deleting existing records)?

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.


Re: [web2py] Re: OperationalError when using datetime

2018-07-19 Thread Anthony

>
> row = db(db.post.author== auth.user.id).select(db.post.ALL, 
> orderby=~db.post.created_on, limitby=(0,1)).first()
> reports = row.message if row else None
>

If you are only returning the "message" field, just select the 
db.post.message field, no need to use db.post.ALL.
 

> def search():
> form = SQLFORM(db.post).process()
> if form.accepts(request, formname=None):
>

You cannot call form.accepts after having called form.process, as the 
latter already calls the former for you.
 

> return DIV("Message posted")
> elif form.errors:
> return TABLE(*[TR(k, v) for k, v in form.errors.items()])
> return dict()
>

In all cases, you code will return an empty dict. If there is no associated 
view, you will get an error unless generic views have been enabled, in 
which case, you will get generic.html.

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: web2py internal error

2018-07-19 Thread Anthony
Googling that error message, it looks like it could have something to do 
with concurrency and the .pyc file for the module. Maybe confirm the module 
isn't corrupted, and remove its .pyc file.

Anthony

On Thursday, July 19, 2018 at 2:04:00 AM UTC-4, Dave S wrote:
>
>
>
> On Monday, July 16, 2018 at 3:18:34 PM UTC-7, Anthony wrote:
>>
>> On Monday, July 16, 2018 at 3:18:44 PM UTC-4, Peter Hendriks wrote:
>>>
>>> Ticket issued: 
>>> malta_advies/141.8.9.39.2018-07-16.13-01-34.2270ef94-db9a-47a5-8866-f081bdf9715f
>>>  
>>> 
>>>
>>> Since this morning the above I see when I type my website.
>>>
>>> for info : my website is https://www.malta-advies.nl
>>>
>>> With admin I can go into the admin, but not further then that. After 
>>> that clicking any link again the same ticket ... .
>>>
>>> Anyone experience with this one?
>>>
>>
>> When you click on the ticket link and then log into the admin app, what 
>> happens next? You can copy on of the error ticket files from your server 
>> (in the /errors folder) to a development machine and view it in admin on 
>> the development machine.
>>
>> Anthony 
>>
>
>
> Anthony --
>
> from a copy of the ticket that Peter forwarded to me, custom_importer is 
> barfing on the line in the model that says
>
> from gluon.contrib.login_methods.rpx_account import use_janrain
>
>
> (model file is 1_db.py, and appears to be pretty much like example db.py 
> files)
>
> Traceback (most recent call last): File 
> "/home/maltaadviesarrigo/web2py/gluon/restricted.py", line 227, in restricted
>  exec ccode in environment
>  File 
> "/home/maltaadviesarrigo/web2py/applications/malta_advies/models/1_db.py", 
> line 62, in 
>  from gluon.contrib.login_methods.rpx_account import use_janrain
>  File "/home/maltaadviesarrigo/web2py/gluon/custom_import.py", line 108, in 
> custom_importer
>  return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
> EOFError: EOF read where object expected
> Error snapshot 
> (EOF read where object expected)
>
>
>
>
> /dps
>
>

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


[web2py] Re: row.update_record() leaves row as None (only sometimes)

2018-07-19 Thread Lisandro
That was my first thought: in some cases, another request deletes the 
record right in the instant between the execution of the first and second 
line.
But I thought it wasn't possible because the function runs inside a db 
transaction. Or could it still happen? 

Another thought is that the row.id is removed or set to None by 
row.update_record(**data), so the next line would set row to None, thus 
triggering the error.
But I'm not sure how could that happen. I checked and the "data" dictionary 
hasn't got the "id" key (I mean, the id field isn't updated).

Anyway, what I'm going to do to catch the error is this:

row.update_record(**data)
if not row:
return response.json({'success':False})
row.update_tsv()

This way I'll avoid the error ticket for those few cases.
I guess I could also decompile a couple of apps and put a log line there, 
though I don't know exactly what to log.



El jueves, 19 de julio de 2018, 10:56:55 (UTC-3), Anthony escribió:
>
> On Thursday, July 19, 2018 at 4:26:09 AM UTC-4, Lisandro wrote:
>>
>> Well, I owe you an apology, because I got confused regarding which app 
>> was throwing the error and which web2py version was running. 
>>
>> Until recently, I was using a very old web2py version (2.10). This 
>> problem was happening since long time ago (but not very frequently as I 
>> stated). For that old web2py version, I had already applied the fix to my 
>> app:
>>
>> row.update_record(**data)
>> row = db.content[row.id]
>> row.update_tsv()
>>
>
> There must still be something else going on that we're not seeing. Even in 
> web2py 2.10, there would have been no way to get the error in question, as 
> the .update_record method could not turn a Row object into None.
>
> I suppose the above code could generate this error if the record in 
> question could be deleted in a separate HTTP request in between the 
> execution of the first and second lines above. Is that possible (i.e., is 
> there some other action that could be deleting existing records)?
>
> 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: row.update_record() leaves row as None (only sometimes)

2018-07-19 Thread Leonel Câmara
It should not be possible if your database has proper transactions like 
postgresql. If you're using something like mongodb then you're SOL.

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

2018-07-19 Thread Lisandro
Thanks Leonel.
I'm using PostgreSQL, so if that case isn't possible, then I think the 
problem could be in the second line, where the code retrieves the record 
using row.id:

row.update_record(**data)
row = db.content[row.id]  # the problem could be here
row.update_tsv()


Remember yesterday I realised the error is happening only in the apps 
running with the code above, and the error is in the third line (where 
apparently row is None). 
If I'm not wrong, that would mean the record wasn't retrieved. But as we 
know, the record exists (the previous line was executed successfully), so 
maybe row.id is None, therefor row ends up being None and causing the error 
at the third line. I can't say how could row.id end up being None, but I 
think that would be the problem here. I've just checked the code to see if 
the "id" field is updated or changed, but I didn't find anything regarding 
that. 

Anyway, in the next days I'll remove the fix to let only this code running:

row.update_record(**data)
row.update_tsv()

I think that is the proper and expected way.
If something goes wrong with that, I'll update this thread.

Once again I deeply thank you for your time and willingness to help!


P.S.: for the second time, I searched for a way to donate to web2py, but 
I've seen a post where you explain why you don't accept donations, so I'll 
try to contribute a bit more in the forum. What I have to offer is 
meaningless compared to what you bring to the forum, but I'll do my best.

El jueves, 19 de julio de 2018, 12:57:11 (UTC-3), Leonel Câmara escribió:
>
> It should not be possible if your database has proper transactions like 
> postgresql. If you're using something like mongodb then you're SOL.
>

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

2018-07-19 Thread Ari Lion BR Sp
That's awesome.

Em quarta-feira, 18 de julho de 2018 23:37:29 UTC-3, Anthony escreveu:
>
> Do you have tested python3?
>>
>
> Note, we do have passing tests, at least through Python 3.6: 
> https://travis-ci.org/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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] scheduler_worker table is not created

2018-07-19 Thread matt
Hi,

I'm trying to run a scheduler process but it fails on:

# python web2py.py -K appname
web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2018
Version 2.16.1-stable+timestamp.2017.11.13.23.50.07
Database drivers available: sqlite3, imaplib, pyodbc, pg8000
starting single-scheduler for "appname"...
ERROR:web2py.scheduler.appname-web2py-deploy-6cff4bdbf4-kz6h2#580:Error 
retrieving status
Traceback (most recent call last):
  File "/web2py/gluon/scheduler.py", line 1168, in send_heartbeat
mybackedstatus = db(sw.worker_name == self.worker_name).select().first()
  File "/usr/local/lib/python2.7/site-packages/pydal/objects.py", line 
2250, in select
return adapter.select(self.query, fields, attributes)
  File "/usr/local/lib/python2.7/site-packages/pydal/adapters/base.py", 
line 762, in select
return self._select_aux(sql, fields, attributes, colnames)
  File "/usr/local/lib/python2.7/site-packages/pydal/adapters/base.py", 
line 718, in _select_aux
rows = self._select_aux_execute(sql)
  File "/usr/local/lib/python2.7/site-packages/pydal/adapters/base.py", 
line 712, in _select_aux_execute
self.execute(sql)
  File "/usr/local/lib/python2.7/site-packages/pydal/adapters/__init__.py", 
line 67, in wrap
return f(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/pydal/adapters/base.py", 
line 412, in execute
rv = self.cursor.execute(command, *args[1:], **kwargs)
ProgrammingError: ('42S02', u"[42S02] [FreeTDS][SQL Server]Invalid object 
name 'scheduler_worker'. (208) (SQLExecDirectW)")

We're using MS SQL for main app storage and scheduler storage.

In the database, the scheduler_task table exists, but there are no other 
scheduler_* tables. In the databases/ directory there is a 
scheduler_task.table, but no other scheduler_*.table files.

The scheduler is instantiated from a module in models like this. I think 
this is pretty standard:
from gluon.scheduler import Scheduler
...snip...
scheduler = Scheduler(db, migrate=True)

Versions:
OS: Debian 9.4 in Docker
Python: 2.7.15
Web2Py: 2.16.1
PyDAL: 17.11

Could someone suggest some troubleshooting steps to figure out why the 
scheduler_worker table is not created?

Regards,
Matt

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

2018-07-19 Thread Anthony
On Thursday, July 19, 2018 at 11:25:28 AM UTC-4, Lisandro wrote:
>
> That was my first thought: in some cases, another request deletes the 
> record right in the instant between the execution of the first and second 
> line.
> But I thought it wasn't possible because the function runs inside a db 
> transaction. Or could it still happen?
>

Well, I guess since the record is updated via .update_record, it should 
remain locked until the transaction is complete (depending on the database).
 

> Another thought is that the row.id is removed or set to None by 
> row.update_record(**data), so the next line would set row to None, thus 
> triggering the error.
>

Or the update changes the "id" of the original record. But according to the 
code of .update_record, neither of those things can happen (not even in 
web2py 2.10), as the "id" field is explicitly excluded from being updated 
either in the database or in the Row object itself.

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: Why not to mention support to Python3 on the official sites main page?

2018-07-19 Thread Antonio Salazar
Last April I downloaded the latest official stable release (2017-11-14) and 
adjusted all my code for Python 3. Unfortunately, two serious bugs in the 
streamer and scheduler made return to Python 2.

Both bugs are fixed in Github, but I'm wary of trying it again until it's 
better tested on Python 3. Since no new stable release has been made in 
eight months, ad the current one still has those bugs, I get the impression 
it's not stable yet.


On Monday, July 16, 2018 at 7:55:01 AM UTC-5, Ari Lion BR Sp wrote:
>
> Hi,
>
> I wonder here why Python3 support is not mentioned at the official 
> web2py's website?
>
> It is a very important feature which was not enough publicized, in my 
> opinion.
> It would improove marketing for the framework at least at our Country, 
> Brazil.
> Peoples colective memory here tends to remeber web2py only suports python2.
>
>
> Thanks,
> Ari
>

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