Re: [web2py] Re: How to reject request based on location

2020-10-27 Thread Val K
It seems PA doesnt support low-level-IP-blocking https://www.pythonanywhere.com/forums/topic/8212/ So you have to use db.py as Chris mentioned (or something like *_block_list.py* in models dir - file name should be top most alphabetical) Also you can modify PA-starting script to catch bad-IP before

[web2py] Re: pyDAL looks abandoned?

2020-08-12 Thread Val K
Yes, peewee is cool but too verbose, almost like pure SQL. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subsc

[web2py] Re: Bootstrap 4 and MENU helper problem

2020-06-06 Thread Val K
Hi, Annet! 1. You can write your own MENU helper based on gluon.html.MENU - it's easy 2. about reorder classes - its because web2py uses unordered set in add_class/remove_class - it could be fixed - open an issue, please -- Resources: - http://web2py.com - http://web2py.com/book (Documentation)

[web2py] Re: List | Create | Modify and Delete Users directly from Python controller without using HMI

2020-06-04 Thread Val K
db.auth_user is just a table like any other 1) db(~db.auth_user.id.belongs([1,2])).select(...) or db(~db.auth_user.username.belongs(['user0', 'user1'])).select(...) note that `~` inverts `belongs` i.e. it is equal sql -`NOT IN` 2) db.auth_user.insert(username = 'John', ...) - nothing new e

[web2py] Credential (email) encryption

2020-05-22 Thread Val K
Try to use SQLCustomType instead of filter_in/out -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to

[web2py] Fwd: client side caching

2020-05-14 Thread Val K
But why do you think that it should be 304? https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/304 -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) ---

[web2py] Fwd: client side caching

2020-05-14 Thread Val K
Oh, sorry, it is about server side cache -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Googl

[web2py] Fwd: client side caching

2020-05-14 Thread Val K
https://py4web.com/_documentation/static/index.html#chapter-04 See at the end -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message b

[web2py] Re: 2.20.4 and sessions2trash failure

2020-05-13 Thread Val K
Hi, DaneW! - yes, it is bug - I made the PR https://github.com/web2py/web2py/pull/2323 On Tuesday, May 12, 2020 at 1:35:39 AM UTC+3, DaneW wrote: > > I am running web2py on PythonAnywhere under Python 2.17.12. I run a copy > of sessions2trash as a scheduled task via "python /home/web2py/web2py.

[web2py] Re: pyDAL looks abandoned?

2020-05-13 Thread Val K
Thanks for your replies, guys! I just want to highlight the problem. I believe that Massimo is a very creative person, and like any creative person, he does not really like routine work ... especially if no one asks to do it;) -- Resources: - http://web2py.com - http://web2py.com/book (Docume

[web2py] Re: pyDAL looks abandoned?

2020-05-11 Thread Val K
BTW: if anyone is interested about WITH RECURSIVE here is my implementation: https://github.com/web2py/pydal/issues/627 On Monday, May 11, 2020 at 11:27:14 PM UTC+3, Val K wrote: > > > There are 131 issues on pyDAL-GitHub, but the problem is not in the amount > but in that more

[web2py] pyDAL looks abandoned?

2020-05-11 Thread Val K
There are 131 issues on pyDAL-GitHub, but the problem is not in the amount but in that more than half of them without any response. Look at peewee that has 7.5k stars and only 2 open issues!... yes, this is impolite comparision - sorry. I've just need to implement CTE + WITH RECURSIVE (like thi

[web2py] Re: Keeping objects between requests

2020-04-07 Thread Val K
Yes, see pydal implementation https://github.com/web2py/pydal/blob/master/pydal/connection.py It is just 176 lines -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Iss

[web2py] Re: Keeping objects between requests

2020-04-07 Thread Val K
Ups, sorry current is thread local and renew per request, use regular mudule -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message bec

[web2py] Keeping objects between requests

2020-04-06 Thread Val K
You can save any object in the module or current, but if you use more than one worker you will have independent instance of that object per worker -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/

[web2py] Re: Installation

2020-04-05 Thread Val K
Yes, no binaries - no 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

