[web2py] Re: Web3py

2019-04-30 Thread 黄祥
tested web3py/test return an error, detail error and step below:
docker pull ubuntu
docker run -it --privileged ubuntu /bin/bash

apt update
apt install -y git python3-pip
cd
git clone https://github.com/web2py/web3py
cd web3py
pip3 install -r requirements.txt
pip3 install mechanize
cd web3py/tests
root@b41c0655fd23:~/web3py/web3py/tests# python3 test_action.py
Traceback (most recent call last):
  File "test_action.py", line 9, in 
from web3py import action, DAL, Field, Session, Cache
ModuleNotFoundError: No module named 'web3py'
root@b41c0655fd23:~/web3py/web3py/tests# pip3 install web3py
Collecting web3py
  Using cached https:
//files.pythonhosted.org/packages/ee/a2/f57e1fefb0c62b4423fd76ea359d58d2363982054050b8c0ab54ed4b84c5/web3py-0.1.20190426.tar.gz
Complete output from command python setup.py egg_info:
fatal: not a git repository (or any of the parent directories): .git
Traceback (most recent call last):
  File "", line 1, in 
  File "/tmp/pip-build-m4zx1t4i/web3py/setup.py", line 25, in 
long_description=__doc__ + ' (%s)' % get_hash(),
  File "/tmp/pip-build-m4zx1t4i/web3py/setup.py", line 13, in get_hash
return subprocess.check_output(['git', 'rev-parse', 'HEAD']).strip
().decode('utf8')
  File "/usr/lib/python3.6/subprocess.py", line 336, in check_output
**kwargs).stdout
  File "/usr/lib/python3.6/subprocess.py", line 418, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['git', 'rev-parse', 'HEAD']' 
returned non-zero exit status 128.


Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-
build-m4zx1t4i/web3py/

even run web3py-start in background still got the same error
cd ../..
./web3py-start applications/ &
cd web3py/tests
root@b41c0655fd23:~/web3py/web3py/tests# python3 test_action.py
Traceback (most recent call last):
  File "test_action.py", line 9, in 
from web3py import action, DAL, Field, Session, Cache
ModuleNotFoundError: No module named 'web3py'

the rest of test files (web3py/tests/test_*.py) return the same error.

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: Future of web2py

2019-04-30 Thread villas
Check this out: 
https://github.com/web2py/web3py

Search this current group for recent posts on 'web3py'.

Regards, D



On Tuesday, 30 April 2019 18:35:04 UTC+1, Gabor Nyul wrote:
>
> We are talking for about 2 years now about a possible web3py and other 
> possible addons to it.
> What do you think, when we can get the first insight of it? If at all...
>
>

-- 
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] Strange AttributeError on grid edit

2019-04-30 Thread jcrmatos
Hello,

