[web2py] Some help with computed field in a query

2016-04-03 Thread Henk huisman
Could anyone show me how to build a query with a computed field that 
consists of a constant and a value of the ID of the records.
The constant is an URL and the value is the ID of the row.

I tried this (among several other attempts).

rowsb=db.executesql("SELECT 'dikke bmw' as caption, startdate as start, 
 '../rentals_manage/'+ %s  as url, FROM rentals;",as_dict = 
True,placeholders=('id',))

but that doesn't seem to be valid syntax...

the output is needed by Timeline which is actually a very nice widget 
http://www.simile-widgets.org/timeline/

Danki

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

2016-04-03 Thread António Ramos
I bought this course and it looks amazing..

https://pragmaticstudio.com/elm

Now my head is sooo confused.

2016-04-04 0:03 GMT+01:00 Leonel Câmara :

> I think elm looks pretty good actually. I'm wait and see on it because I
> have some resistance to learning yet another language.
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


[web2py] Re: OFF Topic - Cycle.js

2016-04-03 Thread Leonel Câmara
I think elm looks pretty good actually. I'm wait and see on it because I 
have some resistance to learning yet another language.

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

2016-04-03 Thread António Ramos
There goes react. i hate it by the way..

have you also tried elm???
Its also a functional reactive programing language
http://elm-lang.org/examples


2016-04-02 18:45 GMT+01:00 Massimo Di Pierro :

> I like it a lot better than React. I still prefer ractive.js and vue.js
>
>
> On Wednesday, 30 March 2016 06:43:53 UTC-5, Ramos wrote:
>>
>> Can i have some opinions on this new thing?
>>
>> http://cycle.js.org/
>>
>> thank you
>>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


[web2py] No module named __builtin__

2016-04-03 Thread icodk
I get 
 No module named __builtin__

when I copy application perfectly running on Windows  from web2py 2.12.3 to 
2.14.3.
Did the same with another application without a problem.
Any idea ?
Version
web2py™ Version 2.14.3-stable+timestamp.2016.03.26.23.02.02
Python Python 2.7.9: C:\Dev\web\web2py_win\web2py_2_14_3\web2py.exe 
(prefix: C:\Python27)Traceback

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

Traceback (most recent call last):
  File "C:\Dev\web\web2py_win\web2py_2_14_3\gluon\restricted.py", line 227, in 
restricted
exec ccode in environment
  File 
"C:/Dev/web/web2py_win/web2py_2_14_3/applications/napno/models/tables.py" 
, line 176, in 

format = '%(first_name)s'+' '+'%(last_name)s')
  File "C:\Dev\web\web2py_win\web2py_2_14_3\gluon\packages\dal\pydal\base.py", 
line 834, in define_table
table = self.lazy_define_table(tablename,*fields,**args)
  File "C:\Dev\web\web2py_win\web2py_2_14_3\gluon\packages\dal\pydal\base.py", 
line 873, in lazy_define_table
polymodel=polymodel)
  File 
"C:\Dev\web\web2py_win\web2py_2_14_3\gluon\packages\dal\pydal\adapters\base.py",
 line 500, in create_table
sql_fields_old = pickle.load(tfile)
  File "C:\Dev\web\web2py_win\web2py_2_14_3\gluon\custom_import.py", line 95, 
in custom_importer
return base_importer(pname, globals, locals, fromlist, level)
ImportError: No module named __builtin__


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

2016-04-03 Thread Pierre
Hi,

I try to manipulate a SQLFORM based on a list:integer field with 
form.elements but it doesn't work. If I add input fields via the + and - 
butttons they aren't reflected in the form object. whatever the number of 
 present in  the form  len( form.elements('li'))  is always 
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: What's this and how do I correct this?

2016-04-03 Thread Leonel Câmara
It's normal that you can't open appadmin if you have this problem, no one 
told you to open it anyway. Go to the databases folder, deleter files with 
.table extension, launch web2py with your app configured to do a fake 
migration.

Read the book section I linked.

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

2016-04-03 Thread Emmanuel Dsouza
I can't even open the appadmin now. They show eror tokens. Even edit option 
wasn;t there but managed to open it by editing the url of another app.

On Sunday, April 3, 2016 at 3:54:24 PM UTC+5:30, Leonel Câmara wrote:
>
> Erase your .table files in the databases folder and then do a fake 
> migration to generate them again.
>
> See
>
> http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Fixing-broken-migrations
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group 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] As I use web2py from source with some modules from my pc,will those module work on pythonanywhere?

2016-04-03 Thread Stephen Duisberg
For example, my app uses unirest which is working because I have installed 
unirest on my pc. Do I have to install it in the app module too or 
pythonanywhere has all sorts of python modules inbuilt?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group 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: @Anthony, can you please check what's wrong with the unirest module?