Re: [web2py] Installation

2020-04-05 Thread Val K
t; File "", line 6, in >>>> File "__main__.py", line 128, in >>>> File "__main__web2py__.py", line 33, in >>>> TypeError: start() takes no arguments (1 given) >>>> >>>> >>>> David Swarbric

[web2py] Installation

2020-04-05 Thread Val K
Try run web2py.exe from cmd/shell to see an error -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to

[web2py] Building a query

2020-04-04 Thread Val K
query &= ... Just use & and | instead of 'and' and 'or' -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscri

[web2py] Re: reg expression use in web2py/dal?

2020-03-31 Thread Val K
Also you can pass raw sql string like db.field.on(raw_sql_string) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you ar

[web2py] Re: reg expression use in web2py/dal?

2020-03-31 Thread Val K
re.sub() is invoked at python level not at db level. You should use db.field.regexp(pattern) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You receive

[web2py] py4web: json-response on server errors

2020-03-10 Thread Val K
Hello! I'd like to discuss my PR https://github.com/web2py/py4web/pull/123 The reason: Currently, if you make an ajax request and expect json-response, in case of any error on the server, py4web returns a response that is an html page with response.status = 200. My PR changes this behavior to t

Re: [web2py] pyweb login

2020-03-08 Thread Val K
It is strange because opera is chromium based. Keep in mind that 'disable cache' takes effect if only console is opened. Are there any errors in console during page reloading? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source co

Re: [web2py] pyweb login

2020-03-07 Thread Val K
Try open console ctrl-shift-j then network the disable cache and reload -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because

Re: [web2py] Re: Why would new code be ignored and old code be executed?

2020-03-06 Thread Val K
oh yeah, it is definitely due to you press compile in appadmin, it is intended for production. Dont compile app while you develop. I use modules without any issues with tracking as i mentoined above -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/w

[web2py] Why would new code be ignored and old code be executed?

2020-03-05 Thread Val K
To track module changes try this from gluon.custom_import import track_changes; track_changes(True) Also, your problem looks like you have more then one web2py server running -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source co

[web2py] py4web defining tables

2020-02-27 Thread Val K
There is import db from common, but later there is db = DAL(...) in the same file! -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this mess

Re: [web2py] Re: p4web auth issues

2020-02-24 Thread Val K
get_user(), not get.user() -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web

[web2py] Re: LOAD in py4web

2020-02-23 Thread Val K
for server side you can @action("foo") @action.uses("foo.html") def foo(): return dict(...) @action("bar") @action.uses("bar.html") def bar(): return dict(foo_content = foo()) # bar.html [[=XML(foo_content)]] for the client side, I suppose, you have to do it by yourself using pure js o

[web2py] Re: py4web URL helper documentation missing?

2020-02-23 Thread Val K
Yes, there is no keyword argument `args`, you can just: args = [...] URL('foo_controller', *args, vars = dict(...) ) On Sunday, February 23, 2020 at 11:37:08 PM UTC+3, RHC wrote: > > HI, > > Looking at the py4web documentation at > http://py4web.com/_documentation/static/index.html#chapter-08

[web2py] Re: PY4WEB request.vars error

2020-02-23 Thread Val K
p4web `request` is bottle request, see https://bottlepy.org/docs/dev/api.html#bottle.Request On Monday, February 24, 2020 at 12:30:29 AM UTC+3, Maurice Waka wrote: > > New issue with py4web. > > Whats the new code for request.vars?? > > I get this error: > > > Traceback (most recent call last):

[web2py] Re: p4web auth issues

