Is eventlist constant for the application? If so put it in the model or if
in a module use local_import. Then all you need in session is the current
index into the array the user is at.
If eventlist changes then there is no code showing how it is manipulated so
it difficult to help. I would
Additional information:
I added a print to the front end of DAL.__init__ and was surprised to find
driver_args was set to {'check_same_thread': False} but I did not set it in
my db = DAL() class constructor call.
So here is the issue. I start up the development environment on Linux with a
The default session timeout is 1 hour and is set in seconds by adding a line
like this to a model such as db.py after auth = Auth()
auth.settings.expiration = 3600 # default 1 hour
but the user would have to sit idle on the app for over one hour and then
click next or prev to finish a signup.
I just downloaded the nightly build, unpacked it, copied over my application
and get the same problem.
I don't have a problem with 1.92.1. I don't normally use trunk but test it
once in a while to see what is coming. :-)
Ron
Wow that fixed it. You are a Python Ninja :-)
I would sure like to know what the mechanism was that caused driver_args to
bleed from SQLLite to the other adapters even though it is defaulted it to
an empty dict on the class initializer. I also printed driver_args as the
first line of code in
I fixed the problem for my application, the label attribute for=1/8x was
somehow being interpreted as an expression, changed it to for=1_8x and it
works properly again. Wasn't a problem for jQuery 1.4.4. The odd looking
string came from a relative speed designation for video playback.
Ah Ok, I was trying to reproduce with a simple program containing a couple
of classes with a main all in one file but it did not exhibit the problem
behaviour. So having the classes in a module is part of the recipe and lists
and dicts are passed around as object references to the container
An interesting recent trend. I follow comp.lang.python as well and the
web2py-users group recently has more traffic than the python group. That
might be an indicator of the level of interest in this nice to work with
framework.
https://groups.google.com/d/msg/comp.lang.python/iEV5oyLApHI/laV-P_Q6sG0J
From reading elsewhere, editing the file also requires a server restart to
have the changes take effect. The restart is dependent on what web2py is
hosted behind and I don't believe that is in the web interface.
Ran across this in the Python group. It embeds Python code inside the HTML
with a slightly different syntax to the web2py template system. Just posting
out of possible interest to the membership here, haven't tried it, not
affiliated with the author. The author's differentiation from Django
FWIW I am on Ubuntu 10.04 with all patches applied and could not reproduce
the above problem when I tried. The version of python-psycopg2 from the
standard repository is 2.0.13. Not an iron-clad guarantee because something
else could be at play but at least a data point. I also drove the
Why is this line
Field('password', 'password', '''length=512, ''', readable=False,
label='Password'),
should be
Field('password', 'password', length=512, readable=False,
label='Password'),
Sorry, I didn't explain well enough.
The clean_session() function is something I wrote to reset all session
variables in the case the user is a different person logging in from the
same machine. So it contains lines like:
session.var1 = None
session.dict1 = {}
etc.
The nutshell is an
session.forget() will prevent you from adding to the session from that line
forward because it inhibits storing of the session to the file at the end of
the request. I only wanted to remove session variables if the new user was
not the same as the previous use logged into the application from
I put all my production vs developer settings in an if else block and use my
own variable PRODUCTION. This is in the model directory and named
0_customization.py in my case. This allows you to set the migrate,
local_import reload parameter and anything else you want. Then I just need
to
I wouldn't rush into it either but the testing I did shows a very compatible
release when comparing 1.4.4 vs 1.5 including jQueryUI and another plugin I
use.
I am impressed with their quality and their strong adherence to backwards
compatibility.
I put this chunk of code in models/menu.py just after the index item and
before the rest of the menu because I didn't want the other menu items
exposed if not logged in. Your case may vary but the code should be the
same, just placement.
if auth.user:
#print 'menu: ', auth.user_id,
I have had trouble with browser caching by just left clicking on the button
on the downloads page on the web2py.com website. I now make a point of using
a right click Save As or whatever your browser provides as the item in the
pop up menu to save the file. The first clue the left click didn't
I was poking around and found jQuery 1.5 is released. They substantially
improved the ajax portion of the library as well as big performance
improvements when finding sibling DOM objects .prev(), .next(). Just thought
I would mention it since web2py embeds jQuery.
I took the min version and renamed it the same name as the 1.4.4 file in
1.91.6 and tested both the welcome app and the video system controller I am
writing. No noticeable differences that I could see. I also use jQueryUI but
am back at 1.8.6, current is 1.8.9 and did not see anything broken.
From the DAL chapter of the manual
update_record
update_record
web2py also allows updating a single record that is already in memory using
update_record
1.
2.
3.
rows = db(db.person.id 2).select()
row = rows[0]
row.update_record(name='Curt')
This should not be confused with
1.
It is quite a lot to learn, no problem. Glad I could help.
Also check this setting originally in db.py of the scaffolding app
auth.settings.hmac_key = 'sha512:.'
If you want to share the table across apps or migrate copies of the auth_xxx
tables, the code that generates the encrypted passwords use this as the
method and key.
I think there is another bug as well.
The _unlock function only unlocks the session file if it exists but leaves
response.session_file defined.
Later when the request cycle finishes the _try_store_on_disk function will
still see response.session_file as active and write it but this is now
Oh crud, I didn't see the self._forget state variable test at the front of
_try-store_on_disk, sorry for the noise and response.session_file is a file
object so having it go out of scope will close it.
Ron
If the response is left off the session.forget() parameter list it defaults
to None. The end result then is the session._forget state variable is set
True but the session file is not unlocked in the _unlock function. This
would enhance performance by bypassing the writing of the session file at
I remember session.forget() documented as a performance enhancement - no
plans to alter session on this call, do this to save the write. I think this
would be the most common use. Adding the response parameter to unlock the
session file is only required if there is a need for concurrency in the
I saw that too last night but it was late. It would be better to set
response.session_file to None which will force a file close since the file
object goes out of scope. Adding a del in _unlock will cause AttributeError
in the _try_store_on_disk when the request-response cycle is finishing up.
It would be better to set response.session_file to None in _unlock because
the second _unlock call will generate an AttributeError when testing for
response.session_file at the top of _unlock.
There is another subtle problem. If the file close is not done after the
unlock which is how it works now then the file is still open. It is not
possible to get the exclusive lock in session.connect() until the file is
closed so the second request remains blocked.
Maybe it is a Windows only issue, I was reviewing the flock(2) man page and
it isn't a problem in UNIX systems. I haven't looked at the Windows docs but
remember file access is more restrictive on that system. For now it is only
a suspicion, I don't use Windows so would have to do a lot to test
I was talking about the _unlock call at the top of _try_store_on_disk
def _try_store_on_disk(self, request, response):
if not hasattr(os,'mkdir'): return
if response._dbtable_and_field \
or not response.session_id \
or self._forget:
Okay, I get it, Storage id a dict but adds a __getattr__ which returns None
on missing key. Nothing like learning in public -- blush.
If you are editing the file in the modules directory then that is the
problem. A module gets pulled in and kept by the server until restart unless
you add a parameter to the local_import()
api = local_import('api', True) where the True says perform a module reload
on each request.
Have a look at this one
http://net.tutsplus.com/tutorials/javascript-ajax/inettuts/
Is there any chance to try another server based database such as MySQL.
Since SQLite did not exhibit a problem that is a valid data point but it is
an embedded database so called directly by the web2py server code instead of
using a driver. There is a possibility there is a problem with the
I can't seem to get it to generate an error running on PostgreSQL and the
apache logs show nothing. I upped the ab time ( -t ) to 100 and then used
the application. It wasn't very responsive but then the ab average was 8+sec
on the home page which just displays a message. I am using the default
This kind of information is often stored in a corporate directory using
something called LDAP. I am not sure of the size of your company but it
sounds like it is large enough to consider this solution. There is OpenLDAP
on Linux or Active Directory on Microsoft which perform this task as
It is only the welcome application that stalls loading the default index
page, opening a different application works fine.
applications/welcome/controller/default function index() has this new debug
code between def and return
m = 'You are successfully running web2py.'
import
Additional info - to stop the python web2py process I had to use a kill -9
pid. Once the welcome default controller code was changed then the next time
the server stopped properly using the Tcl control Server-Quit menu item.
I think I understand you want to run Python programs with the DAL embedded
standalone as well as multiple instances of web2py.
You should be able to do that, the database will treat each client as a
different connection. The migrate option on the table definitions should be
true only on one
As I understand the workings, the files under the model directory define the
tables and relations and the connection string to the database server.
Without that DAL is a bunch of code with nothing to play against to tell it
what to do with the database for the data access.
The databases
Hmm looking at the DAL code I am talking above about a web2py use of dal.py.
It looks like the code you normally put in the models directory can just be
put in your program inline.
Maybe someone else that has used the dal stand-alone can comment better than
me. I see a set_folder static method
Talk and free book by Prof Allen Downey on semaphores.
http://www.greenteapress.com/semaphores/
Coding plus observation tool in Python. Goes into some good usage patterns.
Which version of jquery.tools.min.js did you include, what I mean is what
feature set? There is a possible inclusion of a date picker looking at all
the options on their web page for downloads as you build your custom version
of jquery.tools.min.js. They all produce the same file name as output
I don't know if it is worth mentioning but as a Ubuntu 10.04.1 user, I
noticed the 8.4.6 update to PostgreSQL was pushed by Ubuntu near the end of
December.
http://www.postgresql.org/docs/8.4/static/release-8-4-6.html
first item of the release notes mention the database can fail on some file
jQueryUI has the Position utility if you are already using that Javascript
library
http://jqueryui.com/demos/position/
The demo is a little different as in odd, they are positioning 2 boxes
relative another based on the user moving one of them so I had to unwind
from that a bit to get
In the sample code if one comments out the __del__ method in the class the
leak does not occur. That is not to say it can't happen I suppose in a more
complicated code example but I believe the __del__ is a required piece. This
test was performed without the gc.collect() being present. I ran
Is there any value in this article for your case?
http://code.activestate.com/recipes/519621-object-finalization-without-__del__-and-without-ha/
Ron
I don't get why there is a problem. I did a scan of the latest trunk and did
not find a __del__ function anywhere.
If the sample code is run with the __del__ it accumulates memory rapidly.
Comment out the __del__ method which does nothing in this example and the
memory accumulation is no
Thanks for the extra explanation.
You have to have a __del__ method in the class to get the leak
To get the leak the __del__method has to be in the class. The gc.collect()
as suggested by Massimo cured the leak for the exec code case I believe
because gc.collect() runs a test on the objects to see if there are any
external references, finds none, and therefore allows them to be removed
It is unfortunate that these things occur and hopefully people are going to
be serious developers on a framework are smart enough to do their own
evaluation.
I came to Python about 1.5 years ago mainly because I was doing video
processing with gstreamer and the best control language for that
Forgot to mention the admin interface and the ability to compile and package
an application in a couple of button presses into a single file and then
deploy to the production servers.
The ticketing system instead of come look at my screen, it broke. My users
are in locations up to 3000 miles
Doesn't adding the gc.collect() just force the garbage collector to run
right now instead of waiting until some usage threshold is crossed and then
it runs to do the cleanup at some time in the future. Any accumulation of
heap use until gc gets around to running isn't really a leak, it is just
SQLite was embedded in the Python standard library since Python 2.5 so it
would depend on which version of SQLite was pulled in for the versions of
Python. Taking a quick look I could not find which version is included with
the different versions of Python.
i noticed the SQLite docs are saying
I don't have permission to post in web2py-developers but I added a comment
to the bug report.
I think the problem is the cached object is the class definition, not an
instance of the class. The class definition likely has references to the
environment or global namespace in order it to
That leaves taxes which aren't a factor here :-)
+1 and in one more hour here
If you put code in a file under the modules directory then it will require a
restart unless you set the reload parameter to True
In model or controller
mod_name = local_import('module_file', True) will force a reload every time
so restart not needed.
Otherwise nothing gets retained between
I would like to respectfully ask how a first and last name combined could be
unique in the real world? There are lots of people with identical first and
last names.
A better candidate in your table is Email.
I know that doesn't answer your question but I think it is worth
consieration.
Ron
Its ugly but you must have a finite and small number of nextStep targets
{{if nextStep == 'step1':}}
{{include 'step1.html'}}
{{elif nextStep == 'step2':}}
{{include 'step2.html'}}
..
will get you going but introduces a maintenance issue if you add a step
later that ou have to remember
+1 we don't want too many cooks without a head chef.
I monitored my own app running under Rocket in development mode with Ubuntu
System Monitor and the RSS memory size started at about 26 MB. After pushing
every link in the interface it had grown to 38.5 MB and then stopped at that
size. It has been running for over a day now with no further
You could consider putting common code in files under modules and use a
local_import to pull it in. During development set the optional reload=True
parameter or you have to restart the server to make a modification in a
module file visible.
I used this tool to track down memory leaks in a Python gstreamer program I
wrote
http://mg.pov.lt/objgraph/
provides object graphs of the heap. Also the web page contains good docs on
tracking down memory problems. It produces PNG files if graphviz is
available or from the command line use
+1
ii python-couchdb
0.6-1
from Ubuntu 10.04.1 dpkg -l
I have to go visit a customer site today so will look again tonight. I think
it is probably time for me to update direct from Apache. This may be a
problem since the rest of the release
web2py uses portalocker.py look under gluon. There are many examples of use
such as locking the session file in globals.py
I for one am happy with the current release cycle. It is a good balance
between new features and the ultimate stability of release 1.XX.N where N
is the last version before XX+1 for example. The nightly build is a bit of a
misnomer, many projects (C or C++ mostly) have some automated process
This is very interesting. I tried all the web servers I have installed
cherrypy, twisted, eventlet, rocket.
The logs say the request service speed is all about the same but twisted
seemed slower from an unscientific response time feel of the app. I load map
images using IMG tags in the part of
Would this key have to be the same in all applications in your case?
auth.settings.hmac_key = 'sha512:63f0a5e7-e395-4a28-8488-cf072a0464b6' #
before define_tables()
not the same as this particular one but consistent across all of the
applications you have since you are sharing your auth_user
Would this key have to be the same in all applications? from my last post
doesn't read correctly.
I mean the same hmac_key in your set of shared applications.
Sorry the deleted posts showed up as duplicates, the web app was showing
error #316 post failed and saying try again but then they were
I copied the welcome application and put the above code into
models/couch_test.py and removed all other model files so there would be no
conflicts. This is in a clone of trunk updated by hg pull and hg update a
few minutes ago.
I get this traceback
camcent...@dev64:~/Dev/web2py_hg$ python
If you are sensitive to new releases to production then take a slower
approach. 1.90.1 to 1.90.6 happened in just over a day with very big changes
coming into 1.90.1 to make the future development in certain directions
possible. I think there were more problems found in trunk testing before
timediff is just 3 integers representing days, seconds, microseconds so you
could decompose it and store it as 3 int fields in the DB and then use the 3
int values in a constructor to get it back. Alternative would be to convert
it to a float or double if you can accept rounding errors.
What we need is a low cost transporter beam like Star Trek (no sarcasm
intended). It would be great to meet the fantastic group of people that
participate in this community surrounding web2py. Kind thought to all.
Thanks for the invite Massimo.
Ron
This is a tiny nit pick so my apologies in advance but I thought it might be
worth mentioning.
I went to the demo page, picked Products and hit the green plus to open the
details on the last item in the list. The control turned red but nothing
else appeared to happen. Second time I noticed a
I think that is a good solution.
winpdb (free and nothing to do with Windows) is a Python debugger that is
multi-thread capable,
The new gluon/dal.py that is currently in trunk can be embedded standalone
so the socket server could understand the database through the same model
files as the web2py application. Just another possibility to look at.
Ron
I have seen LGPL mostly for C libraries like gstreamer so it is
possible for projects to link to them.
JBOSS the RedHat JEE platform also states that although JBOSS is GPL
there is no requirement for applications written to run on the app
server be GPL unless they take a piece of the platform that
I use something like this (the = is equivalent to response.write)
{{
response.write(json(python_data_structure)+;, escape=False)
}}
This is very interesting. I believe this would change the GPL license
reach for MySQL. The regular Python driver is a wrapper around the C
MySQL client library so as a user of that driver you have embedded a
part of MySQL into your application. Using the pure Python driver
means you are now using
I pulled latest version from trunk and tested my app using MySQL and
got a ticket. Easy fix
In sql.py change line 1403 pymysqldb should be pymysql to match the
name from the import
self.pool_connection(lambda db=db,
user=credential_decoder(user),
The web2py.com home page contributions widget is partially covered to
the point nothing can be pushed to make a contribution. I am using
Firefox on Ubuntu 10.04
Ron
New problem with latest hg pull, update. After filling login form and
submit get a ticket during the insert into auth_event different cause
than before.
The def insert at line 3610 is building a new_fields list but the
db._adapter.insert() called on the return statement at 3621 is
expecting a
Perfect now except this ticket as far as my app is concerned testing
against new dal
Traceback (most recent call last):
File /home/camcentral/Dev/web2py_hg/gluon/restricted.py, line 188,
in restricted
exec ccode in environment
File
the m = re.compile line should
have the 'passwd' element of the RE changed to 'password' to be
consistent.
I tested the app after changing and get a lot further into the app but
now see a new fault - will work on that.
Ron
On Dec 6, 11:12 am, ron_m ron.mco...@gmail.com wrote:
Ok that worked
Put dal.py over sql.py in trunk
Start server python web2py.py
Get welcome app in browser
Hit login link get ticket.
I also get this in my own application trying to login.
Field does not have attribute _tablename
Ron
Traceback (most recent call last):
File
Another patch
Hit login form getting a ticket.
sqlhtml.py
line 62 and line 216
field._tablename should be field.tablename
Ron
self.cursor.execute(*a,**b)
ProgrammingError: relation none does not exist
LINE 1: select currval('None')
On Dec 6, 6:04 pm, mdipierro mdipie...@cs.depaul.edu wrote:
fixed in trunk. Thanks.
On Dec 6, 7:31 pm, ron_m ron.mco...@gmail.com wrote:
Another patch
Hit login form getting a ticket
to be put back to use table._tablename unless
you are planning something else. :-)
On Dec 6, 6:04 pm, mdipierro mdipie...@cs.depaul.edu wrote:
fixed in trunk. Thanks.
On Dec 6, 7:31 pm, ron_m ron.mco...@gmail.com wrote:
Another patch
Hit login form getting a ticket.
sqlhtml.py
line 62
fixed the problem with sequence name. Please check.
On Dec 6, 8:45 pm, ron_m ron.mco...@gmail.com wrote:
I still have MySQL installed so copied the app, changed database URL,
deleted all files under the applications databases directory, created
empty db, let app create empty tables by running it once to login
screen. I then did the all data from tables at once export from
PostgreSQL
Describe what I did
Copied the trunk hg area to a work area
Renamed sql.py to sql-save.py
Copied dal.py to sql.py in order to replace sql.py with dal.py
Copied application I am working on to applications directory
Backed up the database
Ran the server as python web2py.py
Got this stack trace
RuntimeError, Failure to connect, tried 5 times
RuntimeError: Failure to connect, tried 5 times
Maybe I did something wrong getting dal.py activated?
On Dec 4, 10:31 am, ron_m ron.mco...@gmail.com wrote:
Describe what I did
Copied the trunk hg area to a work area
Renamed sql.py to sql-save.py
Took a quick look at dynarchlib, looks great and BSD licensed.
I would be careful on the licensing of Ext JS, wasn't this the one
that caused some concerns a couple of years ago when they switched as
they became popular with the GWT users?
On Dec 3, 8:58 am, Michele Comitini
101 - 200 of 285 matches
Mail list logo