[web2py] Web2py and mobile browsing

2010-06-23 Thread Doug Warren
Does anyone have some hints for showing mobile browsers a different set of views than desktop browsers? IE: Detection, redirection, etc... Since the view is determined by the extension of the page how do people handle it?

[web2py] dynamically growing form?

2010-06-22 Thread Doug Warren
I started writing this a few times but I kept deleting it as I wasn't very clear so I'll try again. I'm looking to create a form that has some tabular data in it, 2 columns, but the trick is that each submission of the form will have between 2-10 rows. Each submission represents a single working

Re: [web2py] Re: web2py suggestions

2010-06-22 Thread Doug Warren
I think part of the problem is a lack of dog food. I started looking last night at the state of web2py testing, and was amazed that the gluon/tests directory is not included in any of the 'source' distributions. In fact it's not in the Google code build either. After downloading the bazaar trunk

[web2py] Dal.py ConnectionPool close_all_instances?

2010-06-21 Thread Doug Warren
When is close_all_instances() in the ConnectionPool class of DAL run? main.py always calls close_all_instances through BaseAdapter which seems to always be SQLDB() from sql.py. BaseAdapter is a class in dal.py that inherits from ConnectionPool, but main.py importas BaseAdapter from sql.py instead

Re: [web2py] Initialize some code for other controllers

2010-06-21 Thread Doug Warren
The normal way seem to be to add that code to a model file, but it will be visible/executed for all controllers in the application. On Mon, Jun 21, 2010 at 5:34 AM, pk wrote: > hi together, > > i need help. i need an init to initialize some code like this > (importing apis etc.): > > import time

[web2py] OAuth and Web2Py Tutorial

2010-06-21 Thread Doug Warren
I wrote a small tutorial on how to use OAuth with web2py by linking a session with a Twitter account. A future update will include embedding the access token with auth and creating an oauth login_method class. It can be found at http://dougwarren.org/2010/06/oauth-and-web2py-part-1/

[web2py] bug in dal.py 1.79.1?