2020-02-23 Thread Val K
.user_id).select(db.posts.id, > db.posts.author, orderby=~db.posts.id, limitby=(0,1)).first() > if user.author if user else None == auth.user_id: > pass > else: > db.posts.insert(message="Welcome "+auth_user.first_name+'.'+' > Thank

[web2py] Re: p4web auth issues

2020-02-23 Thread Val K
Show your code, please -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source 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: [web2py] py4web jwt ?

2020-02-20 Thread Val K
th py4web asap once I have something > working. > > Will probaly be on the. Weekend. > > > > > > > On Thu, 20 Feb 2020, 10:42 Val K, > wrote: > >> check request.content_type - is that 'application/json' ? >> >> On Thursday, February 20,

Re: [web2py] py4web jwt ?

2020-02-20 Thread Val K
t; > > Em qui., 20 de fev. de 2020 às 18:03, Val K > escreveu: > >> It seems it depends on request.content_type >> >> https://github.com/web2py/py4web/blob/e6b3d5e10e15976af153c4a4e6b349a02fe6c2a9/py4web/utils/auth.py#L35 >> >> -- >> Resou

[web2py] py4web jwt ?

2020-02-20 Thread Val K
It seems it depends on request.content_type https://github.com/web2py/py4web/blob/e6b3d5e10e15976af153c4a4e6b349a02fe6c2a9/py4web/utils/auth.py#L35 -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com

[web2py] py4web jwt ?

2020-02-20 Thread Val K
+1 autoredirect should be an option -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Gro

[web2py] py4web

2020-02-20 Thread Val K
You can press "reload apps" in the dashboard -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the G

[web2py] Each worker has its own session?

2020-02-09 Thread Val K
See my issue: https://github.com/web2py/py4web/issues/108 did anyone have the same issue? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received t

[web2py] Re: py4web - method not allowed

2020-01-21 Thread Val K
It seems that your pydal is out of date, try to update it -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscr

[web2py] py4web - method not allowed

2020-01-21 Thread Val K
Try method=... instead of methodS -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Group

Re: [web2py] Re: Take me advice, please

2020-01-05 Thread Val K
Finally, the session is saved on disk or in db or in cookies between requests, web2py uses pickle to do that, so all that you store in the session must be pickable. In your case it is enough to trasform your class object into dict, you don't need to convert it into json -- Resources: - http://

[web2py] Re: Take me advice, please

2020-01-05 Thread Val K
You want to keep python object in memory between requests? - it is bad idea. You should transform it to something that can be saved on disk or in db and recreate it in each request -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (So

[web2py] Re: Something strange in my query

2019-12-09 Thread Val K
As you can see, this is a Set, not just an attribute. When you select from a table that has FK, Pydal forms Sets for related tables, Set is the type that db (...) returns -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) -

[web2py] web2py for (R)OLAP (pivoting)?

2019-11-27 Thread Val K
Hi !, you can pass sql expressions to select() : .select(db.tbl.field, 'SUM(sometbl.somefield) OVER(PARTITION BY sometbl.anotherfield) AS mysum )') -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.co

[web2py] Re: Problems with file upload in Catalina

2019-11-24 Thread Val K
Use os.path.join() to build path -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups

[web2py] Registration key

2019-11-22 Thread Val K
Because null (none) has special meaning in sql and can't be compared, so you should use explicit comparison with null (none) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (

[web2py] Re: web2py survey dynamic forms with nested choices

2019-10-18 Thread Val K
10 should be added to > the sub_total variable. > If another user clicks on Not Available 5 should be added to the sub_total > and so on. > Summarily, the checkbox labels are to be directly connected to the score > and both will be defined during survey creation. > Regards &

[web2py] post file to a server

2019-10-14 Thread Val K
Or you can just set 'allow-origin' to server_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

[web2py] post file to a server

2019-10-14 Thread Val K
You don't need 'requests' on server_2, you can set 'allow-origin' to * + basic auth (I didn't test this variant, but I suppose it should work ), or you can perform GET some dummy request to server_2 to get origin and establish ssl (as option) and then post to login and then post file -- Resou

[web2py] Re: web2py survey dynamic forms with nested choices