I have this grid:
grid = SQLFORM.grid(
query,
create=create,
csv=False,
deletable=deletable,
details=False,
editable=editable,
# Disable delete checkbox in edit form.
editargs=dict(deletable=False),
field_id=db.equipment.id,
fields=fields,
headers={'sn_counter.name': T('SN counter')},
links=[
lambda row: A(
T('Pow. supp.'),
_href=URL(
'single_equip',
'set_session_vars',
args=[row.equipment.id],
vars={
'table_name': 'equip_ps',
'parent_id_field_name': 'ps_id',
'parent_table_name': 'power_supply',
# Only sid because next page has search
# (which uses vars).
'sid': request.vars.sid,
},
),
_id='power_supply',
),

...

Definitions above the grid are
query = db.equipment.sn_counter_id == db.sn_counter.id

create, deletable and editable are True/False according to the user 
permissions.
ondelete and onvalidation are a function/None according to the user 
permissions.

The links on the grid work fine, new record works fine, but edit returns a 
strange AttributeError.

I was able to identify the problem has been the args argument.
If I change
args=[row.equipment.id],
with
args=[str(row).split("'id': ")[1].split('},')[0]],
everything works, including edit. What I'm doing is extracting the id from 
the string converted row.

I have no idea why this strange error occurs.

Any ideas?

The complete traceback:
ERROR:web2py:Traceback (most recent call last):
  File "c:\web2py\gluon\restricted.py", line 219, in restricted
exec(ccode, environment)
  File "c:\web2py\applications\ajc\controllers/equipment.py", line 398, in <
modu
le>
  File "c:\web2py\gluon\globals.py", line 421, in 
self._caller = lambda f: f()
  File "c:\web2py\gluon\tools.py", line 3877, in f
return action(*a, **b)
  File "c:\web2py\applications\ajc\controllers/equipment.py", line 341, in 
index

user_signature=False,
  File "c:\web2py\gluon\sqlhtml.py", line 2610, in grid
res = DIV(buttons(view=details, record=record),
  File "c:\web2py\gluon\sqlhtml.py", line 2532, in buttons
elif link(record):
  File "c:\web2py\applications\ajc\controllers/equipment.py", line 236, in <
lamb
da>
args=[row.equipment.id],
  File "c:\web2py\gluon\packages\dal\pydal\objects.py", line 116, in 
__getattr__

return self.__getitem__(k)
  File "c:\web2py\gluon\packages\dal\pydal\objects.py", line 100, in 
__getitem__

v = self[key] = lg(key)
  File "c:\web2py\gluon\packages\dal\pydal\objects.py", line 2490, in 
__call__
raise AttributeError()
AttributeError

My env:
web2py 2.18.5
Python 3.7.1 x86
Firefox 66.0.3 x64
Windows 7 Pro x64 SP1+all upd


Thanks,

JM

-- 
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: Grid search and clear buttons don't restore request.args. Where can I correct that?

2019-04-30 Thread jcrmatos
Found the solution.

I have to add
args=request.args[:1],
to the child grid.

terça-feira, 30 de Abril de 2019 às 00:37:24 UTC+1, Anthony escreveu:
>
> What do you mean by master-child pages? Are you using smartgrid? Can you 
> show some code?
>
> On Monday, April 29, 2019 at 6:15:30 PM UTC-4, jcrm...@gmail.com 
>  wrote:
>>
>> Grid search and clear buttons don't restore request.args. Where can I 
>> correct that?
>>
>>
>> If using master-child pages, the master grid search works fine (because 
>> there are no request.args), but the child grid (which has request.args, 
>> from the master record) doesn't because the search and clear buttons don't 
>> restore the request.args.
>>
>>
>> web2py 2.18.5
>> Python 3.7.1 x86
>> Firefox 66.0.3 x64
>> Windows 7 Pro x64 SP1+all upds
>>
>

-- 
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: Future of web2py

2019-04-30 Thread Gabor Nyul
We are talking for about 2 years now about a possible web3py and other 
possible addons to it.
What do you think, when we can get the first insight of it? If at all...

-- 
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] Web2py Windows edition with 3.x Interpreter

2019-04-30 Thread Nico Zanferrari
Hi rama,

I've read that pip was not working with the binary package, but I've never
actually tried it ;-) I'm happy to hear that it works fine - and that it
has resolved your problem with the pandas module (at least on PY3). I'll
test this a bit, and update my HOWTO page!

About pynsist, it seems to me like the NSIS Setup tool + PyInstaller (and
it does not support Mac). I like the idea but I don't see any big advantage
over PyInstaller itself.

Thank you,
Nico

Il giorno mar 30 apr 2019 alle ore 05:15 rāma  ha
scritto:

> Hi Nico,
>
> Thanks for your inputs.
>
> I've actually run windows py2.7 binary with modules within site-packages,
> and pip can be leveraged by setting your target folder like this: pip
> install -t site-packages . Just for the benefit of other
> readers. It's just that pandas didn't quite work for me in py2.7 and ported
> my code to python 3.5+.
>
> It is convenient to distribute your app and whole web2py as a binary or as
> a client for desktop users. If we were to package with pynsist with
> webview:
> https://github.com/takluyver/pynsist/tree/master/examples/pywebview it
> can act *like *a standalone binary app on Windows or Mac masking the
> local web address. I also see a value in this as a way forward to have
> python based program running like a program locally on a client rather in
> the cloud wherever necessary cloud sync can be employed. I have not been
> successful with pynsist though.
>
> Best,
> rama
>
> On Monday, 29 April 2019 20:49:49 UTC+8, Nico Zanferrari wrote:
>>
>> Hi rama,
>>
>> first of all, note that the shell.py fix will resolve only the
>> 'cosmethic' problem of the help command (and "copyright", "credits" ,
>> "license" commands) that doesn't work in the interactive shell. But it will
>> not change the import problem in any way.
>>
>>
>> According to the manual, if you run web2py *from source* you can import
>> from it any python module that is in the PYTHONPATH (sys.path) - which is
>> automatically changed by web2py in order to include also
>> web2py/site-packages (globally) and web2py/application/yourapp/modules
>> (inside yourapp).
>> The last one is preferred if you are planning to distribute the app or
>> you are experimenting with different versions of the same module. It also
>> has higher priority and can even be accessed by other apps as
>> web2py/application/anotherapp/modules.
>>
>> If you run web2py *from the compiled binary*, any system-wide folder
>> will be ignored - only what's down the web2py folder will be available.
>> Modules can be placed on the folders: web2py, web2py/site-packages
>> (globally for all the apps) and web2py/application/yourapp/modules (inside
>> yourapp). You can check it by yourself with the interactive shell and the
>> simple helloworld.py module.
>>
>> What's different and problematic in the 'running from binary' is that you
>> cannot use pip (or similar) for installing modules inside. You instead have
>> to pip-install them on a full system (that has python of the same version
>> of the binary one) and manually copy the related files inside the binary
>> folders. For complex module like pandas, you also have to copy all the
>> files for the related pre-requisites - and possibly test them one by one.
>>
> Unfortunately, this could fail - expecially if the modules have binary
>> files. In this case, the last resort is to try to compile the binary
>> version by yourself from a working web2py source - following the
>> instructions on my repository and specifying your additional needed
>> modules. Maybe PyInstaller will play the module dependency game better than
>> you ;-)
>>
>>
>> I've also copied these advices on this howto page
>> 
>>  for
>> future reference - feel free to correct me if I was wrong somewhere!
>>
>>
>> Cheers,
>> Nico
>>
>>
>> Il giorno lun 29 apr 2019 alle ore 04:24 rāma  ha
>> scritto:
>>
>>> Hi Nico,
>>>
>>> Thank you for the insights. I am actually importing a number of modules
>>> within the controllers fyi, not only via shell.
>>>
>>> Would patching shell.py fix the behaviour application wide?
>>>
>>> Do you suggest I pip install into site-packages again instead of copying
>>> from my source version? I suspect that it's not going to fix it.
>>>
>>> Folder structure:
>>> web2py
>>>|_site-packages <- here's where my modules are
>>>
>>> I am trying to package and bundle the whole web2py for work as an app
>>> solution and for test release soon.
>>> Your experimental binaries would definitely help me to do early test
>>> with users while waiting for the official binaries. I could do some quick
>>> patches on web2py if required too, please advise how.
>>>
>>> Best,
>>> rama
>>>
>>> On Monday, 29 April 2019 05:30:55 UTC+8, Nico Zanferrari wrote:

 I've found why the help command (and "copyright", "credits" ,
 "license")  it's missing. It's due to the fact that PyInstaller replaces
 the original python mod