2010-06-20 Thread Doug Warren
While poking around dal.py last night came across the following: @@ -3469,7 +3470,7 @@ class Rows(object): returns a set of rows of sorted elements (not filtered in place) """ if not self.records: -return return Rows(self.db, [], self.colnames) +r

[web2py] Forget a session before a redirect?

2010-06-18 Thread Doug Warren
I have an occasion where I know that the contents of a session are invalid, and I'd like to clear the session off the disk/db and clear the session object of an data stored in it. Apparently session.forget() just marks the session as being able to be cleared, and it takes an undocumented(?) argume

Re: [web2py] Re: Firebird distributed transactions?

2010-06-18 Thread Doug Warren
: You are right. As far as I understand firebird does not require begin to start a transaction yet web2py should not fire an exception if you try to begin. I am fixing it in trunk. Please take a look and let us know. I have never tested this with firebird. Massimo On Jun 17, 8:41 pm, Doug Warren w

Re: [web2py] LinkedIn OAuth example requested

2010-06-18 Thread Doug Warren
While not linkedin, I'm writing a blog post now on Twitter oauth and integrating it with web2py. It should be posted on Tuesday. On Jun 18, 2010 7:56 AM, "Carl" wrote: hi Has anyone got a basic example project of using LinkedIn OAuth with the Web2py platform? Something based on Welcome for exam

[web2py] Firebird distributed transactions?

2010-06-17 Thread Doug Warren
I was poking around sql.py tonight and noticed something odd: distributed_transaction_begin has code for mysql and postgres distributed_transaction_commit has code for mysql, postgres, and firebird. The exception in begin says it only works on postgres though it has code for both postgres and mysq

Re: [web2py] how to deploy web2py on port 80

2010-06-17 Thread Doug Warren
What I normally do is run the service on its unprivledged port and then use iptables to forward port 80 traffic. On Jun 17, 2010 5:16 AM, "selecta" wrote: Hello I want to run web2py from a user that is not root on a debian vserver. The problem is that only the root user is allowed to start appli

Re: [web2py] Re: sqlite modeller

2010-06-15 Thread Doug Warren
The problem I found with the web2py exporting though is that it dumps it based on how you drew it on the page, top left first working to the right then the next row etc... So if you happened to placed a foreign key on a lower section of the paper than where you're using it, you'll get an import er

Re: [web2py] Re: upload file -- lot of file in one directory

2010-06-11 Thread Doug Warren
Should this be a lambda instead so you could specify your own function completely? I used to own an ISP and one of the challenges was running the network news server. You'd have > 1M files on a 20 gig drive and have to give them to multiple peers over their lifetime. One thing that we did for per

[web2py] Apache or routes.py rewrite across domains

2010-06-11 Thread Doug Warren
I have a rather interesting situation that came up yesterday. An OAuth callback is statically set to domain2.com/appname however all other web2py apps are hosted out of http://web2py.domain1.com/appname So I have an Apache config like: DocumentRoot "/home/domain1" ServerName web

Re: [web2py] Permission Denied error when updating field

2010-06-11 Thread Doug Warren
As mentioned in irc, you're trying to execute the image as a command, from the python os.system documentation: os.system(command) Execute the command (a string) in a subshell. This is implemented by calling the Standard C function system(), and has the same limitations. Changes to sys.stdin, e

Re: [web2py] Re: Separating models into their own files

2010-06-10 Thread Doug Warren
On Thu, Jun 10, 2010 at 10:53 AM, Yarko Tymciurak wrote: > > More discussion, thoughts? > > (maybe this should move to the web2py developer's thread?) As my request is still 'pending' I'd ask to keep the discussion here so I can contribute.

Re: [web2py] Re: Separating models into their own files

2010-06-10 Thread Doug Warren
That's kind of what i was getting at with my suggestion listed above in some pseudocode. Let the model try to grab it's required modules if it can't find one it'll just raise an exception and it'll be tried again later. Eventually all dependencies that are solvable will work themselves out... (On

Re: [web2py] Controller wide auth

2010-06-10 Thread Doug Warren
EL >> >> instead of : >> >> http://127.0.0.1:8000/dev/default/user/login?_next=/dev/default/TABLE >> >> Could it be import urllib that failed? >> >> Jonhy >> >> 2010/6/10 Jean Guy >>> >>> The redirect those not work out of

Re: [web2py] Re: Separating models into their own files

2010-06-10 Thread Doug Warren
One thing I thought about was to have the models loading wrap around an exception holder in run_models_in something like delay_process = [] for model in models: ... try: restricted() except RequirementMissing: delay_process.append(model) while 1: new_delay_process

[web2py] Controller wide auth

2010-06-10 Thread Doug Warren
I've had an issue lately where pretty much every function in a controller needed an auth decorator. Given how many functions were in the controller this turned out to be an error prone forgetful process. So I came up with a simple and probably obvious way to make a controller wide auth check comp

Re: [web2py] performance issue- multiple db connection

2010-06-09 Thread Doug Warren
Sorry to bump an old email, but was this changed at some point? (master) [dwar...@thebigwave gluon]$ grep pool_size\= * dal.py:def __init__(self,db,uri,pool_size=0,folder=None,db_codec ='UTF-8'): dal.py:def __init__(self,db,uri,pool_size=0,folder=None,db_codec ='UTF-8'): dal.py:def __in

Re: [web2py] Re: Keep the instance of a class during the session

2010-06-09 Thread Doug Warren
I ran into this a few nights ago, and if I wasn't about to leave on a vacation I'd try some prototype code for it, but from what I can tell at the end of any request all open database connections are marked to be closed (Except for those needed to keep the connection pool up to it's proper size.)

Re: [web2py] Re: Inserting data with foreign keys not from a form

2010-06-09 Thread Doug Warren
e Foreign > Key").select(limitby=(0,1)).first() > if fk: >    fk_id=fk.id > else: >    fk_id=db.fk_table.insert(name="The Foreign Key") > if db(table2.id > 0).count() == 0: >    db.table2.insert(name = "Some name", fk_id = fk_id, field2="some > value&

Re: [web2py] Re: Inserting data with foreign keys not from a form

2010-06-09 Thread Doug Warren
Sorry to bump my own message but is there a better way to handle this? On Jun 4, 2010 8:02 AM, "Doug Warren" wrote: Yes, but the foreign key here is many to one, not one to one. (I guess I should have been more clear: if db(fk_table.id > 0).count() == 0: db.fk_table.insert(name

Re: [web2py] Re: PluginManager?

2010-06-09 Thread Doug Warren
On Wed, Jun 9, 2010 at 3:34 AM, Thadeus Burgess wrote: > We have not fully agreed on the spec of PluginManager, it has been > added as a proof of concept, however no plugins to date have been > implemented with it. There are hundreds of posts debated what it > should do. > > Currently the spec for

[web2py] Web2py naming bug

2010-06-07 Thread Doug Warren
I think I was just bitten by a naming bug...  I named my application starting with a number and for a few days everything worked fine until that fateful night when i tried to local_import something... Traceback (most recent call last):  File "C:\4x2-server\web2py\gluon\restricted.py", line 178, in

[web2py] PluginManager?

2010-06-07 Thread Doug Warren
So I'm writing a plugin to handle scheduling of tasks with a dynamic granularity of a second or less, and I went to use PluginManger per it's definition in tools.py: class PluginManager(dict): """ This object stored parameters to configure plugins (if they need configuration) In models/