2019-10-12 Thread Val K
If you want to create/edit survey using one page you have to use JavaScript (I don't see another non-horrible way). If you want only web2py/python implementation you have to organize your application to edit one entity per page/request, i.e. you can do something as follows: /surveys - returns g

[web2py] Re: web2py survey dynamic forms with nested choices

2019-10-12 Thread Val K
# db_0.py # shortcut for `not null` field creation def req_field(*args, **kwargs): kwargs['notnull'] = True kwargs['required'] = True return Field(*args, **kwargs) # shortcut for reference field creation, `notnull` by default def FK(ref_table, **kwargs): if 'notnull' not in kwargs:

[web2py] Re: Vue2pyj - alternative web IDE

2019-10-03 Thread Val K
Now, vue2pyj works on both pythons + access through admin only On Monday, September 30, 2019 at 9:41:07 PM UTC+3, Val K wrote: > > Thanks for your feedback, I just haven't tried web2py on PY3. I will fix it > > On Monday, September 30, 2019 at 2:17:39 PM UTC+3, Alex

[web2py] trying web2py on py3.7

2019-09-30 Thread Val K
web2py™ Version 2.18.5-stable+timestamp.2019.04.07.21.13.59 Python Python 3.7.0:Traceback 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. Traceback (most recent call last): File " /web2py/gluon/main.py", line 442, in wsgibase serve_controller(request, response, session) File "

[web2py] Re: Vue2pyj - alternative web IDE

2019-09-30 Thread Val K
Thanks for your feedback, I just haven't tried web2py on PY3. I will fix it On Monday, September 30, 2019 at 2:17:39 PM UTC+3, Alex Beskopilny wrote: > > > > суббота, 11 мая 2019 г., 5:12:26 UTC+3 пользователь Val K написал: >> >> As result of experimenting with Rap

Re: [web2py] Re: Vue2pyj - alternative web IDE

2019-09-27 Thread Val K
(*args, **kwargs) > File "apps/vue3pyj/__init__.py", line 56, in get_fs > app_rex = re.compile('^[a-z_][a-z_0-9]*$', flags = re.I) > NameError: name 're' is not defined > > Em sex, 27 de set de 2019 às 02:24, Val K > > escreveu: > &

[web2py] Re: Vue2pyj - alternative web IDE

2019-09-26 Thread Val K
Vue3pyj now uses the _dashboard password and can be used along it. Also I ported shopping cart example from vue -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues)

[web2py] Overiding the auth table ID fields to allow for release over pillars (Development, Acceptance, Production)

2019-09-10 Thread Val K
why do you have to override ids? You can just create users with the required ids. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this messa

[web2py] Re: web3py -> py4web

2019-08-31 Thread Val K
Yeah, I had the same issue, because there is no apps/__init__.py in the repo - just create it! -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You receiv

[web2py] Re: Question with saving the thumbnail name on linux disk

2019-08-28 Thread Val K
It is no need to use different code for win/linux, since it is Python! There is os.path.normpath(your_path) that does all stuff with slashes, I have app that works on both platforms just fine (without platform checking at all) My way - always use '/' in path, and at the end of all manipulations

[web2py] Re: Automatic user logout & redirect

2019-08-19 Thread Val K
There is no 'select' in your code. Is that a typo? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to

[web2py] Re: How can I insert image in HTML from database?

2019-08-17 Thread Val K
I am not sure, but I think that the problem has the same root as in the case of streaming: when lambda is invoked db is already wasted/rotten. So you can try to make a module with function that will fetch the rows from current.db and returns they. Then you can import this module in the controlle

[web2py] Re: Accessing some sum

2019-08-13 Thread Val K
https://github.com/web2py/pydal/issues/388 -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Goo

[web2py] Re: Accessing some sum

2019-08-13 Thread Val K
I saw in some post that implicit query like db() with no args is not supported now -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this mess

[web2py] Re: How can I insert image in HTML from database?

2019-08-12 Thread Val K
100 images per page? What do your images look like? Are these icons? What size? To prevent db scratching there is Cache-Control -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/lis

[web2py] Re: How can I insert image in HTML from database?

2019-08-12 Thread Val K
= [row.id]))) return dict(img_list = img_list) On Sunday, August 11, 2019 at 7:47:41 PM UTC+3, Константин Комков wrote: > > *Val K*, that case is work!) > def index(): > image = XML(' class="card-img-top" alt="..."/>') > return di

[web2py] Re: How can I insert image in HTML from database?

