[web2py] Web2py .exe pack custom

2019-01-05 Thread mostwanted
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: Location of the confirm() function in the _onclick="return confirm('text');"

2019-01-05 Thread Massimo Di Pierro
confirm is a built-in JS function. :-)

On Saturday, 5 January 2019 10:16:37 UTC-8, Weronika Swiechowicz wrote:
>
> I have the following buttons and form definitions:
>
> buttons=[INPUT(_type=*'button'*,
>
>   _value=*'Upload Message**'*,
>
>   _onclick=*"return confirm('Confirm deletion of 
> asset. This will also remove asset from all groups.');"*),
>
> 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()
>
>),
>
>   buttons = buttons)
>
> 
>
>)
>
>
> Everything works as expected. The question I have is, where is the 
> "confirm()" function definition I used in the "INPUT(_type=*'button'*, 
> _value=*'Upload Message**'*,_onclick=*"return confirm('Confirm deletion 
> of asset. This will also remove asset from all groups.');"*)," defined? I 
> tried searching for it and came across html.py file with confirm function 
> on line 2316. However, no matter how I edit it or whatever I comment out 
> (commented 
> out inputs definitions), I still get the same output back as before the 
> changes. Is there any other place where confirm() is defined? If not, why 
> commenting out the inputs yields no changes?
>

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

2019-01-05 Thread Massimo Di Pierro
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.


[web2py] Upload - need help

2019-01-05 Thread wswiecho
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] Location of the confirm() function in the _onclick="return confirm('text');"

2019-01-05 Thread wswiechowicz
I have the following buttons and form definitions:

buttons=[INPUT(_type=*'button'*,

  _value=*'Upload Message**'*,

  _onclick=*"return confirm('Confirm deletion of asset. 
This will also remove asset from all groups.');"*),

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()

   ),

  buttons = buttons)



   )


Everything works as expected. The question I have is, where is the 
"confirm()" function definition I used in the "INPUT(_type=*'button'*, 
_value=*'Upload Message**'*,_onclick=*"return confirm('Confirm deletion of 
asset. This will also remove asset from all groups.');"*)," defined? I 
tried searching for it and came across html.py file with confirm function 
on line 2316. However, no matter how I edit it or whatever I comment out 
(commented 
out inputs definitions), I still get the same output back as before the 
changes. Is there any other place where confirm() is defined? If not, why 
commenting out the inputs yields no changes?

-- 
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-05 Thread Massimo Di Pierro
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 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: modular web2py - need help

2019-01-05 Thread Massimo Di Pierro

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.


[web2py] Re: Scheduler

2019-01-05 Thread Massimo Di Pierro
this is not normal. when you restart it should pick the tasks. Can you help 
debug or share more info?

On Thursday, 3 January 2019 06:26:51 UTC-8, fiubarc wrote:
>
> Hello! 
>
> I have configured the scheduler to start at server restart but it does not 
> take the tasks that already exists in scheduler_task table. 
>
>
> Then I have to delete them and reassign them every time I restart the server. 
> These tasks should run once a day, every day
>
> Is there a better way to solve this?
>
> 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.


[web2py] Re: Modules Import Problem.

2019-01-05 Thread Massimo Di Pierro
Do not do this. The models are executed at every http call and you end up 
with a longer and longer sys.path (memory leak).
The problem is with the module itself, it does not uses relative imports.
I recommend you put the module in web2py/site-packages

On Wednesday, 2 January 2019 02:49:56 UTC-8, Alfonso Serra wrote:
>
> Hi, so far it looks like this works:
>
> at the model 01_config.py
>
> import sys
> sys.path.insert(0, r"E:\webdev\web2py-mod.02\applications\myapp\modules")
>
> then im able to import as:
> from utils import myfunc
>
> where utils.py is an application module at applications\myapp\modules
>

-- 
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-05 Thread Christian Varas
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.

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 ?
> 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 ?
>
> (2.17.1-stable+timestamp.2018.08.05.17.57.00
> (Running on nginx/1.12.1, Python 2.7.14)
>
> --
> 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.