[web2py] Re: Deleting all items of a selecte ID at the same time

2019-01-06 Thread mostwanted
My delete function is not working, I think I am doing doing something wrong 
but i'm not sure where, I thought the code below would get me home but 
nothing is happening, nothing is getting deleted! Please advice:

*DELETE FUNCTION CONTROLLER CODE:*
def deleteInvoice():
query=db.invoice(request.args(0, cast=int))
remove=db(db.invoice.customer==query.id).delete()
if remove:
redirect(URL('registeredClients'))
return locals()



On Sunday, January 6, 2019 at 4:35:36 PM UTC+2, Anthony wrote:
>
> On Sunday, January 6, 2019 at 9:15:41 AM UTC-5, mostwanted wrote:
>>
>> Hey Anthony, thanks for the heads up in the garbage code in the 
>> controller i will address it, with regards to deleting invoices i want to 
>> be able to delete all invoices in the db.invoice table but only for a 
>> specific selected client. I want to be able to delete an entire invoice by 
>> clicking the link once.
>>
>
> Then you would need a query like:
>
> db(db.invoice.client = some_client_id).delete()
>
> You would want to make sure the current user is authorized to delete 
> invoices for some_client_id (specifically, if some_client_id comes from 
> the browser, be sure to validate it).
>
> Also, in the UI, you should probably make it clear what will happen, as 
> "Delete Invoice" makes me think I'm deleting only the current invoice, not 
> all invoices.
>
> Anthony
>
>

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


[web2py] Re: DAL's fake_migrat and fake_migrate_all and migration problem with auth tables

2019-01-06 Thread icodk
Thanks Antony.
I already have the line
auth.define_tables(username=False, signature=False)
and the book mentions: migrate=False as a parameter to auth.define_tables
However it was not obvious for me that it can be used this way
This topic certainly increased my understanding of web2py
Thanks


On Monday, January 7, 2019 at 2:07:03 AM UTC+1, Anthony wrote:
>
> On Sunday, January 6, 2019 at 2:41:53 PM UTC-5, icodk wrote:
>>
>> Thanks to all of you 
>> How do I add migrate to the auth tables ?
>> I use 
>> auth.settings.extra_fields for extra fields but  entering 
>> migrate='db1_auth_user.table'  does not fits in this structure
>>
>
> You can do:
>
> auth.define_tables(..., migrate="db1_")
>
> and the *.table files will end up like db1_auth_user.table, 
> db1_auth_group.table, etc.
>
> Anthony
>

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


[web2py] OperationalError: no such table: web2py_filesystem

2019-01-06 Thread 黄祥
*models/db.py*
from gluon.dal import InDBMigrator
db = DAL(configuration.get(configuration_env + '_' + 'db.uri'), 
 pool_size = configuration.get(configuration_env + '_' + 'db.pool_size'), 
 migrate_enabled = configuration.get(configuration_env + '_' + 
'db.migrate_enabled'), 
 migrate = configuration.get(configuration_env + '_' + 'db.migrate'), 
 fake_migrate = configuration.get(configuration_env + '_' + 
'db.fake_migrate'), 
 fake_migrate_all = configuration.get(configuration_env + '_' + 
'db.fake_migrate_all'), 
 adapter_args = dict(migrator = InDBMigrator), 
 check_reserved = ['all'], 
 ignore_field_case = True, 
 entity_quoting = False, 
 lazy_tables = True
 )

*private/appconfig.ini*
[dev_db]
uri  = sqlite://test.sqlite
pool_size= 10 ; ignored for sqlite
migrate_enabled  = true
migrate  = true
fake_migrate = false
fake_migrate_all = false

*models/db_schema_0_auth.py*
... cutted ...
auth.define_tables(username = True, signature = True, migrate = 'test_')
custom_auth_table = db[auth.settings.table_user_name]
custom_auth_table._format = '%(first_name)s %(last_name)s'
... cutted ...

2.17.2-stable+timestamp.2018.10.06.18.54.02
(Running on Rocket 1.2.6, Python 2.7.15)

Traceback (most recent call last):
  File "/Users/sugizo/learn/web2py/gluon/restricted.py", line 219, in 
restricted
exec(ccode, environment)
  File 
"/Users/sugizo/learn/web2py/applications/test/models/db_schema_0_auth.py", 
line 9, in 
custom_auth_table = db[auth.settings.table_user_name]
  File "/Users/sugizo/learn/web2py/gluon/packages/dal/pydal/base.py", line 
666, in __getitem__
return self.__getattr__(str(key))
  File "/Users/sugizo/learn/web2py/gluon/packages/dal/pydal/base.py", line 
672, in __getattr__
return self.lazy_define_table(tablename, *fields, **kwargs)
  File "/Users/sugizo/learn/web2py/gluon/packages/dal/pydal/base.py", line 
624, in lazy_define_table
polymodel=polymodel)
  File 
"/Users/sugizo/learn/web2py/gluon/packages/dal/pydal/adapters/base.py", 
line 798, in create_table
return self.migrator.create_table(*args, **kwargs)
  File "/Users/sugizo/learn/web2py/gluon/packages/dal/pydal/migrator.py", 
line 276, in create_table
query), table)
  File "/Users/sugizo/learn/web2py/gluon/packages/dal/pydal/migrator.py", 