2019-08-11 Thread Val K
OK, it seems that something is crashing while streaming (db connection or something else). I met the similar problem when I tried to yield records from db using iterselect. Try just 'return row.IMAGE.read()' instead of response.stream(...) -- Resources: - http://web2py.com - http://web2py.com/

[web2py] Re: How can I insert image in HTML from database?

2019-08-10 Thread Val K
Under inspect error I mean the following: go to http://127.0.0.1:8000/admin/default/errors/Recipes/old You will see all errors that were - the first is the latest - click on it to see what is going on the server when trying to stream images On Sunday, August 11, 2019 at 2:12:26 AM UTC+3, Кон

[web2py] Re: How can I insert image in HTML from database?

2019-08-10 Thread Val K
Also you can inspect server error using appadmin -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to t

[web2py] Re: How can I insert image in HTML from database?

2019-08-10 Thread Val K
I mean revert model to the state when you can retrieve images using base64, i.e. instead of encoding image you can stream it. If row.IMAGE.read() will work, stream will work as well -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (So

[web2py] Re: How can I insert image in HTML from database?

2019-08-10 Thread Val K
Remove 'blob' from IMAGE field definition, if it causes an error. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you ar

[web2py] Re: How can I insert image in HTML from database?

2019-08-10 Thread Val K
I believe that any object that has read(chunk) and close() methods can be streamed. Open the browser console, refresh the page and check for errors -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.co

Re: [web2py] Re: How can I insert image in HTML from database?

2019-08-10 Thread Val K
Try this: #default.py def img(): row = db().select(db.recipes.IMAGES). first() if row: return response.stream(row.IMAGE) Usage: =URL( 'default', 'img', args=..., vars=...) On Saturday, August 10, 2019 at 12:43:49 AM UTC+3, Константин Комков wrote: > > Ok, I will register issue

[web2py] Re: How can I insert image in HTML from database?

2019-08-07 Thread Val K
to make it works, files should be loaded using web2py interface (SQLFORM or programmatically - see the book). As far as I can see you have legacy database with already srored images in it, no? If so you can try to use 'uploadfield' option, i.e. you should have 2 fields in your model (upload and

[web2py] Re: How can I insert image in HTML from database?

2019-08-05 Thread Val K
Set field type to 'upload' as Ramos suggests and in your first example it should be row.IMAGE instead of row.file -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issue

[web2py] Re: Accessing some sum

2019-08-03 Thread Val K
Try db(db.test1).select(sum) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "w

[web2py] Re: Accessing some sum

2019-08-03 Thread Val K
and of course, if you convert result to json or list/dict you have to use '_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 mess

[web2py] Re: Accessing some sum

2019-08-03 Thread Val K
I just want to say that you can't retrieve sum from row using the string-key 'sum', you should use the object as in the book example. And it would be better if dal supports syntax like db.table.field.sum().as('mysum') -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) -

[web2py] Accessing some sum

2019-08-02 Thread Val K
It is not a bug, as you probably know dal does not support fields aliases and '_extra' is workaround. When do you get an error? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/lis

Re: [web2py] How can I get value from my extra_fields?

2019-08-01 Thread Val K
Should be stored in the session too, did you try to logout/login? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you ar

[web2py] How can I get value from my extra_fields?

2019-08-01 Thread Val K
Try db.auth_user(auth.user_id).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

[web2py] how can I pass a parameter from the view get the return value from a function of controller?

2019-07-25 Thread Val K
Just place your function in the module and import it in the 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

[web2py] Built-in online text editor jumps away

2019-07-18 Thread Val K
Hi Zoltan! I just wrote my own https://github.com/valq7711/vue2pyj -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you a

Re: [web2py] Using db.table.format (i.e. format attr outside of table definition)

2019-07-09 Thread Val K
I suppose it is also needed to add IS_IN_DB validator to the field that is reference -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this me

Re: [web2py] Using db.table.format (i.e. format attr outside of table definition)

2019-07-08 Thread Val K
Show your code, please -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-

[web2py] Using db.table.format (i.e. format attr outside of table definition)

2019-07-08 Thread Val K
Try db.table._format=... -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2

[web2py] Re: set variable on models or modules

2019-07-04 Thread Val K
It seems that defining db=DAL(...) at module level is not a good idea http://www.web2py.com/books/default/chapter/29/04/the-core#Accessing-the-API-from-Python-modules On Thursday, July 4, 2019 at 10:23:43 PM UTC+3, 黄祥 wrote: > > is there any difference to set variable on models or modules ? >

Re: [web2py] How to try - exception - finally os.path.join

2019-07-03 Thread Val K
Just in case: os.path.join does not check that path exists, so what kind of error are you trying to catch? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) ---

[web2py] Re: Cart session callback function

2019-07-03 Thread Val K
As you can see url callback is generated at server, so to do what you want you have to use js (jquery or ...) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues)

