Re: [web2py] Re: Inserting to db from module. Why do I need to keep restarting Web2py?

2014-01-06 Thread Richard Vézina
There is chance that it still broken...

If you have put the track changes line in your model, it should work if you
don't have access to the mods you have made to your module, it because it
still broken...

There is many post on the list about this issue.

Since I am still using 2.4.7 and can't say for sure if it still the case
with the last stable.

Richard


On Sat, Jan 4, 2014 at 5:40 PM, Brando  wrote:

> Richard, is this feature unreliable at this point or am i using it
> incorrectly?
>
>
>
>
> On Friday, January 3, 2014 12:54:12 PM UTC-8, Brando wrote:
>>
>> Version
>>>
>>> 2.8.2-stable+timestamp.2013.11.28.13.54.07
>>> (Running on Rocket 1.2.6, Python 2.7.3)
>>>
>>
>>
>>
>>
>>
>> Also, I doubt it's relevant, but I'm using Sublime Text as my IDE.
>>
>  --
> 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/groups/opt_out.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to 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/groups/opt_out.


Re: [web2py] Re: Inserting to db from module. Why do I need to keep restarting Web2py?

2014-01-04 Thread Brando
Richard, is this feature unreliable at this point or am i using it 
incorrectly?




On Friday, January 3, 2014 12:54:12 PM UTC-8, Brando wrote:
>
> Version
>>
>> 2.8.2-stable+timestamp.2013.11.28.13.54.07
>> (Running on Rocket 1.2.6, Python 2.7.3)
>>
>
>
>
>
>
> Also, I doubt it's relevant, but I'm using Sublime Text as my IDE. 
>

-- 
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/groups/opt_out.


Re: [web2py] Re: Inserting to db from module. Why do I need to keep restarting Web2py?

2014-01-03 Thread Brando

>
> Version
>
> 2.8.2-stable+timestamp.2013.11.28.13.54.07
> (Running on Rocket 1.2.6, Python 2.7.3)
>





Also, I doubt it's relevant, but I'm using Sublime Text as my IDE. 

-- 
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/groups/opt_out.


Re: [web2py] Re: Inserting to db from module. Why do I need to keep restarting Web2py?

2014-01-03 Thread Richard Vézina
Which version of web2py do you use?

from gluon.custom_import import track_changes; track_changes(True)


Have been broken during sometime...

Richard




On Fri, Jan 3, 2014 at 2:50 PM, Brando  wrote:

> Here is the test app.
>
>
>
>
>
>
> On Friday, January 3, 2014 11:35:22 AM UTC-8, Anthony wrote:
>>
>> On Friday, January 3, 2014 2:22:42 PM UTC-5, Brando wrote:
>>>
>>> Anthony, I added the line to a model and it still doesn't work. Any
>>> other thoughts?
>>>
>>
>> Not sure. Did you restart? Maybe pack and attach a minimal app that
>> demonstrates the problem.
>>
>>
>>> Also, why is it not recommended for production?
>>>
>>
>> It adds extra overhead to every import (have to check the last modified
>> time of the module file on the filesystem).
>>
>> 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/groups/opt_out.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to 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/groups/opt_out.


[web2py] Re: Inserting to db from module. Why do I need to keep restarting Web2py?

2014-01-03 Thread Anthony
On Friday, January 3, 2014 2:22:42 PM UTC-5, Brando wrote:
>
> Anthony, I added the line to a model and it still doesn't work. Any other 
> thoughts?
>

Not sure. Did you restart? Maybe pack and attach a minimal app that 
demonstrates the problem.
 

> Also, why is it not recommended for production?
>

It adds extra overhead to every import (have to check the last modified 
time of the module file on the filesystem).

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/groups/opt_out.


[web2py] Re: Inserting to db from module. Why do I need to keep restarting Web2py?

2014-01-03 Thread Brando
Anthony, I added the line to a modeland it still doesn't work. Any other 
thoughts?

Also, why is it not recommended for production?




On Friday, January 3, 2014 8:26:13 AM UTC-8, Anthony wrote:
>
> It's the same with any Python module -- they only get loaded once on first 
> import. web2py does include a feature to automatically re-load upon change, 
> though not recommended for production. In a model file (before any imports):
>
> from gluon.custom_import import track_changes; track_changes(True)
>
>
> See 
> http://web2py.com/books/default/chapter/29/04/the-core#Accessing-the-API-from-Python-modules
> .
>
> Anthony
>
> On Friday, January 3, 2014 11:14:36 AM UTC-5, Brando wrote:
>>
>> I have the following code to insert a dictionary into my sqlite db from a 
>> module. 
>>
>> #!/usr/bin/env python
>> # -*- coding: utf-8 -*-
>>
>> from gluon import current
>> from gluon.dal import DAL, Field
>> from gluon.sqlhtml import SQLFORM
>> from gluon.validators import IS_NOT_EMPTY, IS_EMAIL, IS_LENGTH
>>
>> class Parse(object):
>>
>> def __init__(self):
>> self.db = current.db
>> # self.db = 
>> DAL('sqlite://storage.sqlite',pool_size=1,check_reserved=['all'])
>> # self.db = DAL("sqlite://mydb.sqlite")
>> self.session = current.session
>> self.request = current.request
>> self.response = current.response
>> self.cache = current.cache
>> self.maketable()
>> self.settings()
>> # self.set_validators()
>> self.addtodb()
>>
>> def settings(self):
>>
>> self.settings = {
>> 'filepath': 'tom', #File path.
>> 'filename': 'dick', #Name of the file being processed.
>> 'hostname': 'harry', #What is the hostname?
>> }
>>
>>
>> def maketable(self):
>> self.testrecord = self.db.define_table("testrecord",
>> Field("filepath"),
>> Field("filename"),
>> Field("hostname")
>>  )
>>
>> def addtodb(self):
>> self.db.testrecord.insert(**self.settings)
>> self.testrecord = self.db().select(self.db.testrecord.ALL)
>> return self.testrecord
>>
>>
>> If I change either tom, dick or harry; save the file, and reload my 
>> browser; I still get tom, dick and harry being returned to the screen. 
>>  HOWEVER, if I stop the web2py server, quit web2py (osx), and restart 
>> web2py I will get my new values when I reload the url.  
>>
>> Any ideas what is going on here?
>>
>>
>>

