[web2py] Re: Slider example

2022-08-31 Thread Alex Beskopilny
unfortunately, I don't have the code. I once made such a form from a book web2py Application Development Cookbook (I remember that there were errors in the book, but the code that came with the book worked after obvious changes) On Tuesday, August 30, 2022 at 11:04:41 AM UTC+3 Kenneth wrote:

[web2py] Re: rendering rows as a generator and displaying via SQLTABLE

2020-12-24 Thread Alex Beskopilny
Hi! You can create a table in memory and use grid working example: def pro_report1(): # https://web2py.wordpress.com/category/web2py-and-databases/ # https://stackoverflow.com/questions/33674532/web2py-sqlform-grid-with-executesql tbl = 'proverka' #f_short_proverka = [ 'f' +

[web2py] Re: How to pass variables to db.executesql?

2020-11-20 Thread Alex Beskopilny
myid = 10L sql_str = "xxx where id=%s;" % (str(myid)) db.executesql( sql_str ) examples: https://web2py.wordpress.com/tag/db-executesql/ On Friday, November 20, 2020 at 7:56:07 AM UTC+3 alexg...@gmail.com wrote: > for example > > where mytable.id = someWeb2PyVariable > > thanks, > >

[web2py] Re: Dashboard library for Web2py performance/recommendation python vs. js

2020-11-18 Thread Alex Beskopilny
dasjboards for web2py https://github.com/ali96343/facew2p dashboards for py4web https://github.com/ali96343/facep4w charts Highcharts.js On Tuesday, November 17, 2020 at 11:47:04 AM UTC+3 Jonsubs wrote: > Hi everyone, > I need to implement a dashboard and some charts in my webapp. And honestly

[web2py] Re: SQLFLORMGRID

2020-10-08 Thread Alex Beskopilny
maybe you could do this def art_manage(): if len(request.args) >= 2 and ('new' == request.args[0]): # some code return ' create ' records= SQLFORM.grid(query=db.t_art,maxtextlength = 40,deletable=False,create=True, fields=[db.t_art.f_name, db.t_art.f_team,

[web2py] Re: Streaming pdf in a browser

2020-09-28 Thread Alex Beskopilny
1 create new app and mkdir docfiles in it # models/db1.py db.define_table( 'zurina', Field('jenka_fnm', requires=IS_NOT_EMPTY(), label='orig_file_name' ), Field("fld",label="Remark", length=3500,),

[web2py] Re: Streaming pdf in a browser

2020-09-28 Thread Alex Beskopilny
it's work with web2py inline for pdf, jpeg, png ... save file fot other file types def doc2user(): # read from db.table orig file name and path to file in upfolder import os prn_id = request.args(0,cast=int) task = db.zurina(prn_id) or error() qu=db.zurina.id == prn_id

[web2py] Re: Streaming pdf in a browser