Re: [web2py] Re: Layout of functions with the MVC environment

2010-06-04 Thread Doug Warren
On Fri, Jun 4, 2010 at 9:11 AM, Yarko Tymciurak wrote: > > > On Jun 4, 10:58 am, Doug Warren wrote: >> I don't believe I want to local_import my db.py file as it's already >> set up by the environment correct? > > Correct - you do not want / need to impor

Re: [web2py] Re: Layout of functions with the MVC environment

2010-06-04 Thread Doug Warren
On Fri, Jun 4, 2010 at 8:56 AM, Yarko Tymciurak wrote: > > > On Jun 4, 10:43 am, Doug Warren wrote: >> Traditionally when I've written MVC style applications, the model >> would contain not only the data representing the objects but also the >> data for manipulating t

[web2py] Layout of functions with the MVC environment

2010-06-04 Thread Doug Warren
Traditionally when I've written MVC style applications, the model would contain not only the data representing the objects but also the data for manipulating the objects. I'm not sure how that same relation applies to web2py. If I have a model that defines 4-5 tables, 2 of them are just foreign k

Re: [web2py] Re: Wouldn't it be cool ...

2010-06-04 Thread Doug Warren
he US, and 4g is covered at my home, my office, and my gym. On Thu, Jun 3, 2010 at 10:47 PM, mdipierro wrote: > hmmm. I must get one of these... > > On Jun 3, 7:54 pm, Doug Warren wrote: >> http://google-opensource.blogspot.com/2009/06/introducing-android-scr... >> ? >> &

Re: [web2py] Re: Inserting data with foreign keys not from a form

2010-06-04 Thread Doug Warren
e value3") db.table2.insert(name = "Some name4", fk_id = fk.id, field2="some value4") On Fri, Jun 4, 2010 at 8:00 AM, mr.freeze wrote: > The insert function will return the id. > fk = db.fk_table.insert(name="The Foreign Key") > > On Jun 4, 9:48

[web2py] Inserting data with foreign keys not from a form

2010-06-04 Thread Doug Warren
Hi, I defined all my tables in my model file and want to have a few hundred rows of default foreign keys to maintain 3rd normal form. So I have things in my code such as: if db(fk_table.id > 0).count() == 0: db.fk_table.insert(name="The Foreign Key") if db(table2.id > 0).count() == 0: f