-- 
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/groups/opt_out.


[web2py] Re: Inserting to db from module. Why do I need to keep restarting Web2py?

2014-01-03 Thread Brando
Actually, any changes made to my module file will not be reflected until i 
restart the web2py.app.










On Friday, January 3, 2014 8:14:36 AM UTC-8, Brando wrote:
>
> I have the following code to insert a dictionary into my sqlite db from a 
> module. 
>
> #!/usr/bin/env python
> # -*- coding: utf-8 -*-
>
> from gluon import current
> from gluon.dal import DAL, Field
> from gluon.sqlhtml import SQLFORM
> from gluon.validators import IS_NOT_EMPTY, IS_EMAIL, IS_LENGTH
>
> class Parse(object):
>
> def __init__(self):
> self.db = current.db
> # self.db = 
> DAL('sqlite://storage.sqlite',pool_size=1,check_reserved=['all'])
> # self.db = DAL("sqlite://mydb.sqlite")
> self.session = current.session
> self.request = current.request
> self.response = current.response
> self.cache = current.cache
> self.maketable()
> self.settings()
> # self.set_validators()
> self.addtodb()
>
> def settings(self):
>
> self.settings = {
> 'filepath': 'tom', #File path.
> 'filename': 'dick', #Name of the file being processed.
> 'hostname': 'harry', #What is the hostname?
> }
>
>
> def maketable(self):
> self.testrecord = self.db.define_table("testrecord",
> Field("filepath"),
> Field("filename"),
> Field("hostname")
>  )
>
> def addtodb(self):
> self.db.testrecord.insert(**self.settings)
> self.testrecord = self.db().select(self.db.testrecord.ALL)
> return self.testrecord
>
>
> If I change either tom, dick or harry; save the file, and reload my 
> browser; I still get tom, dick and harry being returned to the screen. 
>  HOWEVER, if I stop the web2py server, quit web2py (osx), and restart 
> web2py I will get my new values when I reload the url.  
>
> Any ideas what is going on here?
>
>
>

-- 
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/groups/opt_out.


[web2py] Re: Inserting to db from module. Why do I need to keep restarting Web2py?

2014-01-03 Thread Anthony
It's the same with any Python module -- they only get loaded once on first 
import. web2py does include a feature to automatically re-load upon change, 
though not recommended for production. In a model file (before any imports):

from gluon.custom_import import track_changes; track_changes(True)


See 
http://web2py.com/books/default/chapter/29/04/the-core#Accessing-the-API-from-Python-modules
.

Anthony

On Friday, January 3, 2014 11:14:36 AM UTC-5, Brando wrote:
>
> I have the following code to insert a dictionary into my sqlite db from a 
> module. 
>
> #!/usr/bin/env python
> # -*- coding: utf-8 -*-
>
> from gluon import current
> from gluon.dal import DAL, Field
> from gluon.sqlhtml import SQLFORM
> from gluon.validators import IS_NOT_EMPTY, IS_EMAIL, IS_LENGTH
>
> class Parse(object):
>
> def __init__(self):
> self.db = current.db
> # self.db = 
> DAL('sqlite://storage.sqlite',pool_size=1,check_reserved=['all'])
> # self.db = DAL("sqlite://mydb.sqlite")
> self.session = current.session
> self.request = current.request
> self.response = current.response
> self.cache = current.cache
> self.maketable()
> self.settings()
> # self.set_validators()
> self.addtodb()
>
> def settings(self):
>
> self.settings = {
> 'filepath': 'tom', #File path.
> 'filename': 'dick', #Name of the file being processed.
> 'hostname': 'harry', #What is the hostname?
> }
>
>
> def maketable(self):
> self.testrecord = self.db.define_table("testrecord",
> Field("filepath"),
> Field("filename"),
> Field("hostname")
>  )
>
> def addtodb(self):
> self.db.testrecord.insert(**self.settings)
> self.testrecord = self.db().select(self.db.testrecord.ALL)
> return self.testrecord
>
>
> If I change either tom, dick or harry; save the file, and reload my 
> browser; I still get tom, dick and harry being returned to the screen. 
>  HOWEVER, if I stop the web2py server, quit web2py (osx), and restart 
> web2py I will get my new values when I reload the url.  
>
> Any ideas what is going on here?
>
>
>

-- 
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/groups/opt_out.