line 486, in log
self.file_close(logfile)
  File "/Users/sugizo/learn/web2py/gluon/packages/dal/pydal/migrator.py", 
line 522, in file_close
fileobj.close_connection()
  File 
"/Users/sugizo/learn/web2py/gluon/packages/dal/pydal/helpers/classes.py", 
line 550, in close_connection
self.filename
  File "/Users/sugizo/learn/web2py/gluon/packages/dal/pydal/base.py", line 
772, in executesql
adapter.execute(query)
  File 
"/Users/sugizo/learn/web2py/gluon/packages/dal/pydal/adapters/__init__.py", 
line 67, in wrap
return f(*args, **kwargs)
  File 
"/Users/sugizo/learn/web2py/gluon/packages/dal/pydal/adapters/base.py", 
line 413, in execute
rv = self.cursor.execute(command, *args[1:], **kwargs)
OperationalError: no such table: web2py_filesystem

result when test delete databases/*.tables and the sqlite database
purpose is to learn about migrate value (True, False, 'tablename.table' for 
naming *.table)

thx n 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] custom_auth_table TypeError: a bytes-like object is required, not 'str'

2019-01-06 Thread 黄祥
*models/db.py*
from gluon.dal import InDBMigrator
db = DAL(configuration.get(configuration_env + '_' + 'db.uri'), 
 pool_size = configuration.get(configuration_env + '_' + 'db.pool_size'), 
 migrate_enabled = configuration.get(configuration_env + '_' + 
'db.migrate_enabled'), 
 migrate = configuration.get(configuration_env + '_' + 'db.migrate'), 
 fake_migrate = configuration.get(configuration_env + '_' + 
'db.fake_migrate'), 
 fake_migrate_all = configuration.get(configuration_env + '_' + 
'db.fake_migrate_all'), 
 adapter_args = dict(migrator = InDBMigrator), 
 check_reserved = ['all'], 
 ignore_field_case = True, 
 entity_quoting = False, 
 lazy_tables = True
 )

*private/appconfig.ini*
[dev_db]
uri  = sqlite://test.sqlite
pool_size= 10 ; ignored for sqlite
migrate_enabled  = true
migrate  = true
fake_migrate = false
fake_migrate_all = false

*models/db_schema_0_auth.py*
... cutted ...
auth.define_tables(username = True, signature = True, migrate = 'test_')
custom_auth_table = db[auth.settings.table_user_name]
custom_auth_table._format = '%(first_name)s %(last_name)s'
... cutted ...

*result when access web2py app*
2.17.2-stable+timestamp.2018.10.06.18.54.02
(Running on Rocket 1.2.6, Python 3.7.2)

Traceback (most recent call last):
  File "/Users/sugizo/learn/web2py/gluon/restricted.py", line 219, in 
restricted
exec(ccode, environment)
  File 
"/Users/sugizo/learn/web2py/applications/test/models/db_schema_0_auth.py", 
line 9, in 
custom_auth_table = db[auth.settings.table_user_name]
  File "/Users/sugizo/learn/web2py/gluon/packages/dal/pydal/base.py", line 
666, in __getitem__
return self.__getattr__(str(key))
  File "/Users/sugizo/learn/web2py/gluon/packages/dal/pydal/base.py", line 
672, in __getattr__
return self.lazy_define_table(tablename, *fields, **kwargs)
  File "/Users/sugizo/learn/web2py/gluon/packages/dal/pydal/base.py", line 
624, in lazy_define_table
polymodel=polymodel)
  File 
"/Users/sugizo/learn/web2py/gluon/packages/dal/pydal/adapters/base.py", 
line 798, in create_table
return self.migrator.create_table(*args, **kwargs)
  File "/Users/sugizo/learn/web2py/gluon/packages/dal/pydal/migrator.py", 
line 296, in create_table
sql_fields_old = pickle.load(tfile)
TypeError: a bytes-like object is required, not 'str'

same code test in python 2.7.15 running well

thx n 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] cant access error admin

2019-01-06 Thread 黄祥
cant access error admin
url : 
http://localhost:8000/admin/default/ticket/admin/127.0.0.1.2019-01-07.11-40-26.d14ede65-9b57-4176-9868-1b1213357273

2.17.2-stable+timestamp.2018.10.06.18.54.02
(Running on Rocket 1.2.6, Python 3.7.2)

Traceback (most recent call last):
  File "/Users/sugizo/learn/web2py/gluon/restricted.py", line 219, in 
restricted
exec(ccode, environment)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xca in position 2: 
ordinal not in range(128)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/sugizo/learn/web2py/gluon/restricted.py", line 141, in 
__init__
self.traceback = traceback.format_exc()
AttributeError: 'NoneType' object has no attribute 'strip'

thx n 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.


Re: [web2py] Re: modular web2py - need help

2019-01-06 Thread sandeep patel
Thank you, Massimo,
Now it's working

Thanks & Regards
Sandeep

On Sat, Jan 5, 2019 at 11:42 PM Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

>
> If you are getting the error:
>
> ImportError: cannot import name 'Cookie'
>
> Either your are not installing the latest pydal or you have two versions (one 
> in Python site-packages?).
> If you can import pydal from outside the web2py folder, then the problem is 
> the latter. Un-install it because it will create problems.
>
> Massimo
>
> On Tuesday, 1 January 2019 16:04:33 UTC-8, Massimo Di Pierro wrote:
>>
>> Based on my new years resolution:
>>
>> - I posted a new web2py branch called modular.
>> - I moved template.py into its own folder planning to make its own package
>> - I refactored validators.py and scheduler.py and moved them into pydal
>> (also branch modula)
>>
>> Thoughts?
>> Can you help testing that nothing broke in web2py?
>>
>> Massimo
>>
> --
> 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.


Re: [web2py] Re: modular web2py - need help

2019-01-06 Thread Carlos Cesar Caballero Díaz

I know it's not too much originality, but perhaps web2py-template?

Or perhaps something like insole or markings.

Greetings.

El 6/1/19 a las 11:56 a.m., Massimo Di Pierro escribió:

Fantastic! Thank you.
Will include and deploy today or tomorrow.

How should we call this package?

Massimo

On Sunday, 6 January 2019 08:15:58 UTC-8, Carlos Cesar Caballero wrote:

I have created a pydal-like structure for templates, including an
initial setup.py and tests (there is also a fix for python 3 when
running standalone), you can take a look at

https://github.com/cccaballero/web2py/tree/modular_templates/gluon/packages/template



Greetings.

El 5/1/19 a las 1:18 p.m., Massimo Di Pierro escribió:

Anybody wants to help
1) moving the scheduler and validator tests into pydal.
2) moving the template tests into gluon/packages/template/tests
3) create a gluon/packages/template/setup.py

Massimo
-- 
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.


--
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: DAL's fake_migrat and fake_migrate_all and migration problem with auth tables

2019-01-06 Thread Anthony
On Sunday, January 6, 2019 at 2:41:53 PM UTC-5, icodk wrote:
>
> Thanks to all of you 
> How do I add migrate to the auth tables ?
> I use 
> auth.settings.extra_fields for extra fields but  entering 
> migrate='db1_auth_user.table'  does not fits in this structure
>

You can do:

auth.define_tables(..., migrate="db1_")

and the *.table files will end up like db1_auth_user.table, 
db1_auth_group.table, etc.

Anthony

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


[web2py] Re: Modules Import Problem.

2019-01-06 Thread Alfonso Serra
Hi Massimo, thanks for your answer.

sites-packages is an option indeed.

Importing modules works without issues when i fully qualify the import path 
like:

from applications.myapp.modules.utils import anyfunc

I have been reading the custom_import, which tries to find or reload the 
module unsuccesfully if its written shorthanded. (from utils import anyfunc)
Theres also an example at compileapp.py on how to use local_import like d = 
local_import('a.b.c')

Ill try to move the sys.path.insert somewhere to be executed just once for 
now.
Thanks.

-- 
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: web2py apps & github

2019-01-06 Thread Eliezer (Vlad) Tseytkin
Got it,
Thank you

On Sun, Jan 6, 2019, 4:48 PM 黄祥  it depends on what you want to have version record of your files (better
> to put it all web2py apps on github)
> $ tree web2py/applications/web2pyapp
> web2py/applications/web2pyapp
> |-- ABOUT [if any]
> |-- LICENSE [if any]
> |-- __init__.py
> |-- controllers
> |-- cron [if any]
> |-- languages
> |-- models
> |-- modules
> |-- private
> |-- routes.py [if any]
> |-- static
> `-- views
>
> but for some case to testing web2py apps in the new version of web2py,
> usually put just the web2py apps core (non front end js or css framework
> (no static folder in web2py apps tree directory stored in github) )
>
> 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.
>

-- 
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: web2py apps & github

2019-01-06 Thread 黄祥
it depends on what you want to have version record of your files (better to 
put it all web2py apps on github)
$ tree web2py/applications/web2pyapp
web2py/applications/web2pyapp
|-- ABOUT [if any]
|-- LICENSE [if any]
|-- __init__.py
|-- controllers
|-- cron [if any]
|-- languages
|-- models
|-- modules
|-- private
|-- routes.py [if any]
|-- static
`-- views

but for some case to testing web2py apps in the new version of web2py, 
usually put just the web2py apps core (non front end js or css framework 
(no static folder in web2py apps tree directory stored in github) )

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.


Re: [web2py] Re: web2py apps & github

2019-01-06 Thread Eliezer (Vlad) Tseytkin
Oh, I didn't express myself precisely: I am asking about Github - I am
setting up a Github repository and wondering what exactly from the app
directory should go in there - without extra files and without missing
files  - to preserve complete app/set

On Sun, Jan 6, 2019 at 2:51 PM 黄祥  wrote:

> for pack or unpack thing it's use tar
> ref:
> https://groups.google.com/d/msg/web2py/khiGuJYxHpo/clEEU7n3VGEJ
>
> 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.
>

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


[web2py] Re: web2py apps & github

2019-01-06 Thread 黄祥
for pack or unpack thing it's use tar
ref:
https://groups.google.com/d/msg/web2py/khiGuJYxHpo/clEEU7n3VGEJ

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] web2py apps & github

2019-01-06 Thread Vlad
I used to pack and unpack the app between my local computer and 
pythonanywhere - was going back and forth daily. worked like a charm. 
now got t github.
Should I place the whole application/ folder in its entirety or I 
should skip some files? 
I am not sure how pack / unpack does it, i.e. if it packs everything or 
skips some computer specific content. 
I am just afraid if I blindly copy ALL the files in the applications, 
I may overwrite something that shouldn't be overwritten. 

-- 
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: DAL's fake_migrat and fake_migrate_all and migration problem with auth tables

2019-01-06 Thread icodk
Thanks to all of you 
How do I add migrate to the auth tables ?
I use 
auth.settings.extra_fields for extra fields but  entering 
migrate='db1_auth_user.table'  does not fits in this structure
I also tried:
db.auth_user._migrate='db1_auth_user'
just after the  auth.settings.extra_fields  but get an error 
'DAL' object has no attribute 'auth_user'


On Sunday, January 6, 2019 at 2:57:15 PM UTC+1, Anthony wrote:
>
> I also attempted to use the fake_migrate_all=True ,migrate=False but none 
>> of the auth files was created. Only my own tables files
>> 1. deleted all the databases folder files and set DAL's  
>> fake_migrate_all=True ,migrate=False
>> 2. Only my tables files (in databases folder), and scheduler files (with 
>> the new hex prefix) was created.
>>
>
> With migrate=False, fake_migrate and fake_migrate_all will do nothing -- 
> the above process would not create the *.table files for *any* of your 
> tables. Probably you already had the *.table files for your other tables at 
> that point, so it only *appeared* that the Auth files were skipped. If 
> you set fake_migrate_all=True, all tables defined during the subsequent 
> request (including Auth tables) will have their *.table files created, 
> unless migrate or fake_migrate is explicitly set to False for an individual 
> table. Note, auth.define_tables() itself takes migrate and fake_migrate 
> arguments -- if you have either of those arguments set to False, then the 
> Auth tables will not be fake migrated with fake_migrate_all=True.
>
> I suggest you read 
> http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#markmin_table_migrations,
>  
> as it explains how everything works. In particular, look at the "Migration 
> Control Summary" section.
>  
>
>> Why the auth tables migration file names  need a hex prefix and  why it 
>> is different for each web2py installation ?
>> If the hex prefix can be changed and everything is working ? why need it 
>> in the first place ?
>>
>
> The prefix is simply a default generated by the DAL, and it is a hash of 
> the database URI (as noted in the documentation linked above). This allows 
> you to have multiple DAL instances linked to different databases without 
> worrying about clashes among the *.table file names. Alternatively, you can 
> specify your own prefix via the "migrate" argument, which the book actually 
> recommends:
>
> db.define_table('mytable', ..., migrate='db1_mytable.table')
>  
>
>> Shouldn't  a complete copy of application and database just work out of 
>> the box ?
>>
>
> It does if you (a) keep the database URI the same or (b) explicitly set 
> the *.table file names via each table's "migrate" argument. Otherwise, as 
> noted above, the URI hash is needed to allow multiple DAL instances within 
> a single app.
>
> Anthony
>

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


[web2py] Re: Web2py .exe pack custom

2019-01-06 Thread Anthony
On Sunday, January 6, 2019 at 9:48:57 AM UTC-5, mostwanted wrote:
>
> The one you gave a link to i am familiar with, i just wanted to understand 
> if the .exe custom pack introduced something new.
>

It adds your application to the /applications folder of the produced zip 
file.

Anthony

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


[web2py] Web2Py Text editor theme bug

2019-01-06 Thread Xavier Pedros
Hello, today I was trying to change the theme of the web2py text editor and 
now it's totally broken. I've tried to restart the machine or open another 
app or return to the default theme but it's still broken. What I mean by 
broken is that it's now only like a small text box with no colors at all 
and that only displays 2 lines of code at the same time.
Thanks in advance

-- 
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: modular web2py - need help

2019-01-06 Thread Massimo Di Pierro
Fantastic! Thank you.
Will include and deploy today or tomorrow.

How should we call this package?

Massimo

On Sunday, 6 January 2019 08:15:58 UTC-8, Carlos Cesar Caballero wrote:
>
> I have created a pydal-like structure for templates, including an initial 
> setup.py and tests (there is also a fix for python 3 when running 
> standalone), you can take a look at 
> https://github.com/cccaballero/web2py/tree/modular_templates/gluon/packages/template
>
> Greetings.
> El 5/1/19 a las 1:18 p.m., Massimo Di Pierro escribió:
>
> Anybody wants to help 
> 1) moving the scheduler and validator tests into pydal.
> 2) moving the template tests into gluon/packages/template/tests
> 3) create a gluon/packages/template/setup.py
>
> Massimo
> -- 
> 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: urls with spaces

2019-01-06 Thread Massimo Di Pierro
Do you mean static files with spaces in their names? uploaded content does 
not allow this because names are auto-generated.

On Sunday, 6 January 2019 01:23:11 UTC-8, Dave S wrote:
>
> In making a backup copy of a site I'm involved in (we're changing 
> webmasters, and the site may also be moved to another host), I've noticed 
> that requesting resources with spaces in the name returns INVALID REQUEST.  
> (The site is essentially a static site, and for testing the copy I've 
> temporarily stuck it in a subdirectory under the static folder of one my 
> apps.)  The html has the spaces already escaped (%20), which works on the 
> current primary host.  
>
> This is 2.16.1 running on Ubuntu 16.04 with gunicorn as the front end.  
> Looks like the Python version is 2.7.12.
>
> Dave S
> /dps
>
>

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


Re: [web2py] Re: modular web2py - need help

2019-01-06 Thread Carlos Cesar Caballero Díaz
I have created a pydal-like structure for templates, including an 
initial setup.py and tests (there is also a fix for python 3 when 
running standalone), you can take a look at 
https://github.com/cccaballero/web2py/tree/modular_templates/gluon/packages/template


Greetings.

El 5/1/19 a las 1:18 p.m., Massimo Di Pierro escribió:

Anybody wants to help
1) moving the scheduler and validator tests into pydal.
2) moving the template tests into gluon/packages/template/tests
3) create a gluon/packages/template/setup.py

Massimo
--
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: Web2py .exe pack custom

2019-01-06 Thread mostwanted
The one you gave a link to i am familiar with, i just wanted to understand 
if the .exe custom pack introduced something new.

On Sunday, January 6, 2019 at 4:17:04 PM UTC+2, Anthony wrote:
>
> It creates a standalone version of web2py (with its own Python 
> interpreter) that contains your application, which you can then use to 
> distribute as a standalone binary, as described here 
> 
> .
>
> Anthony
>
> On Sunday, January 6, 2019 at 1:56:42 AM UTC-5, mostwanted wrote:
>>
>> Hi guys, can anyone please explain to me how the .exe option under pack 
>> custom works? I have tried it and after packaging and unzipping the zipped 
>> folder I wasn't sure what is should be looking for.
>>
>> Regards
>> Mostwanted
>>
>

-- 
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: Deleting all items of a selecte ID at the same time

2019-01-06 Thread Anthony
On Sunday, January 6, 2019 at 9:15:41 AM UTC-5, mostwanted wrote:
>
> Hey Anthony, thanks for the heads up in the garbage code in the controller 
> i will address it, with regards to deleting invoices i want to be able to 
> delete all invoices in the db.invoice table but only for a specific 
> selected client. I want to be able to delete an entire invoice by clicking 
> the link once.
>

Then you would need a query like:

db(db.invoice.client = some_client_id).delete()

You would want to make sure the current user is authorized to delete 
invoices for some_client_id (specifically, if some_client_id comes from the 
browser, be sure to validate it).

Also, in the UI, you should probably make it clear what will happen, as 
"Delete Invoice" makes me think I'm deleting only the current invoice, not 
all invoices.

Anthony

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


Re: [web2py] Re: can access web2py app even if it's disabled

2019-01-06 Thread Anthony
On Sunday, January 6, 2019 at 9:16:00 AM UTC-5, Shawn Michaels wrote:
>
> What you wrote makes sense to me, but in nginx log there is no localhost 
> or it's IP address alternative but public IP address, which confuses me. 
> With enabled hosts file line in log is my PC's local IP address.
>

What matters is what web2py is receiving. See:

https://github.com/web2py/web2py/blob/master/gluon/main.py#L335-L364

and

https://github.com/web2py/web2py/blob/master/gluon/main.py#L391-L396

You can add some logging/print statements to the above sections of main.py 
to understand what is happening in each case.

Anthony

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


[web2py] Re: Upload - need help

2019-01-06 Thread Anthony
The Python code is run on the server, so you cannot use it to check the 
filesystem on the end user's computer. Further, for security reasons, the 
browser will not allow you to directly read/access the user's filesystem. 
What are you trying to do?

Anthony

On Saturday, January 5, 2019 at 1:16:37 PM UTC-5, wswie...@hawk.iit.edu 
wrote:
>
> Hello,
>
> I have an upload field in my form. It works fine when I run it on the same 
> machine as the web2py service. The issue comes when I run the service on 
> the server and the UI on a different machine. The issue is the fact that 
> existence of the file path I enter is checked on the server as opposed to 
> the machine from where I try to upload the file. How do you fix it? This is 
> the definition of the form I have:
>
>
> list_dictionary_names = os.listdir(os.getcwd() + 
> *'/applications/mcarriage_console/uploads/dictionaries'*)
> list_dictionary_types = list(set((i[:i.find(*'_'*)] if i[:i.find(*'_'*
> )] == *'ITCR'* else i[:i.find(*'_D'*)].replace(*'_'*, *' '*))  for i in
>  list_dictionary_names if i[0].isupper()))
> obj_admin = AdminClass(auth, db, session)
>
> 
> alert_message = *'Process of uploading may take a few minutes. The 
> file content is first inserted into MARS database. '*
> alert_message += *'Then content of the previously active file is 
> checked for any updates. '*
> alert_message += *'If no changes were made the content of the 
> previously file is removed '*
> alert_message +=  *'and the previously active data dictionary is set 
> inactive.'*
> session.message = alert_message
> #obj_message = MessageDisplay(session.message)
> button_list = [INPUT(_type=*'submit'*, _value=*'Submit'*)]
>
> 
> form = SQLFORM.factory(
>Field(*'file_type'*,
>  label = *'Dictionary Type'*,
>  requires=IS_IN_SET([ i[
> *'DICTIONARY_TYPE'*] for i in db(db.DATA_DICTIONARIES.ACTIVE_ID == *'A'*)
> .select(db.DATA_DICTIONARIES.DICTIONARY_TYPE)] if len(db(
> db.DATA_DICTIONARIES.ACTIVE_ID == *'A'*).select(
> db.DATA_DICTIONARIES.DICTIONARY_TYPE)) > 4 else list_dictionary_types  )),
>Field(*'file_version'*,
>  label = *'Dictionary Version'*,
>  requires=IS_NOT_EMPTY()),
>Field(*'file_directory'*,
>  label = *'File Path'*,
>  _type = *'string'*,
>  requires=IS_NOT_EMPTY()
>  #uploadfield=False,
>  #uploadfolder
> =os.path.join(request.folder,'uploads/')
>  ),
>#Field('file', 'upload', requires = IS_LENGTH(
> minsize=0, maxsize=1048576, error_message='File is too huge.')),
>   buttons = button_list
>   )
>

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


[web2py] Re: Web2py .exe pack custom

2019-01-06 Thread Anthony
It creates a standalone version of web2py (with its own Python interpreter) 
that contains your application, which you can then use to distribute as a 
standalone binary, as described here 

.

Anthony

On Sunday, January 6, 2019 at 1:56:42 AM UTC-5, mostwanted wrote:
>
> Hi guys, can anyone please explain to me how the .exe option under pack 
> custom works? I have tried it and after packaging and unzipping the zipped 
> folder I wasn't sure what is should be looking for.
>
> Regards
> Mostwanted
>

-- 
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: can access web2py app even if it's disabled

2019-01-06 Thread deim31
What you wrote makes sense to me, but in nginx log there is no localhost
or it's IP address alternative but public IP address, which confuses me.
With enabled hosts file line in log is my PC's local IP address.

Dne 06. 01. 19 v 15:09 Anthony napsal(a):
> Disabling an app does not affect local requests. Using the hosts file,
> you access the app as if it is an external request (via the host name
> defined in the hosts file), so disabling is enforced. When you instead
> switch to accessing the app locally (i.e., via "localhost" or
> 127.0.0.1), the "disabled" file is ignored and access is allowed.
> 
> Anthony
> 
> On Friday, January 4, 2019 at 12:06:45 PM UTC-5, Shawn Michaels wrote:
> 
> Hi,
> 
> I just noticed, I can access disabled app.
> 
> when I connect from local network with /etc/hosts file edited like this:
> [server IP] [disabled.address]
> 
> The page:
> 
> 
>   Temporarily down for maintenance
> 
> is displayed
> 
> When I comment the hosts line out I can connect to disabled site.
> Do anybody know why or is it something known?
> 
> I have defined base router for the disabled and second non-disabled app:
> # -*- coding: utf-8 -*-
> 
> routers = dict(
> 
>     # base router
>     BASE=dict(
>     default_application='app',
>     domains = {
>     "[address]" : "app",
>     "[disabled.address]" : "disabled_app",
>     },
>     ),
> )
> 
> -- 
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/48A3Dz5rO8c/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.

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


[web2py] Re: Deleting all items of a selecte ID at the same time

2019-01-06 Thread mostwanted
Hey Anthony, thanks for the heads up in the garbage code in the controller 
i will address it, with regards to deleting invoices i want to be able to 
delete all invoices in the db.invoice table but only for a specific 
selected client. I want to be able to delete an entire invoice by clicking 
the link once.

-- 
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: can access web2py app even if it's disabled

2019-01-06 Thread Anthony
Disabling an app does not affect local requests. Using the hosts file, you 
access the app as if it is an external request (via the host name defined 
in the hosts file), so disabling is enforced. When you instead switch to 
accessing the app locally (i.e., via "localhost" or 127.0.0.1), the 
"disabled" file is ignored and access is allowed.

Anthony

On Friday, January 4, 2019 at 12:06:45 PM UTC-5, Shawn Michaels wrote:
>
> Hi,
>
> I just noticed, I can access disabled app.
>
> when I connect from local network with /etc/hosts file edited like this:
> [server IP] [disabled.address]
>
> The page:
> Temporarily down for maintenance
> is displayed
>
> When I comment the hosts line out I can connect to disabled site.
> Do anybody know why or is it something known?
>
> I have defined base router for the disabled and second non-disabled app:
> # -*- coding: utf-8 -*-
>
> routers = dict(
>
> # base router
> BASE=dict(
> default_application='app',
> domains = {
> "[address]" : "app",
> "[disabled.address]" : "disabled_app",
> },
> ),
> )
>

-- 
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: Deleting all items of a selecte ID at the same time

2019-01-06 Thread Anthony

>
> *INVOICE DELETING CONTROLLER*
> def deleteInvoice():
> #THE .first() FUNCTION IN THE LINE BELOW ONLY ALLOWS ME TO DELETE ITEMS 
> ONE AT A TIME
> *query = db(db.invoice.id==request.args(0, cast=int)).select().first() 
> *
> remove = db(db.invoice.id==query).delete()
>

Above, query is the entire Row object of a single invoice -- it is not a 
query nor an ID and does not make sense to use it as you are in the second 
line. Further, you already have the invoice ID in request.args(0), so there 
is no reason to query the DB for that record just to get its ID again.

As for "deleting all the invoice items", what do you mean by that? Do you 
want to delete all invoices in the db.invoice table? Or is there a separate 
table of invoice items that references the db.invoice table?

Anthony

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


[web2py] Re: DAL's fake_migrat and fake_migrate_all and migration problem with auth tables

2019-01-06 Thread Anthony

>
> I also attempted to use the fake_migrate_all=True ,migrate=False but none 
> of the auth files was created. Only my own tables files
> 1. deleted all the databases folder files and set DAL's  
> fake_migrate_all=True ,migrate=False
> 2. Only my tables files (in databases folder), and scheduler files (with 
> the new hex prefix) was created.
>

With migrate=False, fake_migrate and fake_migrate_all will do nothing -- 
the above process would not create the *.table files for *any* of your 
tables. Probably you already had the *.table files for your other tables at 
that point, so it only *appeared* that the Auth files were skipped. If you 
set fake_migrate_all=True, all tables defined during the subsequent request 
(including Auth tables) will have their *.table files created, unless 
migrate or fake_migrate is explicitly set to False for an individual table. 
Note, auth.define_tables() itself takes migrate and fake_migrate arguments 
-- if you have either of those arguments set to False, then the Auth tables 
will not be fake migrated with fake_migrate_all=True.

I suggest you 
read 
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#markmin_table_migrations,
 
as it explains how everything works. In particular, look at the "Migration 
Control Summary" section.
 

> Why the auth tables migration file names  need a hex prefix and  why it is 
> different for each web2py installation ?
> If the hex prefix can be changed and everything is working ? why need it 
> in the first place ?
>

The prefix is simply a default generated by the DAL, and it is a hash of 
the database URI (as noted in the documentation linked above). This allows 
you to have multiple DAL instances linked to different databases without 
worrying about clashes among the *.table file names. Alternatively, you can 
specify your own prefix via the "migrate" argument, which the book actually 
recommends:

db.define_table('mytable', ..., migrate='db1_mytable.table')
 

> Shouldn't  a complete copy of application and database just work out of 
> the box ?
>

It does if you (a) keep the database URI the same or (b) explicitly set the 
*.table file names via each table's "migrate" argument. Otherwise, as noted 
above, the URI hash is needed to allow multiple DAL instances within a 
single app.

Anthony

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


Re: [web2py] Re: modular web2py - need help

2019-01-06 Thread Carlos Cesar Caballero Díaz
Hi Massimo, there is already a package called template in pypi, how 
should we name the new template module?


Greetings.

El 5/1/19 a las 1:18 p.m., Massimo Di Pierro escribió:

Anybody wants to help
1) moving the scheduler and validator tests into pydal.
2) moving the template tests into gluon/packages/template/tests
3) create a gluon/packages/template/setup.py

Massimo
--
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] Deleting all items of a selecte ID at the same time

2019-01-06 Thread mostwanted
I have a view that create an invoice, at present i can only delete 1 item 
at a time from the invoice but what i want is to be able to delete all 
items from the invoice at the same time by clicking a link, below is my 
code.

*INVOICE CODE:*



















































































*Click to Download as 
PDF
   COMPANYTELEPHONE: 
EM@IL: .@gmail.com  
  CELL: POSTAL-ADDRESS:..  
  Invoice No: 
___ Contact: {{=invoice.proxy}}
 Company: {{=invoice.company}}Tel: {{=invoice.tel}}Postal Address: {{=invoice.postalAddress}}
Order
QuantityOrder Price(VAT Exclusive)
Amount{{for invoice in customer:}}
{{=invoice.client_order}} {{=invoice.quantity}} 
{{=MoneyFormat(invoice.beforeVat)}}
{{=MoneyFormat(invoice.quantity*invoice.beforeVat)}}
{{pass}}{{for price in pricing:try:vat=round(price.total*0.12, 
2)totalPrice=price.total+vatexcept:
redirect(URL('notInvoiced'))}}{{pass}}Sub-Total:{{=MoneyFormat(price.total)}}(VAT 
EXCLUSIVE)12% VAT: {{=MoneyFormat(vat)}}Total: {{=MoneyFormat(totalPrice)}}(VAT 
INCLUSIVE){{pass}}{{pass}}
Client Sinature: 
{{=invoice.Booked_By.first_name}} 
{{=invoice.Booked_By.last_name}}Date & Time: 
{{=invoice.Booking_Date}}Thank you for your 
business!Company  
  $('document').ready(function(){$(".delete").click(function(){  
 return confirm('Are you sure you want to delete this this INVOICE?!');
});});#BY CLICKING THE LINK BELOW I WANT TO BE ABLE TO DELETE 
ALL THE INVOICE ITEMS AT ONCEDelete 
InvoiceTOP*

*INVOICE DELETING CONTROLLER*
def deleteInvoice():
#THE .first() FUNCTION IN THE LINE BELOW ONLY ALLOWS ME TO DELETE ITEMS ONE 
AT A TIME
*query = db(db.invoice.id==request.args(0, cast=int)).select().first() *
remove = db(db.invoice.id==query).delete()
if remove:
redirect(URL('registeredClients'))
return locals()

The *.first()* function in the green highlighted line in the above 
controller only allows me to delete the invoice items one at a time, is 
there another function i can use that will allow me to delete them all at 
once? By deleteng the invoice items this will delete the entire invoice 
allowing the user to implement a new invoice. 

Please help!

Mostwanted

-- 
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: can access web2py app even if it's disabled

2019-01-06 Thread deim31
The address in router means domain in fact.

The problem is when I connect from PC on same network as server and have
/etc/hosts file with the mentioned line enabled I see Temporarily down
for maintenance, that is correct. But it should be in second event the
same, but isn't. I comment out the line in hosts file and connect to
real domain "from outside". And now the disabled app is not disabled
even thou it's set as disabled.

I can see the two "types" of access in nginx log - one disabled second
enabled.

Hope You understand better now.
Thank You!

Dne 05. 01. 19 v 19:15 Massimo Di Pierro napsal(a):
> I do not understand.
> 
> You disable an app by creating a DISABLED file in the app folder.
> You can use the router to map different domains into different default apps.
> You see to mapping one into app and one into disabled_app which I
> assumed has the DISABLED file.
> You cannot map addresses into default apps. You can only map domains.
> 
> On Friday, 4 January 2019 09:06:45 UTC-8, Shawn Michaels wrote:
> 
> Hi,
> 
> I just noticed, I can access disabled app.
> 
> when I connect from local network with /etc/hosts file edited like this:
> [server IP] [disabled.address]
> 
> The page:
> 
> 
>   Temporarily down for maintenance
> 
> is displayed
> 
> When I comment the hosts line out I can connect to disabled site.
> Do anybody know why or is it something known?
> 
> I have defined base router for the disabled and second non-disabled app:
> # -*- coding: utf-8 -*-
> 
> routers = dict(
> 
>     # base router
>     BASE=dict(
>     default_application='app',
>     domains = {
>     "[address]" : "app",
>     "[disabled.address]" : "disabled_app",
>     },
>     ),
> )
> 
> -- 
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/48A3Dz5rO8c/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.

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


[web2py] urls with spaces

2019-01-06 Thread Dave S
In making a backup copy of a site I'm involved in (we're changing 
webmasters, and the site may also be moved to another host), I've noticed 
that requesting resources with spaces in the name returns INVALID REQUEST.  
(The site is essentially a static site, and for testing the copy I've 
temporarily stuck it in a subdirectory under the static folder of one my 
apps.)  The html has the spaces already escaped (%20), which works on the 
current primary host.  

This is 2.16.1 running on Ubuntu 16.04 with gunicorn as the front end.  
Looks like the Python version is 2.7.12.

Dave S
/dps

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


Re: [web2py] DAL's fake_migrat and fake_migrate_all and migration problem with auth tables

2019-01-06 Thread Dave S


On Saturday, January 5, 2019 at 7:15:02 AM UTC-8, Chris V. wrote:
>
> I never tryed fake migrate before but every time that I move an app to 
> another server first I put the app in the server then I delete everything 
> inside the database folder, then run the app via web browser (this create 
> the structure of the database)? then resotre the db backup and done app + 
> database working in the new server. I always do this with mysql but should 
> be the same for pg.
> If you create the database first and the run the web2py will say that all 
> ready exist.
>
>
> Cheers.
>
>
Yes, fake_migrate exists to handle the second situation.   Evidently, the 
auth tables are special-cased though.

El vie., 4 ene. 2019 9:37 p. m., icodk > 
> escribió:
>
>> First both fake_migrate and fake_migrate_all  are part of the DAL 
>> signature in the book,  However fake_migrate is only explained when it is 
>> used in a table definition, not in DAL.
>>
>>
>> Second issue that might be related:
>> I try to move web2py application to another server, including a pg 
>> database in the following order:
>> 1. took a backup of the database on the old server
>> 2. restored the database on the new server
>> 3. Copy the web2py application to the new server include the databases 
>> files
>> 4. my first attempt to run the app resulted in  error: relation 
>> "auth_user" already exists
>> 6. I verified that a file  
>>  63e111e1d2096351b383c8ebce6b217f_auth_user.table EXIST so why the error?
>> 7. Deleted the auth_user table from the database and file 
>> 63e111e1d2096351b383c8ebce6b217f_auth_user.table
>> 8. a new table was created and a new auth_user.table file but with 
>> another hex prefix: c8b669d15150d7109e5f7ab36744a5b7_auth_user.table
>> 9. But now I got the same error on auth_group.
>> 10.I solved it by just changing all the files with the old hex prefix to 
>> the new prefix and everything was working.
>> There are only hex prefix to the auth tables because I Can't/didn't set 
>> the migrate table settings 
>>
>> I also attempted to use the fake_migrate_all=True ,migrate=False but none 
>> of the auth files was created. Only my own tables files
>> 1. deleted all the databases folder files and set DAL's  
>> fake_migrate_all=True ,migrate=False
>> 2. Only my tables files (in databases folder), and scheduler files (with 
>> the new hex prefix) was created.
>>
>> Why not all tables files was created on fake migration?
>> Why the auth tables migration file names  need a hex prefix and  why it 
>> is different for each web2py installation ?
>>
>
It's an instance number, essentially.
 

> If the hex prefix can be changed and everything is working ? why need it 
>> in the first place ?
>> Shouldn't  a complete copy of application and database just work out of 
>> the box ?
>>
>
"Out of the box" is for creating a fresh application with an empty 
database.  Chris V tells you how that can be used to "prepare the field" 
(vague farm analogy) for a copied app.  The "fake_migrate" controls are in 
the box, but under a warning label.


 

>
>> (2.17.1-stable+timestamp.2018.08.05.17.57.00
>> (Running on nginx/1.12.1, Python 2.7.14)
>>
>>
>>
/dps
 

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