2016-04-03 Thread Stephen Duisberg
Thank you, it worked!

On Sunday, April 3, 2016 at 3:48:51 PM UTC+5:30, Leonel Câmara wrote:
>
> You are shadowing web2py's response in your code with a response from a 
> unirest call. Call it something else.
>

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

2016-04-03 Thread Leonel Câmara
Erase your .table files in the databases folder and then do a fake 
migration to generate them again.

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

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group 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: @Anthony, can you please check what's wrong with the unirest module?

2016-04-03 Thread Stephen Duisberg
Hi Leonel. Thanks, I didn't get you though . How is this wrong? What am I 
missing here?

response = 
unirest.post("https://voicerss-text-to-speech.p.mashape.com/?key=secret1;,
  headers={
"X-Mashape-Key": "secret2",
"Content-Type": "application/x-www-form-urlencoded"
  },
  params={
"c": "mp3",
"f": "8khz_8bit_mono",
"hl": "en-us",
"r": 0,
"src": "Hello, world!"
  }
)

On Sunday, April 3, 2016 at 3:48:51 PM UTC+5:30, Leonel Câmara wrote:
>
> You are shadowing web2py's response in your code with a response from a 
> unirest call. Call it something else.
>

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

2016-04-03 Thread Leonel Câmara
Instead of

response = unirest.post ...

Call it something other than just "response", for instance

response_post = unirest.post...

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

2016-04-03 Thread Emmanuel Dsouza
Yesterday my app was working fine. I didnt even insert anything to it.
What is this error? What do I do now? Not even appadmin is opening!

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group 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: @Anthony, can you please check what's wrong with the unirest module?

2016-04-03 Thread Leonel Câmara
You are shadowing web2py's response in your code with a response from a 
unirest call. Call it something else.

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

2016-04-03 Thread lucas
what could be their reason to get rid of a good function or feature?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group 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] @Anthony, can you please check what's wrong with the unirest module?

2016-04-03 Thread Stephen Duisberg
each time I use it for any purpose I get the same error as:


Traceback (most recent call last):
  File "C:\web2py\gluon\main.py", line 450, in wsgibase
serve_controller(request, response, session)
  File "C:\web2py\gluon\main.py", line 192, in serve_controller
run_view_in(response._view_environment)
  File "C:\web2py\gluon\compileapp.py", line 661, in run_view_in
view = environment['response'].view
AttributeError: 'UnirestResponse' object has no attribute 'view'

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

2016-04-03 Thread Dmitri Ermolaev
*wfastcgi.py for IIS and web2py*