Re: [web2py] Wouldn't it be cool ...

2010-06-03 Thread Doug Warren
http://google-opensource.blogspot.com/2009/06/introducing-android-scripting.html ? On Thu, Jun 3, 2010 at 5:34 PM, weheh wrote: > if web2py could run native on the Droid? Then, give me a foldup > keyboard and who would need a laptop any more?

Re: [web2py] Re: Multiple instances of same application

2010-06-03 Thread Doug Warren
gt;> To reach this goal, two things need to be adjusted in web2py source >> code: >> >> Thing1: add 0_local_config_pls_dont_pack_dont_commit.py into / >> web2py/.hgignore >> >> Thing2: adjust the admin's pack code, to NOT pack the new >> 0_local_config

[web2py] Multiple instances of same application

2010-06-03 Thread Doug Warren
Is there a preferred way to handle multiple instances of the same application installed on the same machine? Say for instance is there's 3 dev environments and 2 staging environments on one server pointing at different databases? Is there a preferred way of getting the configuration to each uniqu

Re: [web2py] Re: A basic problem about threading and time consuming function...

2010-06-02 Thread Doug Warren
I started looking at this a bit, you can find the specs for the Comet protocol, such as it is at http://svn.cometd.com/trunk/bayeux/bayeux.html It's built on top of JSON but isn't quite JSON-RPC. More of a publish/subscribe model. The latest version of 'cometd' just released a beta release availab

[web2py] gitignore

2010-06-02 Thread Doug Warren
Greetings, I'm setting up some git repositories for a web2py project where the staging and some dev will be done under linux while other developers will be done under win32. For simplicities sake, the pure python implementation of web2py will be checked in as well as the applications. win32 file

[web2py] Separate Auth DB

2010-05-30 Thread Doug Warren
Greetings, I'm testing how/if web2py could support foreign keys across db connections For example I modified the mywiki app to look like: db = DAL('sqlite://storage.sqlite') authdb = DAL('sqlite://authdb.sqlite') from gluon.tools import * auth=Auth(globals(),authdb) # authentication

[web2py] book section 4.7

2010-05-30 Thread Doug Warren
I'm still not sure if this is the correct place to post issues with the book so if it's not someone please let me know where is, otherwise I'll keep doing so :) The response chapter in the book doesn't mention response.files at all, is it intended to be internal and only used by the web2py_ajax.ht

Re: [web2py] Re: New to web app development -- is web2py a good choice

2010-05-30 Thread Doug Warren
One thing that would probably be helpful is just to get some of the links that are presented here into the official website. Maybe I wasn't looking at the right spot, but while I had found web2pysplices, and the appliances section on the main website, until this thread I've never seen http://web2p

[web2py] Question about the wiki

2010-05-28 Thread Doug Warren
I'm not sure if the group is the correct place to ask questions about the wiki or not, so if it's not the right place please let me know what is... I've used python a bit in the past but needed a refresher so I started going through the tutorial in the web2py book and ran across the following: htt

[web2py] scripts/setup-web2py-ubuntu.sh and web2py.ubuntu.sh incompatible?

2010-05-26 Thread Doug Warren
Hi, I'm setting up a new dev environment for some users under Ubuntu 10 and I notice that the two supplied scripts in the scripts dir for dealing with Ubuntu seem to not be compatible... setup-web2py uses a 'www-data' directory with an install path in /home/www-data among other things. web2py.ubu

Re: [web2py] dynamic routes for subdomains

2010-03-25 Thread Doug Warren
I've done that with an Apache front end using ProxyPass and ProxyPassReverse, there may be an easier way in web2py however. ServerName hello.example.com ProxyPass / http://127.0.0.1:8009/init/default/action/hello ProxyPassReverse / http://127.0.0.1:8009/init/default/actio