Re: [web2py] bye bye T, welcome pluralize

2019-04-30 Thread Carlos Costa
Looks nice!

What would be the best approach to translate phrases and longer texts?

Em seg, 29 de abr de 2019 às 10:59, Carlos Cesar Caballero Díaz <
carlos.caball...@cfg.jovenclub.cu> escreveu:

> It looks good!! I can work to support categories if you think it worth it.
> Allow something like T("string", "category") or T("string",
> cat="category"). A category would map to an specific folder of json
> internationalization files, if there is no category specified, it will map
> to a default category. Something like this would make the translations
> reutilization easier.
>
> Greetings.
> El 26/4/19 a las 1:53 a.m., Massimo Di Pierro escribió:
>
> web3py now uses this:
>
> https://pypi.org/project/pluralize/
> https://github.com/web2py/pluralize
>
> thoughts? comments?
>
> --
> 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.
>


-- 
At.

Carlos J. Costa
--
Cientista da Computação - Esp. Gestão em Telecom

-- 
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: pyDAL -> jsDAL?

2019-04-30 Thread António Ramos
If vuejs is the way to go (thank you massimo for the choice...) i think it
should evolve also to vuex for client store and use something like this for
persistence.
https://flaviocopes.com/vuex-persist-localstorage/
I think we can kill 2 rabbits with just one bullet...

Em ter, 30 de abr de 2019 às 12:42, villas  escreveu:

> Hi Scott
>
> It's probably unrealistic to imagine that a proper DB would be stored
> locally.  I mean, where would its contents come from?  If the answer is a
> remote DB, then you are already back at square one.
>
> However, it still makes sense to cache data on the client side. When the
> cache gets larger,  it makes sense to think more about Local Storage.  But
> we already have that now.
> 
>
> The main obstacle for local storage is keeping the data fresh,  and that
> includes the user himself updating it.
>
> Most of the logic leads us back to web services, REST interfaces and DBs
> in the 'cloud'.  I guess that's where we're all heading!
>
> Regards,  D
>
>
>
> On Tuesday, 30 April 2019 01:47:36 UTC+1, Scott Hunter wrote:
>>
>>
>> The direction from web2py to web3py seems to be applications where the
>> server is responsible for (relatively) static pages which use Javascript
>> for their dynamic aspects & talking to the server via an API, primarily for
>> interaction w/ the database.
>>
>> In the spirit of Progressive Web Apps, one could imagine getting to the
>> point where instead of making calls to the server, Javascript functions are
>> called instead to interact w/ an SQLite DB under the browser's control.
>> Doing so via something like pyDAL, but replacing Python with Javascript &
>> only needing to support SQLite would not only ease the burden of writing
>> such code, but make it easier to make a transition between these two DB
>> locations.
>>
>> I'm actually thinking specifically of being able to deploy a pared-down
>> version of a "normal" application which could perform most of its
>> functionality off-line, and use online access only for transferring
>> information in bulk between the local DB and the one in the cloud.  The
>> more that those applications can share code, the better.  (I've
>> accomplished this goal, somewhat clunkily, by deploying the web2py binary
>> w/ a limited version of the app in the cloud; an approach as I've described
>> above seems that it wouldn't be nearly as brittle.)
>>
>> Does this make any sense?  Would something like a jsDAL be prohibitively
>> difficult to write, or not really worth the effort?
>>
> --
> 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: Add recoCrud form into modal

2019-04-30 Thread villas
It looks like you're starting at the beginning and using modals can be a 
headache.  
On a general note,  I believe we can best make progress using small steps,  
so I recommend...

   - Start by creating a form in your controller.
   - Display the form in your view inside a hidden div.  
   - Then when you click the Add button, simply show the form with 
   Javascript.
   - Once you've got that working.  Re-work the view to do the same thing 
   using a modal.

This will be a good way to get where you want to go!

Best wishes,  D


On Tuesday, 30 April 2019 05:54:03 UTC+1, Cristina Sig wrote:
>
> Hello everyone,
>
>
> I have a button to add records. What I am trying to do is when I click on 
> it I want to display a modal that contains a Crud form to create/add a new 
> record. 
>
> Something like this Example 
> 
>
> Any suggestions to do that?
> This is my try
>
>
> Controller
>
> def Person():
> person= db(db.Person.id>0).select()
> return dict(formListar=person)
>
>
> View
>
> 
>  $('#add').click(function(e) {
>  e.preventDefault();
>  btn = $(this);
>  thisHref = btn.attr('href');
>  $('#myModalAdd').modal('show')
>  .one('click', '#warning', function(e) {
> window.location = thisHref;});
>  });
> 
>
>
>  href="/{{=request.application}}/Tools/AddPerson"> class="glyphicon glyphicon-plus"> Add Person
>
>
> 
>   
> 
>   
>Add Person
>   
>   
>
>{{=formListar}}
>
>   
>   
>   
>  
> 
>   
>
>
>
>
>
>

-- 
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: pyDAL -> jsDAL?

2019-04-30 Thread villas
Hi Scott

It's probably unrealistic to imagine that a proper DB would be stored 
locally.  I mean, where would its contents come from?  If the answer is a 
remote DB, then you are already back at square one.

However, it still makes sense to cache data on the client side. When the 
cache gets larger,  it makes sense to think more about Local Storage.  But 
we already have that now. 


The main obstacle for local storage is keeping the data fresh,  and that 
includes the user himself updating it.

Most of the logic leads us back to web services, REST interfaces and DBs in 
the 'cloud'.  I guess that's where we're all heading!

Regards,  D  



On Tuesday, 30 April 2019 01:47:36 UTC+1, Scott Hunter wrote:
>
>
> The direction from web2py to web3py seems to be applications where the 
> server is responsible for (relatively) static pages which use Javascript 
> for their dynamic aspects & talking to the server via an API, primarily for 
> interaction w/ the database.
>
> In the spirit of Progressive Web Apps, one could imagine getting to the 
> point where instead of making calls to the server, Javascript functions are 
> called instead to interact w/ an SQLite DB under the browser's control. 
>  Doing so via something like pyDAL, but replacing Python with Javascript & 
> only needing to support SQLite would not only ease the burden of writing 
> such code, but make it easier to make a transition between these two DB 
> locations.
>
> I'm actually thinking specifically of being able to deploy a pared-down 
> version of a "normal" application which could perform most of its 
> functionality off-line, and use online access only for transferring 
> information in bulk between the local DB and the one in the cloud.  The 
> more that those applications can share code, the better.  (I've 
> accomplished this goal, somewhat clunkily, by deploying the web2py binary 
> w/ a limited version of the app in the cloud; an approach as I've described 
> above seems that it wouldn't be nearly as brittle.)
>
> Does this make any sense?  Would something like a jsDAL be prohibitively 
> difficult to write, or not really worth the effort?
>

-- 
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: pyDAL -> jsDAL?

2019-04-30 Thread Anthony
There is no SQLite in the browser, unless you are talking about something 
like https://github.com/kripken/sql.js, though that is very heavy and is 
in-memory only. There are a number of packages that provide an abstraction 
over IndexedDB, such as Dexie.js, AlaSQL, Nano-SQL, Lovefield, etc. Maybe 
have a look at their codebases to get a sense of the complexity involved.

Anthony

On Monday, April 29, 2019 at 8:47:36 PM UTC-4, Scott Hunter wrote:
>
>
> The direction from web2py to web3py seems to be applications where the 
> server is responsible for (relatively) static pages which use Javascript 
> for their dynamic aspects & talking to the server via an API, primarily for 
> interaction w/ the database.
>
> In the spirit of Progressive Web Apps, one could imagine getting to the 
> point where instead of making calls to the server, Javascript functions are 
> called instead to interact w/ an SQLite DB under the browser's control. 
>  Doing so via something like pyDAL, but replacing Python with Javascript & 
> only needing to support SQLite would not only ease the burden of writing 
> such code, but make it easier to make a transition between these two DB 
> locations.
>
> I'm actually thinking specifically of being able to deploy a pared-down 
> version of a "normal" application which could perform most of its 
> functionality off-line, and use online access only for transferring 
> information in bulk between the local DB and the one in the cloud.  The 
> more that those applications can share code, the better.  (I've 
> accomplished this goal, somewhat clunkily, by deploying the web2py binary 
> w/ a limited version of the app in the cloud; an approach as I've described 
> above seems that it wouldn't be nearly as brittle.)
>
> Does this make any sense?  Would something like a jsDAL be prohibitively 
> difficult to write, or not really worth the effort?
>

-- 
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: Grid search and clear buttons don't restore request.args. Where can I correct that?

2019-04-30 Thread jcrmatos
Just noticed now that both search and clear search buttons URLs also remove 
the search=1 var, but maintain the sid var. Strange isn't it?


terça-feira, 30 de Abril de 2019 às 00:37:24 UTC+1, Anthony escreveu:
>
> What do you mean by master-child pages? Are you using smartgrid? Can you 
> show some code?
>
> On Monday, April 29, 2019 at 6:15:30 PM UTC-4, jcrm...@gmail.com 
>  wrote:
>>
>> Grid search and clear buttons don't restore request.args. Where can I 
>> correct that?
>>
>>
>> If using master-child pages, the master grid search works fine (because 
>> there are no request.args), but the child grid (which has request.args, 
>> from the master record) doesn't because the search and clear buttons don't 
>> restore the request.args.
>>
>>
>> web2py 2.18.5
>> Python 3.7.1 x86
>> Firefox 66.0.3 x64
>> Windows 7 Pro x64 SP1+all upds
>>
>

-- 
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: Grid search and clear buttons don't restore request.args. Where can I correct that?

2019-04-30 Thread jcrmatos
I have a master page (in this case an equipment's grid) where I have links 
to child tables.
The URL for the equipment's page is
http:
//jmatos-p:8000/equipment?search=1&sid=d4b3d39a-b6bc-4c41-af05-d2e9bf7ea195

In this page the search and clear search buttons work fine and show the 
correct URLs, but this page doesn't have args.

When I go to one of the child's page (using the grid link) I have the below 
URL. Every child page contains a grid with the child's table records.
http:
//jmatos-p:8000/single_equip/index/11?search=1&sid=d4b3d39a-b6bc-4c41-af05-d2e9bf7ea195

The URL after pressing the search button is changed to (the args are gone 
and this is the problem)
http:
//jmatos-p:8000/single_equip?keywords=equip_ps.ps_id+%3D+%224%22&sid=d4b3d39a-b6bc-4c41-af05-d2e9bf7ea195

The URL after pressing clear search button is changed to (the args are gone 
and this is the problem)
http:
//jmatos-p:8000/single_equip?keywords=&sid=d4b3d39a-b6bc-4c41-af05-d2e9bf7ea195

The search and clear search actions work fine. The problem is only the URLs 
they construct that are missing the args.



terça-feira, 30 de Abril de 2019 às 00:37:24 UTC+1, Anthony escreveu:
>
> What do you mean by master-child pages? Are you using smartgrid? Can you 
> show some code?
>
> On Monday, April 29, 2019 at 6:15:30 PM UTC-4, jcrm...@gmail.com 
>  wrote:
>>
>> Grid search and clear buttons don't restore request.args. Where can I 
>> correct that?
>>
>>
>> If using master-child pages, the master grid search works fine (because 
>> there are no request.args), but the child grid (which has request.args, 
>> from the master record) doesn't because the search and clear buttons don't 
>> restore the request.args.
>>
>>
>> web2py 2.18.5
>> Python 3.7.1 x86
>> Firefox 66.0.3 x64
>> Windows 7 Pro x64 SP1+all upds
>>
>

-- 
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] pyDAL -> jsDAL?

2019-04-30 Thread António Ramos
I think you are talking about something like this
http://docs.deployd.com/docs/collections/accessing-collections.html
I like the idea :)

Em ter, 30 de abr de 2019 às 01:47, Scott Hunter 
escreveu:

>
> The direction from web2py to web3py seems to be applications where the
> server is responsible for (relatively) static pages which use Javascript
> for their dynamic aspects & talking to the server via an API, primarily for
> interaction w/ the database.
>
> In the spirit of Progressive Web Apps, one could imagine getting to the
> point where instead of making calls to the server, Javascript functions are
> called instead to interact w/ an SQLite DB under the browser's control.
> Doing so via something like pyDAL, but replacing Python with Javascript &
> only needing to support SQLite would not only ease the burden of writing
> such code, but make it easier to make a transition between these two DB
> locations.
>
> I'm actually thinking specifically of being able to deploy a pared-down
> version of a "normal" application which could perform most of its
> functionality off-line, and use online access only for transferring
> information in bulk between the local DB and the one in the cloud.  The
> more that those applications can share code, the better.  (I've
> accomplished this goal, somewhat clunkily, by deploying the web2py binary
> w/ a limited version of the app in the cloud; an approach as I've described
> above seems that it wouldn't be nearly as brittle.)
>
> Does this make any sense?  Would something like a jsDAL be prohibitively
> difficult to write, or not really worth the effort?
>
> --
> 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: Grid search collects all records from all fields on each request. Isn't this bad for performance?

2019-04-30 Thread jcrmatos
Ok, thanks Anthony.

terça-feira, 30 de Abril de 2019 às 00:34:10 UTC+1, Anthony escreveu:
>
> On Monday, April 29, 2019 at 6:22:26 PM UTC-4, jcrm...@gmail.com 
>  wrote:
>>
>> Grid search collects all records from all fields on each request. Isn't 
>> this bad for performance?
>>
>
> Are you referring to "reference" fields, which result in a select element 
> showing associated values from the foreign table? If so, that is the result 
> of the default IS_IN_DB validator given to such fields, which results in a 
> select element being created when the field appears in forms as well as the 
> search menu. You can override this behavior by putting the validator in a 
> list:
>
> db.mytable.myreferencefield.requires = [db.mytable.myreferencefield]
>
> However, in that case, forms and the search menu will simply present a 
> numeric input field, and you would need to search by the record ID, so 
> probably not very useful. Alternatively, you can specify an autocomplete 
> widget, but that won't help in the grid search menu.
>  
>
>> Isn't it possible to change this behavior to only load the records when 
>> the user selects a specific field to do the search?
>>
>
> Feel free to submit a pull request. Alternatively, you can specify both a 
> custom search menu and a custom search function via the "search_widget" and 
> "searchable" arguments, respectively. For ideas on the former, see 
> SQLFORM.search_menu, and for the latter, see SQLFORM.build_query.
>
> 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.