воскресенье, 3 апреля 2016 г., 7:56:03 UTC+3 пользователь Dmitri Ermolaev 
написал:
>
> I do it! Its work:
> http://web2py.com/books/default/chapter/29/13/deployment-recipes#IIS
>
> IIS much quicker than Apache - Apache load a processor at 100% for AJAX 
> requests ((
>
> thanx
>
>
> вторник, 6 сентября 2011 г., 13:03:42 UTC+3 пользователь Hassan Alnatour 
> написал:
>>
>> how can i deploy web2py on IIS ??
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
# 
 #
 # Copyright (c) Microsoft Corporation. 
 #
 # This source code is subject to terms and conditions of the Apache License, Version 2.0. A 
 # copy of the license can be found in the License.html file at the root of this distribution. If 
 # you cannot locate the Apache License, Version 2.0, please send an email to 
 # vspyt...@microsoft.com. By using this source code in any fashion, you are agreeing to be bound 
 # by the terms of the Apache License, Version 2.0.
 #
 # You must not remove this notice, or any other, from this software.
 #
 # ###

from __future__ import absolute_import, print_function, with_statement
import ctypes
import datetime
import os
import re
import struct
import sys
import traceback
from xml.dom import minidom

try:
from cStringIO import StringIO
BytesIO = StringIO
except ImportError:
from io import StringIO, BytesIO
try:
from thread import start_new_thread
except ImportError:
from _thread import start_new_thread

__version__ = '3.0.0'

if sys.version_info[0] == 3:
def to_str(value):
return value.decode(sys.getfilesystemencoding())
else:
def to_str(value):
return value.encode(sys.getfilesystemencoding())


# http://www.fastcgi.com/devkit/doc/fcgi-spec.html#S3

FCGI_VERSION_1 = 1
FCGI_HEADER_LEN = 8

FCGI_BEGIN_REQUEST   = 1
FCGI_ABORT_REQUEST   = 2
FCGI_END_REQUEST = 3
FCGI_PARAMS  = 4
FCGI_STDIN   = 5
FCGI_STDOUT  = 6
FCGI_STDERR  = 7
FCGI_DATA= 8
FCGI_GET_VALUES  = 9
FCGI_GET_VALUES_RESULT  = 10
FCGI_UNKNOWN_TYPE   = 11
FCGI_MAXTYPE = FCGI_UNKNOWN_TYPE

FCGI_NULL_REQUEST_ID= 0

FCGI_KEEP_CONN = 1

FCGI_RESPONDER  = 1
FCGI_AUTHORIZER = 2
FCGI_FILTER = 3

FCGI_REQUEST_COMPLETE = 0
FCGI_CANT_MPX_CONN= 1
FCGI_OVERLOADED   = 2
FCGI_UNKNOWN_ROLE = 3

FCGI_MAX_CONNS  = "FCGI_MAX_CONNS"
FCGI_MAX_REQS   = "FCGI_MAX_REQS"
FCGI_MPXS_CONNS = "FCGI_MPXS_CONNS"

class FastCgiRecord(object):
"""Represents a FastCgiRecord.  Encapulates the type, role, flags.  Holds
onto the params which we will receive and update later."""
def __init__(self, type, req_id, role, flags):
self.type = type
self.req_id = req_id
self.role = role
self.flags = flags
self.params = {}

def __repr__(self):
return '' % (self.type, 
self.req_id, 
self.role, 
self.flags)

#typedef struct {
#   unsigned char version;
#   unsigned char type;
#   unsigned char requestIdB1;
#   unsigned char requestIdB0;
#   unsigned char contentLengthB1;
#   unsigned char contentLengthB0;
#   unsigned char paddingLength;
#   unsigned char reserved;
#   unsigned char contentData[contentLength];
#   unsigned char paddingData[paddingLength];
#} FCGI_Record;

class _ExitException(Exception):
pass

if sys.version_info[0] >= 3:
# indexing into byte strings gives us an int, so
# ord is unnecessary on Python 3
def ord(x):
return x
def chr(x):
return bytes((x, ))

def wsgi_decode(x):
return x.decode('iso-8859-1')
def wsgi_encode(x):
return x.encode('iso-8859-1')

def fs_encode(x):
return x

def exception_with_traceback(exc_value, exc_tb):
return exc_value.with_traceback(exc_tb)

zero_bytes = bytes
else:
# Replace the builtin open with one that supports an encoding parameter
from codecs import open

def wsgi_decode(x):
return x
def wsgi_encode(x):
return x

def fs_encode(x):
return x if isinstance(x, str) else x.encode(sys.getfilesystemencoding())

def exception_with_traceback(exc_value, exc_tb):
# x.with_traceback() is not supported on 2.x
return 

[web2py] Re: In the dropdown here how to remove Profile?

2016-04-03 Thread Stephen Duisberg
Is it possible to add extra stuffs into the table as I asked earlier?

On Tuesday, March 29, 2016 at 6:27:45 AM UTC+5:30, 黄祥 wrote:
>
> pardon, not sure what do you mean with 'add extra fields to the dropdown 
> table'
>
> 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: Why unirest doesn't work? What kind of error is this?

2016-04-03 Thread Stephen Duisberg
Why does unirest doesn't work?

On Sunday, April 3, 2016 at 10:13:10 AM UTC+5:30, Stephen Duisberg wrote:
>
> my code:
>
> import unirest
>
> def index():
> response = 
> unirest.post("https://voicerss-text-to-speech.p.mashape.com/?key= 
> secret",
>
> headers={
> "X-Mashape-Key": "key",
> "Content-Type": "application/x-www-form-urlencoded"
>   },
>   params={
> "c": "mp3",
> "f": "8khz_8bit_mono",
> "hl": "en-us",
> "r": 0,
> "src": "Hello, world!"
>   }
> )
>
>   return locals()
>
> {{extend 'layout.html'}} {{=response}} 
>
> 
>   
> Traceback
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
>
> Traceback (most recent call last):
>   File "C:\web2py\gluon\main.py", line 450, in wsgibase
> serve_controller(request, response, session)
>   File "C:\web2py\gluon\main.py", line 192, in serve_controller
> run_view_in(response._view_environment)
>   File "C:\web2py\gluon\compileapp.py", line 661, in run_view_in
> view = environment['response'].view
> AttributeError: 'UnirestResponse' object has no attribute 'view'
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group 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: Scheduler always QUEUED and no record in scheduler_worker and scheduler_run data table

2016-04-03 Thread narges Rezaei
hi Pengfei Yu , is your code true? Is it working well?
i want use it.

On Monday, September 29, 2014 at 6:07:53 PM UTC+3:30, Pengfei Yu wrote:
>
> Hi,
>
> I have a web application hosted on AWS EC2 with Apache2. I plan to use 
> web2py scheduler for some heavy tasks with user input files. Now I only use 
> some small tasks like "wc -c" to test the functions of scheduler. It seems 
> that the submitted tasks are always QUEUED and the status never changes. 
> After searching the google group, I added "db.commit()" right after 
> "scheduler.queue_task()", but it still cannot work. 
>
> I've already Installed the scheduler as a permanent daemon on Linux and 
> started "web2py-scheduler" using "sudo start web2py-scheduler".
>
> Here is part of my codes in default.py:
> def index():
>
> response.flash = T("Welcome to web2py!")
> form=SQLFORM(db.project,fields=['name', 
> 'Genome',"File_type","InputFile"])
> if request.vars.InputFile!=None and 
> request.vars.InputFile.filename.split(".")[-1]!=request.vars.File_type:
> response.flash = 'The input file must match file type, please fill 
> again'
> return dict(form=form)
> if request.vars.InputFile!=None:
> form.vars.processID="0"
> if form.process().accepted:
> response.flash = 'form accepted'
> filepath = form.vars.InputFile
> command = "wc -c 
> /home/www-data/web2py/applications/BamToVcf/uploads/"+filepath
> p = scheduler.queue_task('run',[command])
> db.commit()
> row = db(db.project.InputFile==filepath).select().first()
> row.update_record(processID = p.uuid)
> redirect(URL("progress",args=[p.uuid]))
> elif form.errors:
> response.flash = 'form has errors'
> else:
> response.flash = "please fill out the form"
> return dict(form=form)
>
>
> def progress():
> processID = request.args(0)
> project = db.project(db.project.processID==processID)
> status=scheduler.task_status(processID,output=True)
> start_time = utc_to_local(status.scheduler_task.start_time)
> return dict(project=project,p=status,start_time=start_time)
>
> def list():
> rows = db(db.project.id>0).select()
> return dict(rows=rows)
>
> And the code in scheduler.py in Models folder:
> from gluon.scheduler import Scheduler
> import subprocess
> from collections import OrderedDict
> import os
>
> def run(command):
> p = subprocess.Popen(command,
>  shell=False,
>  stdout=subprocess.PIPE,
>  stderr=subprocess.PIPE)
> startTime = time.time()
> stdout, stderr = p.communicate()
> endTime = time.time()
> return (command, p.returncode, stdout, stderr, round(endTime - 
> startTime))
>
> def demo2(a,b):
> return a+b
>
> scheduler = Scheduler(db,dict(run=run,demo2=demo2))
>
> From the database page ("~/%app/appadmin/index"), I can see the records of 
> tasks in db.scheduler_task table but no record in db.scheduler_worker and 
> db.scheduler_run table.
>
> Could any one help me figure out the problem?
>
> Thanks very much! 
>
>

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

2016-04-03 Thread Lionel Roubeyrie
Hi,
Says a table
db.define_table('book', 
Field('title'), 
Field('author', 'reference author')
)
Inside the create/update view of the grid based on this table, is it 
possible to have a create button right after the dropdown widget 
representing the author ? 
Subsidiary question : if it's possible, will the dropdown widget be updated 
with the newly created author? 

Cheers

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


[web2py] Re: SQLFORM.grid: search in a list:reference field does not work

2016-04-03 Thread Lionel Roubeyrie
Hi all,
I just start with this great framework and I have a similar issue. In a 
table there's two 'list:reference' Fields but none is searchable in the 
grid view. 
Is there some special things to do before?

Le dimanche 8 novembre 2015 10:53:35 UTC+1, mweissen a écrit :
>
> I have a table like
>
> db.define_table("mytable",
> Field("reffield", "list:reference anothertable"),
> )
>
> The search widget of SQLFORM.grid("mytable", ...) does not show the 
> reffield.
>
> In gloun/sqlhtml.py I have found 
>
> if fields[0]._db._adapter.dbengine == 'google:datastore':
>search_options['string'] = ['=', '!=', '<', '>', '<=', '>=']
>search_options['text'] = ['=', '!=', '<', '>', '<=', '>=']
>search_options['list:string'] = ['contains']
>search_options['list:integer'] = ['contains']
>search_options['list:reference'] = ['contains']
>
> Therefore a list:reference field will only be recognized if the table is 
> stored in a google:datastore.
> Is this an intended behaviour?
>
> Regards, Martin
>
>
>
>
>

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

2016-04-03 Thread Massimo Di Pierro
All web2py does is generate SQL for you. This is not possible. you can 
manually merge results from two queries on different databases in Python 
and get a Row object but it would not be efficient.

On Saturday, 2 April 2016 12:56:31 UTC-5, m...@greenlots.com wrote:
>
> I have two database connections, one to SQLlite  called db and the other 
> to MySQL  called sky. I am trying to join a table from each database. Is 
> this possible in web2py? I've tried numerous things but none of them seem 
> to work.
>
> something like
>
> db( db.stations.NodeID == sky.device.macaddress ).select()
>
>

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