2020-09-25 Thread Alex Beskopilny
only pdf to browser - inline def doc2user(): import os prn_id = request.args(0,cast=int) task = db.zurina(prn_id) or error() qu=db.zurina.id == prn_id res= db(qu).select().first() upfolder= os.path.join(request.folder, 'docfiles') file_path = os.path.join( upfolder,

[web2py] Re: Streaming pdf in a browser

2020-09-25 Thread Alex Beskopilny
Hi! solution https://stackoverflow.com/questions/20508788/do-i-need-content-type-application-octet-stream-for-file-download web2py func def doc2user(): import os prn_id = request.args(0,cast=int) task = db.zurina(prn_id) or error() qu=db.zurina.id == prn_id res=

[web2py] Re: How to sort a smartgrid with your own custom sorted id list

2020-07-03 Thread Alex Beskopilny
smartgrid sort with three one to many tables def uvidomlen_all(): table=db.operacia gqu = lambda tnm : (tnm.id>0) if auth.user.is_admin else (tnm.created_by == me) oqu = lambda tnm : ~db[tnm].id constraints = {'operacia':gqu(db.operacia), 'os1doc':gqu(db.os1doc),

[web2py] Re: How to sort a smartgrid with your own custom sorted id list

2020-07-03 Thread Alex Beskopilny
Hi! some working solution 1 build a sqlite-table in memory, as required 2 insert data in the table 3 show table in smartgird def pro_report1(): tbl = 'proverka' l = [e for e in db[tbl].fields if e in f_short_proverka ] memf = [ Field('oid', 'integer', label='П id', default= 0) ] +

[web2py] Re: Standard way of removing X-Powered-By: web2py http header?

2020-04-12 Thread Alex Beskopilny
cd web2py/gluon grep -r X-Powered-By ./globals.py:self.headers['X-Powered-By'] = 'xping' воскресенье, 12 апреля 2020 г., 16:02:13 UTC+3 пользователь Yan Wong написал: > > I'm a bit disappointed that web2py by default sets `X-Powered-By: web2py` > in the http header, thus making it

[web2py] Re: Web2py, react, typescript, visual studio code setup

2020-03-13 Thread Alex Beskopilny
Thanks Larry! great example. maybe in *webpack.config.js* *- app: './static/reactsrc/index.tsx'* + app: './static/src/index.tsx' среда, 11 марта 2020 г., 18:59:40 UTC+3 пользователь Larry Weinberg написал: > > Several people have asked about how to set up web2py to work with React > (and

[web2py] Re: About menu and current page

2020-03-04 Thread Alex Beskopilny
items_sub_menu= [] menu_item = [ (chr( 0x0001f534 ), False, URL('default', 'index'), items_sub_menu) ] save_orig_menu= response.menu response.menu = menu_item response.menu += save_orig_menu items_sub_menu.append( (T('home'), False, URL(_app, 'default', 'index') ),) items_sub_menu.append(

[web2py] Re: Searching by date using SQLFORM.factory

2020-02-19 Thread Alex Beskopilny
import cPickle, os def put_on_disk(file_name, data): uploadfolder=os.path.join(request.folder, 'uploads') fn = os.path.join(uploadfolder, file_name) out_file = open(fn, 'w') cPickle.dump(data, out_file) out_file.close() def get_from_disk(file_name):

[web2py] py4web Form customization

2020-02-12 Thread Alex Beskopilny
is that possible? similar to the web2py {{=form.custom.begin}}Name: {{=form.custom.widget.name}}{{=form.custom.submit}}{{=form.custom.end}} form.element('input[name=name]')['_id']='myid' form.element('input[name=name]')['_class']='myclass' Thanks Alex -- Resources: -

[web2py] Re: py4web nw version and new example

2020-02-10 Thread Alex Beskopilny
[X] loaded _dashboard [FAILED] loading myfeed .. FileNotFoundError: [Errno 2] No such file or directory: 'apps/myfeed/databases/sql.log' - mkdir apps/myfeed/databases and restart понедельник, 10 февраля 2020 г., 9:13:46 UTC+3 пользователь Massimo Di Pierro

[web2py] Re: SQLFORMGRID - CSS - LAYOUT

2019-12-07 Thread Alex Beskopilny
Hi! Here is the script and working examples for sqlform and customform https://github.com/ali96343/facew2p http://alibsk.pythonanywhere.com среда, 4 декабря 2019 г., 18:47:26 UTC+3 пользователь L c написал: > > Hi, > Soory but i do not find answer: > > I did that : > >1. Create a subfolder

[web2py] Re: How to easily implement another CSS-Framework

2019-10-14 Thread Alex Beskopilny
1: views/default/myindex.html Mysite myown unique page with my_css {{=message}} 2: def index(): response.view = 'default/myindex.html' return dict(message=T('Welcome to web2py!')) пятница, 11 октября 2019 г., 8:38:52 UTC+3 пользователь Jay B написал: > > Hello guys, > > I'm

[web2py] Re: Vue2pyj - alternative web IDE

2019-09-30 Thread Alex Beskopilny
суббота, 11 мая 2019 г., 5:12:26 UTC+3 пользователь Val K написал: > > As result of experimenting with Rapydscript I want to present my > alternative web IDE for web2py, > (that could be easily ported to web3py as well) > https://github.com/valq7711/vue2pyj > > Any feedback is appreciated > >

[web2py] Re: Vue2pyj - alternative web IDE

2019-09-30 Thread Alex Beskopilny
суббота, 11 мая 2019 г., 5:12:26 UTC+3 пользователь Val K написал: > > As result of experimenting with Rapydscript I want to present my > alternative web IDE for web2py, > (that could be easily ported to web3py as well) > https://github.com/valq7711/vue2pyj > > Any feedback is appreciated >

[web2py] Re: py4web: how to import Template and change delimiters

2019-08-06 Thread Alex Beskopilny
it's port lte-2.4.15 to py4web https://github.com/ali96343/lteadmin-py4web четверг, 1 августа 2019 г., 10:48:02 UTC+3 пользователь Alex Beskopilny написал: > > Hi! > I put lte-2.4.15 to py4web and lte works with controllers.py : > > from py4web import action, request, abort

[web2py] Re: py4web: how to import Template and change delimiters

2019-08-01 Thread Alex Beskopilny
69.54 четверг, 1 августа 2019 г., 10:48:02 UTC+3 пользователь Alex Beskopilny написал: > > Hi! > I put lte-2.4.15 to py4web and lte works with controllers.py : > > from py4web import action, request, abort, redirect, URL > from yatl.helpers import A > from . common impor

[web2py] py4web: how to import Template and change delimiters

2019-08-01 Thread Alex Beskopilny
Hi! I put lte-2.4.15 to py4web and lte works with controllers.py : from py4web import action, request, abort, redirect, URL from yatl.helpers import A from . common import db, session, T, cache, auth @action('index') @action.uses('index.html', ) #@action.uses(Template('index.html',

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

2019-07-01 Thread Alex Beskopilny
start second guicorn You have to run your projects on different ports like firsrone on 8000 and secondone on 8001. Then in nginx conf, in place of location /, you have to write location /firstone/ and proxy pass this to port 8000 and then write same location object for second one as

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

2019-07-01 Thread Alex Beskopilny
понедельник, 1 июля 2019 г., 16:23:30 UTC+3 пользователь Áureo Dias Neto написал: > > > . > for me works 1 up second gunicorn 2 dom2.conf upstream gunidom2 { server unix:/home/w2p/var/guni-dom2.sock fail_timeout=0; } server { listen xx.yy.zz.ww:443 ssl http2;

[web2py] Re: is it possible to make social site like facebook/linkedin by web2py ?

2019-06-27 Thread Alex Beskopilny
Hi! imran tube _only_ web2py ! download css-html-template and run app builder some demo https://alibsk.pythonanywhere.com/ четверг, 27 июня 2019 г., 6:08:54 UTC+3 пользователь imran tube написал: > > which framework best for me django or web2py? > web2py all demo site not work or old or

[web2py] Re: Upload files

2019-06-22 Thread Alex Beskopilny
if any ( ['.jpg' in file_name, '.JPG' in file_name , ] ): ? суббота, 22 июня 2019 г., 11:18:42 UTC+3 пользователь Константин Комков написал: > > I made upload form for files that winter and today when project is working > 3 days user told me that he can't load file. When I saw that file

[web2py] Re: css templates layouts for web2py

2019-05-11 Thread Alex Beskopilny
This is not a template generator. This is a template installer to web2py env. Examples for some free admin dashboards in applications dir четверг, 9 мая 2019 г., 21:25:00 UTC+3 пользователь Alex Beskopilny написал: Hi ! > >https://github.com/ali96343/facew2p.git >

[web2py] css templates layouts for web2py

2019-05-09 Thread Alex Beskopilny
Hi ! https://github.com/ali96343/facew2p.git Here is a script that generates web2py application from css templates. The script generates layouts, form (from html tag ), tables (from html tag ). The script has been tested on 50 templates. Thanks and best regards, Alex Beskopilny

[web2py] Re: python2 and python3 in 1 machine

2018-05-19 Thread Alex Beskopilny
You are right , sym-link is simple example. In multi-python multi-web2py envs I use to full path to python (centos 7 /etc/systemd/syste/gunicorn.service) --- [Unit] Description=Gunicorn instance to serve web2py After=network.target [Service] User=w2p Group=w2p

[web2py] Re: python2 and python3 in 1 machine

2018-05-18 Thread Alex Beskopilny
you missed adduser pyuser sudo su pyuser :( вторник, 8 мая 2018 г., 3:11:37 UTC+3 пользователь 黄祥 написал: > > plan to test web2py both python2 and python3 in 1 machine, any idea how to > do that in the safety way? > already googling found this: > > brew update > brew install python > brew

[web2py] Re: python2 and python3 in 1 machine

2018-05-18 Thread Alex Beskopilny
use anaconda . 1 adduser pyuser 2 su pyuser 3 install anaconda https://conda.io/miniconda.htmlto ~/opt 4 conda create --name mypython3 python=3 ln -s ~/.conda/envs/mypython3/bin/python3 ~/bin/mypy3 5 conda create --name mypython2 python=2 ln -s

[web2py] Re: FYI: A tutorial on how to customize export in SQLFORM.grid

2018-04-03 Thread Alex Beskopilny
Hi! exporter example 0 pip install xlwt 1 at end of gluon/sqlhtml.py class ExporterXLS(ExportClass): label = 'XLS' file_ext = "xls" content_type = ".xls" # https://gist.github.com/brendano/22764 # https://groups.google.com/forum/#!topic/web2py/MR_8JzzP9o4 def

[web2py] Re: compiling application ?

2018-03-02 Thread Alex Beskopilny
try this cd /home/w2p/web2py python -c "import gluon.compileapp; gluon.compileapp.compile_application('applications/myapp')" # for using gzip compression with nginx # https://www.digitalocean.com/community/tutorials/how-to-add-the-gzip-module-to-nginx-on-ubuntu-14-04 #

[web2py] Re: only static files forbidden on centos 7.4 apache 2.4

2018-02-14 Thread Alex Beskopilny
also, it's very useful sslh https://github.com/yrutschle/sslh works fine with nginx суббота, 10 февраля 2018 г., 17:11:43 UTC+3 пользователь lucas написал: > > hey all, > > setting up a new server on centos 7.4 and apache 2.4. web2py is running > fine for i get the welcome content but none of

[web2py] Re: only static files forbidden on centos 7.4 apache 2.4

2018-02-14 Thread Alex Beskopilny
we use nginx with http2 rebuild nginx with http2 support on centos 7 - export NXT_CC_NAME=gcc # default compiller for nginx OPENSSL="openssl-1.0.2h" # ok with nginx-1.11.13-1

[web2py] Re: only static files forbidden on centos 7.4 apache 2.4

2018-02-13 Thread Alex Beskopilny
nginx much better :) simple setup - https://www.digitalocean.com/community/tutorials/how-to-deploy-web2py-python-applications-with-uwsgi-and-nginx-on-centos-7 суббота, 10 февраля 2018 г., 17:11:43 UTC+3 пользователь lucas написал: > > hey all, > > setting up a new server on centos 7.4 and

[web2py] Re: Resetting the database

2018-01-29 Thread Alex Beskopilny
truncate with foreign-key depends on DB. for postgresql : def clear_tbls(): str1 = ','.join( [ t for t in db.tables() if "auth_" not in t] ) if len(str1): db.executesql( 'truncate {} RESTART IDENTITY'.format(str1) ) понедельник, 14 ноября 2011 г., 3:38:15 UTC+3

[web2py] Re: 'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128)

2018-01-15 Thread Alex Beskopilny
use encode () decode() for utf8 message example: 1 def cyr2upper(inp,up=True): if len(inp) > STR_LEN_LIMIT: inp= inp[:STR_LEN_LIMIT] try: inp=inp.decode('utf8') except UnicodeDecodeError, e: inp=u'Уточните данные , плс, :)' symbols =

[web2py] Re: 'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128)

2018-01-14 Thread Alex Beskopilny
we can set page encoding in models/db.py T.force('ru') if request.env.wsgi_url_scheme in ['https', 'HTTPS']: session.secure() ... пятница, 5 января 2018 г., 22:41:19 UTC+3 пользователь Alexey Zaytsev написал: > > >

[web2py] Re: web2py gunicorn dockerfile

2018-01-09 Thread Alex Beskopilny
small fix - use dockerDNS 1 # run.sh docker rm $(docker stop $(docker ps -a -q --filter ancestor=w2pnginx --format="{{.ID}}")) docker rm $(docker stop $(docker ps -a -q --filter ancestor=w2pguni --format="{{.ID}}")) docker network rm w2pnet docker network create --subnet=172.25.0.0/16 w2pnet

[web2py] Re: web2py gunicorn dockerfile

2018-01-09 Thread Alex Beskopilny
four files in same directory 1 #guniDoc FROM python:2.7 RUN apt update && apt install -y unzip wget ENV PATH=/usr/local/bin:$PATH RUN pip install gunicorn RUN useradd -m -r web2py USER web2py WORKDIR /home/web2py RUN wget -c http://web2py.com/examples/static/web2py_src.zip && \ unzip -o

[web2py] Re: web2py gunicorn dockerfile

2018-01-06 Thread Alex Beskopilny
small fix 1 FROM python:2.7 RUN apt update && apt install -y unzip wget RUN /usr/local/bin/pip install gunicorn RUN groupadd -r web2py && useradd -m -r -g web2py web2py USER web2py WORKDIR /home/web2py RUN wget -c http://web2py.com/examples/static/web2py_src.zip && unzip -o web2py_src.zip &&

[web2py] Re: web2py gunicorn dockerfile

2018-01-06 Thread Alex Beskopilny
1 Dockerfile FROM python:2.7 RUN apt update && apt install -y unzip wget RUN /usr/local/bin/pip install gunicorn RUN groupadd -r web2py && useradd -m -r -g web2py web2py USER web2py RUN cd /home/web2py/ && wget -c http://web2py.com/examples/static/web2py_src.zip && unzip -o web2py_src.zip

[web2py] Re: web2py gunicorn dockerfile

2018-01-05 Thread Alex Beskopilny
Hi set WORKDIR in Dockerfile .. WORKDIR /home/site/web2py EXPOSE 80 CMD . /home/.. .. docker run 3001:80 image-name On Friday, January 5, 2018 at 5:45:04 AM UTC+3, 黄祥 wrote: > > just wondering why gunicorn dockerfile with web2py/anyserver.py is not > work when use with python:2.7

[web2py] Re: execute web2py modules in terminal on 2.16.1

2018-01-04 Thread Alex Beskopilny
Hi! replace print "install" with print ("install") On Tuesday, January 2, 2018 at 10:06:31 PM UTC+3, 黄祥 wrote: > > cant execute from terminal web2py modules while in previous version is > work fine > *step on local machine (terminal)* > python -V > Python 2.7.10 > cd > rm -rf

[web2py] Re: Creating users and set the password, how??

2017-12-22 Thread Alex Beskopilny
#model/db.py if not db().select(db.auth_user.ALL).first(): uid=db.auth_user.insert( password = db.auth_user.password.validate('mypassword')[0], email = 'n...@null.com', first_name = 'Sy', last_name = 'Adm', )

[web2py] Re: fonts.googleapis

2017-12-13 Thread Alex Beskopilny
On Friday, December 8, 2017 at 1:06:35 PM UTC+3, T.R.Rajkumar wrote: > > I have an application. The views extend layout.html. When there is no > internet connection my pages wait for fonts.googleapis.com > I dont want that to happen. How to remove the dependecy on > fonts.gooleapis.com >

[web2py] Re: fonts.googleapis

2017-12-08 Thread Alex Beskopilny
On Friday, December 8, 2017 at 1:06:35 PM UTC+3, T.R.Rajkumar wrote: > > I have an application. The views extend layout.html. When there is no > internet connection my pages wait for fonts.googleapis.com > I dont want that to happen. How to remove the dependecy on > fonts.gooleapis.com > hI!