[web2py] Re: Cart session callback function

2019-07-02 Thread Val K
user press 'button pill' - web2py.js does ajax request with URL = ('cart_callback', ...) and writes response to html element with id = target = 'items%s'%p.id On Tuesday, July 2, 2019 at 3:35:03 PM UTC+3, mostwanted wrote: > > Can anyone please explain to me in lay-man terms how the code belo

Re: [web2py] Re: web2py multiple domains on nginx + gunicorn

2019-07-01 Thread Val K
I'm not a pro in nginx but if you set proxy_set_header Host 192.168.7.2; how does web2py know about www.domain1.net? Maybe it should be proxy_set_header Host $host? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https

[web2py] Tip to remove L from interger 750L when exporting json to view?

2019-06-25 Thread Val K
How do you convert dict to json? I believe that json.dumps or response.json produces json strings without L suffix -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Iss

[web2py] Re: Error in app: cannot unpack non-iterable NoneType object

2019-06-20 Thread Val K
1. & - is bitwise operator (just in case) 2. why not just return ('My message', oper and abit) On Thursday, June 20, 2019 at 8:30:30 PM UTC+3, Константин Комков wrote: > > I need add more information. Can error may be caused if my function don't > have one condition: > def send_application(msg,e

Re: [web2py] Re: form's field having special characters transmitted via request.post_vars

2019-06-20 Thread Val K
;t know what they may enter, it could be > anything. > I just need to feed back whatever they entered in the middle of some js > action. > the objective is that whatever they enter - any characters - should simply > be taken as a string by the browser > > > On Thu, Jun

[web2py] Re: form's field having special characters transmitted via request.post_vars

2019-06-20 Thread Val K
I think there is no universal way because js is just a string in python context, you have to escape quotes with backslash (replace " with \") where it is required to prevent crumbling strings in js-code What is the second char? dot? On Thursday, June 20, 2019 at 8:32:08 PM UTC+3, Vlad wro

Re: [web2py] Re: emailing the content of the current page

2019-06-20 Thread Val K
;) def foo(): ... On Thursday, June 20, 2019 at 8:39:45 PM UTC+3, Val K wrote: > > I mean the following logic: > def foo(): > ... > ret = dict(...) > if email_required: > html = response.render(ret) > ... # send html by email >

[web2py] Re: emailing the content of the current page

2019-06-20 Thread Val K
ut how this woks, so just rendered it again. Not a big > deal - just a matter of convenience. The email requests come occasionally, > so this extra render doesn't cause trouble. > > Thank you, Val! > > On Thursday, June 20, 2019 at 6:23:55 AM UTC-4, Val K wrote: >> >&

[web2py] Re: Colleagues, how can I generate an identification code automatically?

2019-06-20 Thread Val K
define_table('company') define_table('client', Field('id', 'reference company'), primarykey=['id']) define_table('supplier', Field('id', 'reference company'), primarykey=['id']) On Thursday, June 20, 2019 at 7:02:31 PM UTC+3, Paul Arsenio Blanco Reyes wrote: > > It turns out that I have a compan

[web2py] emailing the content of the current page

2019-06-20 Thread Val K
Also you can hack wsgihandler.py to catch rendered response -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are sub

[web2py] Re: Error in json.loads

2019-06-20 Thread Val K
You should pass object to JSON.stringify not string, I mean fill the object with required data and then convert it to string by JSON.stringify, don't build json strings by your hand -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (S

  1   2   3   4   >