[web2py] Re: web2py performance
problem solved by using rows = db.executesql(db(db.mytable.id>0)._select(db.mytable.myfield, db.mytable.id)) seems time is going to 0 ms It's some hard to coding without dictionaries, but really much faster for big massive of data On 7 фев, 12:24, LightOfMooN wrote: > Hi > Just download web2py, run it and go to edit welcome app. > > in db.py: > db.define_table('mytable',Field('myfield','string')) > > in controllers/default.py: > def index(): > if request.vars.add_rows: > for i in xrange(10): > db.mytable.insert(myfield='') > rows = db(db.mytable.id>0).select() > response.flash = "Welcome to web2py!" > return dict() > > in controllers/index.html: > {{extend 'layout.html'}} > > > > > Let's test it. > Click on "add_rows" button to insert 10 rows in database. > Then reload page. > There are just one query, that gets us one set of 100k rows. > Time to process query is less than 100ms, but page loads 5-6s! > Nothing passed to the view. > > So, my question is: > > Is web2py can be used in production for big sites, or just for small- > home-sites? > thx
Re: [web2py] web2py performance
On 7 February 2012 09:27, Bruce Wade wrote: > You are using a for loop with 10 inserts it is the for loop holding > you up not web2py. Plus who in their right mind would code something like > that in production > I understood him differently: the result of query after the 100k rows were loaded took 5-6s to appear in the view. I just did a test at a database I am working with daily: It is a complex database and the table I am querying has 326543 records with several links to other tables. Using SQLFORM.grid to show the contents of 6 fields took 13 seconds for the first page to show up in the view when using the server which serves the page through apache over the network. On my laptop (localhost:8000) the same query with the same database content took 6 seconds to show up.. That is not particularly fast. BUT: subsequent queries took less than a second in both cases even when I used a different browser. So it cannot be the browser cache that made the difference. So the lesson for the day: If you want to test responses, don't just take one or two reactions as the final answer. Regards Johann -- Because experiencing your loyal love is better than life itself, my lips will praise you. (Psalm 63:3)
Re: [web2py] Re: web2py performance
You should be using paging there is no point in query that much data at once you could never visually display it On Feb 6, 2012 11:36 PM, "LightOfMooN" wrote: > I'm using loop for 10 inserts just one time to insert 100k records > in database. > All next time I just try to get response. > And now in our project we have much more than 100k records, that can > be filtered and sorted by some dinamic conditions. > > On 7 фев, 12:27, Bruce Wade wrote: > > You are using a for loop with 10 inserts it is the for loop holding > you > > up not web2py. Plus who in their right mind would code something like > that > > in production > > On Feb 6, 2012 11:24 PM, "LightOfMooN" wrote: > > > > > > > > > > > > > > > > > Hi > > > Just download web2py, run it and go to edit welcome app. > > > > > in db.py: > > > db.define_table('mytable',Field('myfield','string')) > > > > > in controllers/default.py: > > > def index(): > > >if request.vars.add_rows: > > >for i in xrange(10): > > >db.mytable.insert(myfield='') > > >rows = db(db.mytable.id>0).select() > > >response.flash = "Welcome to web2py!" > > >return dict() > > > > > in controllers/index.html: > > > {{extend 'layout.html'}} > > > > > > > > > > > > > > Let's test it. > > > Click on "add_rows" button to insert 10 rows in database. > > > Then reload page. > > > There are just one query, that gets us one set of 100k rows. > > > Time to process query is less than 100ms, but page loads 5-6s! > > > Nothing passed to the view. > > > > > So, my question is: > > > > > Is web2py can be used in production for big sites, or just for small- > > > home-sites? > > > thx >
[web2py] Re: Workflow engine for web2py
I am having the same interest... On Jan 19, 3:02 am, António Ramos wrote: > is it dificult to do something like this in web2py? > > http://blog.aizatto.com/2009/12/07/ruby-on-rails-finite-state-machine...
Re: [web2py] Re: keep shared objects permanently in RAM: Is it possible ?
Sebastian, Use mmap, or some wrapper around it. It does what you need, the work is done by the O.S. It allows you to manage any size of buffer, even 16GB provided that your OS supports it. mmap is the underlying mechanism used by almost any implementation that has to deal with shared memory among processes. I bet it is what java uses at low level. The advantage with python compared to java is that you access a system call, so it is faster, but also easy to use. This thing has nothing to do with language or framework of choice, so if you write the thing correctly, you can access the mmap from both python program and java program (or c++ or lisp for that matter) at the same time. BTW if the problem is only having weblogic alternative to save licensing costs, why don't you use something free as jboss, glassfish, geronimo? mic 2012/2/7 Niphlod : > If so, let me rephrase it...having 16gb of data and have to access all > 16 gb at on time is a daunting task. if you have 16gb of data and you > work only on a piece of that, let's say, an indexed tree and a client > requests just a node, you can try with redis. the problem arises only > when you have to put into python process's memory 16 gb of data > alltogether. > > > On 6 Feb, 22:09, "Sebastian E. Ovide" > wrote: >> On Mon, Feb 6, 2012 at 7:39 PM, Bruno Rocha wrote: >> > 16 GB shared across requests is called "Database", to run a memory like >> > database you should go with Redis! >> >> :D it sounds a lot... but it is not anymore... specially if you want to >> serve a lot of requests in realtime ! >> >> we are using two machines with 36G for a real commercial application. We >> use so much memory for implementing a tree for fast research of addresses >> using phonetics (28M addresses)... using Oracle (a big machine optimized by >> two DBA experts) was two slow for us (around 1 second per query)... A big >> improvement was obtained using special indexes (created by lucene) stored >> in SSD... but still to slow for us... so the only solution was to use a >> "special" tree all in memory >> >> just investigating if there is something else in the open source that could >> save us Weblogic licences >> >> -- >> Sebastian E. Ovide
[web2py] Re: web2py performance
Yes its known behaviour because using standard DAL query the system has to convert every line into Python object, which is really time consuming for 100K documents.
[web2py] Some very basic, but important questions.
Hello crowd! I'm relatively new to web2py and being impressed with its feature set to build our intranet apps I am currently through my way into reading docs. However some major questions to common functionality we currently use popped up which I could not find answers to in documentation, it would be really nice to get those here: 1. How do we configure common settings (mail, auth, sessions, db connection) and share theme across all apps as per DRY principle? Basically I want to use the same mail, db, auth (active directory) and session (not mandatory though) across all apps. 2. How do we use one common layout file for all apps? Is it possible to define a custom placeholder for templates? This is very important as we should not repeat ourselves with copying basic common layout, css and images into all apps. That would result in maintenance nightmare. I read somewhere it was suggested to use symlinks, but it kinda breaks the point of compiled templates. 3. What is the best way to create something like front controller? It should include common functions for all other controllers in all apps. 4. What are the alternatives to scopes (Rails) or custom model managers (Django) and model callbacks/observers (Rails) or signals (Django)? 5. What is the best place to define view helpers and how to pass them to views? And last, is Py3k compatible version under works or planned? Thanks a lot!
Re: [web2py] web2py performance
You can use bulkinsert to insert huge amount of records, yes is fast. Also if you are doing long time task, you can use "scheduler", to schedule your task, if you need to inform to the client browser you can use tornado , there are an example using with web2py out there, or reload the page after 5 seconds for example to check if the task is done. 2012/2/7 LightOfMooN > Hi > Just download web2py, run it and go to edit welcome app. > > in db.py: > db.define_table('mytable',Field('myfield','string')) > > in controllers/default.py: > def index(): >if request.vars.add_rows: >for i in xrange(10): >db.mytable.insert(myfield='') >rows = db(db.mytable.id>0).select() >response.flash = "Welcome to web2py!" >return dict() > > in controllers/index.html: > {{extend 'layout.html'}} > > > > > > > Let's test it. > Click on "add_rows" button to insert 10 rows in database. > Then reload page. > There are just one query, that gets us one set of 100k rows. > Time to process query is less than 100ms, but page loads 5-6s! > Nothing passed to the view. > > So, my question is: > > Is web2py can be used in production for big sites, or just for small- > home-sites? > thx > -- http://www.tecnodoc.com.ar
Re: [web2py] Re: keep shared objects permanently in RAM: Is it possible ?
You can use a multi-threaded webserver, permanently importing the data in a module. Also, you could use multiprocessing python module listener/client to do basic RPC between the web process and a parallel process handling the data. Best regards, Mariano Reingart http://www.sistemasagiles.com.ar http://reingart.blogspot.com On Tue, Feb 7, 2012 at 6:14 AM, Michele Comitini wrote: > Sebastian, > > Use mmap, or some wrapper around it. It does what you need, the work > is done by the O.S. It allows you to manage any size of buffer, even > 16GB provided that your OS supports it. mmap is the underlying > mechanism used by almost any implementation that has to deal with > shared memory among processes. I bet it is what java uses at low > level. > The advantage with python compared to java is that you access a system > call, so it is faster, but also easy to use. > This thing has nothing to do with language or framework of choice, so > if you write the thing correctly, you can access the mmap from both > python program and java program (or c++ or lisp for that matter) at > the same time. > > BTW if the problem is only having weblogic alternative to save > licensing costs, why don't you use something free as jboss, glassfish, > geronimo? > > mic > > > 2012/2/7 Niphlod : > > If so, let me rephrase it...having 16gb of data and have to access all > > 16 gb at on time is a daunting task. if you have 16gb of data and you > > work only on a piece of that, let's say, an indexed tree and a client > > requests just a node, you can try with redis. the problem arises only > > when you have to put into python process's memory 16 gb of data > > alltogether. > > > > > > On 6 Feb, 22:09, "Sebastian E. Ovide" > > wrote: > >> On Mon, Feb 6, 2012 at 7:39 PM, Bruno Rocha > wrote: > >> > 16 GB shared across requests is called "Database", to run a memory > like > >> > database you should go with Redis! > >> > >> :D it sounds a lot... but it is not anymore... specially if you want to > >> serve a lot of requests in realtime ! > >> > >> we are using two machines with 36G for a real commercial application. We > >> use so much memory for implementing a tree for fast research of > addresses > >> using phonetics (28M addresses)... using Oracle (a big machine > optimized by > >> two DBA experts) was two slow for us (around 1 second per query)... A > big > >> improvement was obtained using special indexes (created by lucene) > stored > >> in SSD... but still to slow for us... so the only solution was to use a > >> "special" tree all in memory > >> > >> just investigating if there is something else in the open source that > could > >> save us Weblogic licences > >> > >> -- > >> Sebastian E. Ovide >
Re: [web2py] web2py long term projects: experiences ?
I can tell my experience, I'm working for 2 years with web2py or more I think. I work in different projects, one I currently developing I think is quite big, work with millons of records, and is very complex and has many lines of code and many tables, is an internal application for a national company. Also I worked in instant press from 1 year ago or more, and many other applications. In matter of scaling what I can say. Don't keep it with the basic. For me this is python and the important is the code, the beauty of the code, make sure that you application use modules, yes import is a great thing, this keep you code well order, take in mind nobody wants to read an awfull code, and in a future you can add new code and debug the problems easily. When you have a big app, models are not a good idea, this is why some experience developers quite from using web2py, the problem is that are giving up too fast, because you can avoid using models in web2py app, or at least using elemental models. You can read more why in my slides from last pycon at argentina http://www.slideshare.net/martinpm/web2py-pensando-en-grande-9448110. Also you can read examples like lessmodel application that bruno rocha made or the plugin aproach by kenshi here http://dev.s-cubism.com/plugin_jstree. Scheduler is another great piece of code, it's small but pretty powerfull, It's really nice and I use a lot. I don't know why the people are not using more. You can run a long time task to avoid timeout of the server and client with long tasks. Dal, well in my experience is great but not always I can use full of it. Many times I have heavly or complex queries that I have to pass it with executesql. But dal is working pretty well with this mix. About "breakage" when upgrating web2py, yes I have some, but it's my fault because sometimes I'm using experimental features and not stable, I want always the last features, I remember scheduler and grid give me some trouble with this. But in generally I have running application of about 2-3 years ago with the last version. 2012/2/3 howesc > i don't know of any blogs that discuss the experiences of users over the > long term. i suspect this group history might be an indication. heck, > check my posts over the past couple of years - whenever i hit bumps in the > road i tend to ask questions here. > > are there specific things we can help answer? i have used web2py for 4 > live production projects (and a few toys along the way), 3 of the 4 are on > google app engine, and one of the 4 sees a sustained 60 requests a second > average, so i've been using it all heavily (though not always the most up > to date, i'm slow at incorporating new features). > > cfh > -- http://www.tecnodoc.com.ar
[web2py] Re: email updates not recd for this group
I did as you suggested (sent a request with the forum web interface) and after some days my email digests are back. Thanks On 30 ene, 12:18, Anthony wrote: > If you view the group via the forum interface > (https://groups.google.com/forum/?fromgroups#!forum/web2py), at the far
[web2py] Deploying web2py on webfaction and using tunneling
I've gotten web2py working on my webfaction account with admin using an https site pointing to the webapp and changing the parameters_xxx.py file to the port that the web app should be using. So now I have a regular site and a https site pointing to the port that the app uses. I don't think wf allows you to access your app via different ports - only the provided one - wf sees your standard request and routes it to the correct and only port. Massimo gave me the impression that this was insecure via this reddit comment. ***QUOTE*** One is the parameters_*.py file. This file is required to enable admin and normally it is created automatically when running the built-in web server. In a production environment it is not created because you should not run admin off port 80. Admin would not work anyway because requires https unless in use a proxy, in which case if you enable admin by manually creating this file, you open your system to vulnerability (like using telnet instead of ssh). The proper way to handle this is: sudo -u www-data python -c "from gluon.main import save_password; save_password(raw_input('admin password: '),443)" and use admin only over https (port 443). Feel free to join us on the web2py mailing list. ***/QUOTE*** I can get a web2py install running by using ssh to get to my account, download web2py, unzip it and then run it once setting the admin password. I then kill the process and then use a script to launch anyserver.py using a cherrypy server. My ultimate question is - if https is less secure to my wf app - how do I use ssh to get to the apps admin? The slice at "http://www.web2pyslices.com/slices/take_slice/71"; has been tried and it didn't work or I didn't do it correctly. How do I use ssh to access the web2py admin on webfaction? There is this: http://docs.webfaction.com/user-guide/databases.html#starting-an-ssh-tunnel-with-putty But it pertains to accessing databases.
[web2py] Traceback.
I just updated latest. I see this. S'Traceback (most recent call last):\n File "/apps/www/web2py.trunk/gluon/restricted.py", line 204, in restricted\nexec ccode in environment\n File "/apps/www/web2py.trunk/applications/app/controllers/default.py", line 348, in \n File "/apps/www/web2py.trunk/gluon/globals.py", line 172, in \nself._caller = lambda f: f()\n File "/apps/www/web2py.trunk/applications/app/controllers/default.py", line 158, in user\nform = auth()\n File "/apps/www/web2py.trunk/gluon/tools.py", line 1160, in __call__\n return getattr(self,args[0])()\n File "/apps/www/web2py.trunk/gluon/tools.py", line 1809, in login\n self.log_event(log, user)\n File "/apps/www/web2py.trunk/gluon/tools.py", line 1455, in log_event\n self.settings.table_event.insert(description=description % vars,\nAttributeError: \'NoneType\' object has no attribute \'insert\'\n' Maybe its me? Thanks.
[web2py] Re: how to iterate over a web2py row object to get all rows
Hi Niphlod, This is amazing - The below code did the trick. I am thrilled with these settings. I need to go back and do my homework right (study the web2py book with new features) - Also need to learn new database skills, I agree with you completely that leaving joins to db or rather the stuff that db can handle to db will always be more efficient. lfu = db((db.friends.reguserid == session.logged_in_user_id) & (db.friends.status == 'Friend'))._select(db.friends.friendid) # mind the ._SELECT instead of .SELECT friendupdates = db((db.updates.reguserid.belongs(lfu) ) & (db.updates.updated_on==now)).select() return dict(list_friend_updates_list=friendupdates) Thanks Rahul (www.flockbird.com) - Build Connect beta = On Feb 6, 6:06 pm, Niphlod wrote: > well... > > for row in lfu: > list_friend_updates= getfriend(row.friendid) > print list_friend_updates > return dict(list_friend_updates=list_friend_updates) > > prints all, but reassign for every loop to list_friend_updates ONLY > the getfriend(row.friendid). > > You are not seeing the first record when returning the dict, but the > last one of the loop. > > You need to store every result for all the records in the loop in a > list, for example > > list_friend_updates_list = [] > for row in lfu: > list_friend_updates= getfriend(row.friendid) > list_friend_updates_list.append(list_friend_updates) > > return dict(list_friend_updates_list=list_friend_updates_list) > > PS: sure that this can't be retrieved by joining tables instead of > retrieve recursively ? > > you are doing > > friendupdates = db((db.updates.reguserid == friendid ) & > (db.updates.updated_on==now)).select() > > for every friendid passed by the first query > > lfu = db((db.friends.reguserid == session.logged_in_user_id) & > (db.friends.status == 'Friend')).select(db.friends.friendid) > > that can be accomplished by > > lfu = db((db.friends.reguserid == session.logged_in_user_id) & > (db.friends.status == 'Friend'))._select(db.friends.friendid) # mind > the ._SELECT instead of .SELECT > > friendupdates = db((db.updates.reguserid.belongs(lfu) ) & > (db.updates.updated_on==now)).select() > > !!! > > Leaving joins to db is more efficient than doing in a recursive loop > in python! > > On 6 Feb, 13:28, Rahul wrote: > > > > > > > > > Hi All, > > I am using web2py 1.99.4 on Win7. I have this part of code that I > > want to serialize to a view but conditionally. I am trying to retrieve > > id's from one table and pass the id's to get data from another table. > > Although I am able to make it work from within the loop but from > > outside of the loop with "list_friend_updates=list_friend_updates", it > > does not work fine. It only shows me the first entry and ignores the > > rest. I think that could be a python programming problem of mine, can > > any one suggest a solution? > > I want that "list_friend_updates" should get all the rows I want to > > iterate over. I've checked other functions and they are returning > > proper values. > > > Here is the code from my controller - > > def home(): > > list_friend_updates="" #Dummy value declared to stop it showing any > > issue > > > #Get Friends ids first > > lfu = db((db.friends.reguserid == session.logged_in_user_id) & > > (db.friends.status == 'Friend')).select(db.friends.friendid) > > > #pass the selected friendid recursively (using a for loop) and get > > their updates... > > > for row in lfu: > > #Call getfriend (see below) function below and iterate over each > > id found, getfriend function returns values > > list_friend_updates= getfriend(row.friendid) > > print list_friend_updates #This shows all friends records and > > works but fails if I use it in return below > > > return dict(form=form , list_friend_updates=list_friend_updates, ) > > > # Get Friend Function - Get the friend id values from above > > function and iterate over each to get data # > > def getfriend(friendid): > > friendupdates = db((db.updates.reguserid == friendid ) & > > (db.updates.updated_on==now)).select() > > > return friendupdates > > > > What am I doing wrong? Please suggest. > > > Thanks, > > Rahul D (www.flockbird.com) - Build Connect beta
Re: [web2py] Some very basic, but important questions.
On Tue, Feb 7, 2012 at 7:08 AM, amiroff wrote: > Hello crowd! > > I'm relatively new to web2py and being impressed with its feature set > to build our intranet apps I am currently through my way into reading > docs. However some major questions to common functionality we > currently use popped up which I could not find answers to in > documentation, it would be really nice to get those here: > > 1. How do we configure common settings (mail, auth, sessions, db > connection) and share theme across all apps as per DRY principle? > Basically I want to use the same mail, db, auth (active directory) and > session (not mandatory though) across all apps. > You can have your shared settings in a common python module, and then import it in your model: from shared_settings import DB_URI db=DAL(DBURI) Although it is a bit different, see how web2conf for an example on how to store settings in a separate file (it is not imported, but it could be): http://code.google.com/p/web2conf/source/browse/models/0.py > 2. How do we use one common layout file for all apps? Is it possible > to define a custom placeholder for templates? This is very important > as we should not repeat ourselves with copying basic common layout, > css and images into all apps. That would result in maintenance > nightmare. I read somewhere it was suggested to use symlinks, but it > kinda breaks the point of compiled templates. > There is not direct support for shared views now, mainly because I think you may be confused about terminology. web2py "applications" are the similar to django "projects", so it would be not required to share views across applications in web2py. Anyway, a more flexible view rendering system should be possible (response.render already receives the template filename, extending this to include a path should not be a major issue, see compileapp.run_view_in) > 3. What is the best way to create something like front controller? It > should include common functions for all other controllers in all apps. > According the "wikipedia" definition of front controllers, web2py models/controllers implement that pattern, as they "provides a centralized entry point for handling requests" You can put common application-wide functions in the models, and specific function in the controllers, including caching, redirecting, security, etc. > 4. What are the alternatives to scopes (Rails) or custom model > managers (Django) and model callbacks/observers (Rails) or signals > (Django)? > I do not remember any, but there are some discussions on the developer list to implement some features like signals for data updates. Also, there are some workaround depending in your needs. > 5. What is the best place to define view helpers and how to pass them > to views? > View helpers aren't mandatory in web2py (as a python template language is used). But, if you want to have functions to use in the views, you can put then in the models or in modules. > And last, is Py3k compatible version under works or planned? > Yes, there are two py3k "unnoficial" versions under development: a proof of concept running under python 3.2: http://code.google.com/r/reingart-web2py/source/browse/?name=py3k a manual attempt to make a python 3 alternative codebase: https://github.com/cannatag/web2py-python3 You can search this list for further information. Best regards, Mariano Reingart http://www.sistemasagiles.com.ar http://reingart.blogspot.com
[web2py] Re: Traceback.
It was me. Sorry :) On 2/7/12 6:53 AM, David wrote: I just updated latest. I see this. S'Traceback (most recent call last):\n File "/apps/www/web2py.trunk/gluon/restricted.py", line 204, in restricted\nexec ccode in environment\n File "/apps/www/web2py.trunk/applications/app/controllers/default.py", line 348, in \n File "/apps/www/web2py.trunk/gluon/globals.py", line 172, in \nself._caller = lambda f: f()\n File "/apps/www/web2py.trunk/applications/app/controllers/default.py", line 158, in user\nform = auth()\n File "/apps/www/web2py.trunk/gluon/tools.py", line 1160, in __call__\n return getattr(self,args[0])()\n File "/apps/www/web2py.trunk/gluon/tools.py", line 1809, in login\n self.log_event(log, user)\n File "/apps/www/web2py.trunk/gluon/tools.py", line 1455, in log_event\n self.settings.table_event.insert(description=description % vars,\nAttributeError: \'NoneType\' object has no attribute \'insert\'\n' Maybe its me? Thanks.
Re: [web2py] web2py performance
Johann, there were no views in the example. On Tue, Feb 7, 2012 at 6:35 AM, Johann Spies wrote: > On 7 February 2012 09:27, Bruce Wade wrote: >> >> You are using a for loop with 10 inserts it is the for loop holding >> you up not web2py. Plus who in their right mind would code something like >> that in production > > > I understood him differently: the result of query after the 100k rows were > loaded took 5-6s to appear in the view. > > I just did a test at a database I am working with daily: It is a complex > database and the table I am querying has 326543 records with several links > to other tables. Using SQLFORM.grid to show the contents of 6 fields took > 13 seconds for the first page to show up in the view when using the server > which serves the page through apache over the network. On my laptop > (localhost:8000) the same query with the same database content took 6 > seconds to show up.. That is not particularly fast. BUT: subsequent > queries took less than a second in both cases even when I used a different > browser. So it cannot be the browser cache that made the difference. > > So the lesson for the day: If you want to test responses, don't just take > one or two reactions as the final answer. > > Regards > Johann > -- > Because experiencing your loyal love is better than life itself, > my lips will praise you. (Psalm 63:3) >
[web2py] Re: VPScolo.com Five dolar VPS, anybody knows it?
I haven't heard of them before, but I have learned a quick lesson about VPS providers: most of them are one-man operations that only last for a few months. I have done a LOT of research on VPS providers over the last couple of weeks and the one site I always end up turning to for advice on providers is Low End Box: http://www.lowendbox.com/ I did a search for VPScolo on LEB and found an ad from 2010. So the fact that they've been around for at least 2 years is a good sign. You don't get a whole lot of resource though. So far, I have only found two VPS providers that give you the most resources for your money. If you need bandwidth, go for RethinkVPS. They offer unlimited transfer. If you need more memory, look at ChicagoVPS. I got in on a good deal with them: 2GB of RAM, 2TB of transfer for $7/month. As for the burst, you have 256 MB of RAM. The burst is like swap space. It is there for temporary usage only. Many providers provide you with burst memory in case your site is listed on Reddit or Slashdot and experiences a sudden spike in traffic. If you are eating into burst memory often, your provider will make you upgrade to a better plan, or ask you to leave. So make sure that 256 MB is more than sufficient for your needs. As a quick note, I am not associated with VPS providers. I was looking for one recently, so I started doing my homework for a provider that met my needs. I should also mention that these are cheap plans, and are a step up from shared hosting, but they are not going to be as high quality as a provider such as VPS.net or Rackspace, etc. So there will be some downtime every now and then.
[web2py] Re: how to iterate over a web2py row object to get all rows
no problem, as web2py "borns" with an "educational" angle, someone will always help you in this group. I for myself learned a lot just kidding with the framework. Bye.
Re: [web2py] Re: web2py performance
Yes, David. That's a point. But, I'd like to say if somebody needs to retrieve 100k lines through a single query in an online application, something sounds bad. I'm used to work on tables with millions rows. If you don't elaborate a good queries and indexes to minimize traffic between db server and its client, things go down quickly. So, I don't think this kink of benchmark has some value to real applications. -- Vinicius Assef. On Tue, Feb 7, 2012 at 7:56 AM, David Marko wrote: > Yes its known behaviour because using standard DAL query the system has to > convert every line into Python object, which is really time consuming for > 100K documents.
Re: [web2py] Re: DAL Connection String
Ok, I was a little unclear. There's no need to change any regex in DAL code. Let's say we have a database named "bbb", on localhost, port 5432, username "hello" and password "password". DB URI will be : postgres://hello:password@localhost:5432/bbb Now, the decode_credential part. With the regex, credentials are whatever goes from "postgres://" to the "@". Let's say we have the password changed from the example abow, from "password" to "p@ssword". Regex is going to fail, but we have decode_credential enabledwe'll take the default lambda that is urllib.unquote(). To reverse that, we need to call a urllib.quote() not on the full connection string, but only on the "parts" costituting it. With that, "p@ssword" needs to be quoted "p%40ssword" . DB URI is now postgres://hello:p%40ssword@localhost:5432/bbb . Regex works fine, extracts hello:p%40ssword, unquoted password is p@ssword and everything goes fine. Just tested on my machine, works perfectly!
Re: [web2py] Re: DAL Connection String
PS : final DAL initiation code is db = DAL('postgres://hello:p%40ssword@localhost:5432/bbb', decode_credentials=True)
Re: [web2py] Re: how to restart only one app in uwsgi?
oh yeah, I tested it :D Now I'm planning a "move" towards running uwsgi in emperor mode and keeping the emperor process alive and kicking with upstart http://projects.unbit.it/uwsgi/wiki/Emperor Summary : Just point the emperor to a folder with config files, it thinks at all the rest. Remove a config--> app stops, add a config--> app starts, touch the config --> it reloads only that app. Seems a lot funnier to work with. I had a lot of headaches trying to understand /etc/init.d/uwsgi-python (I like to mess with things a lot before using them plainly :D )
[web2py] Re: Too many redirects when trying to use interactive demo
Same problem here. Using both Firefox 9.0.1 and IE 8 on Windows 7 work PC behind a firewall. Cookies are enabled. Cache cleared. I'm seeing the same loop as Wikus describes. Initially I thought the demo site was down till I saw this thread... Going directly to "http://web2py.com/demo_admin/default/site"; doesn't help. My own web2py site on a separate server works fine (if that means anything). Regards, Roderick On Feb 3, 3:52 pm, Wikus van de Merwe wrote: > The problem seems to be a redirection loop between this two addresses: > 1)http://web2py.com/demo_admin/default/site > 2)http://web2py.com/demo_admin/default/index?send=%2Fdemo_admin%2Fdefau... > > Both return 303 and redirect 1 -> 2, and 2 -> 1 until the browser gives up > with a message: > "Firefox has detected that the server is redirecting the request for this > address in a way that will never complete". > See attached headers log for details. > > log.txt > 6KViewDownload
[web2py] SQLFORM.smartgrid links to reference field
Good day Using the classic web2py db example - dogs and owners and implementing a many-to-many relationship using a table we'll call dog_owners, I'd like to know how to always link to a specific dog / owner when viewing the dog_owners table using smartgrid? E.g. viewing the dog_owners table - dog: coco, owner: roderick. I'd like to click on "coco" ("roderick") and get his entry from the dogs(owners) table. (Similar to what happens if I first go to the dogs table, and in coco's row I click the dog_owners button which shows me all owners of coco and gives a link back to "coco" if you know what I mean) Any suggestions on how I can do this? Thanks!
[web2py] creating a rest api for file uploading and processing
Hi I need to setup a prototype for a web application which will expose a REST api to manage zipped sqlite db files, representing a mobile application project storage. I'm considering web2py because it seems agile and very well suited, but I would like to know if its "batteries included" can fullfil my needs easily. For the moment the workflow should be: 1 - post to an http service of a zipped sqlite.db and a NAME field (a textual identifier of the file) 2 - the file should be saved in a tmp folder, then unzipped 3 - the NAME field and the name of the uncompressed folder should be saved in a model, containing only these two fields 4 - the user can browse a page listing the uploaded sqlite files, and clicking on them a page will be opened which will show the extracted data etc. I've seen a lot of facilites that SQLFORM that can help a lot with uploaded files, but in my case I don't have an html form but a REST api, and the uploaded file should be unzipped (a step more then simply saving it and inserting the filename in the model). Can I rely on some web2py "magics", or should I implement everything by myself? Thanks a lot, and congratulations for this framework. Giovanni
[web2py] Re: new web2py application
This made the news it italy: http://www.repubblica.it/tecnologia/2012/02/05/news/hacker_anti_corruzione-29393382/ Repubblica is the main national newspaper. Congratulations to the authors! Massimo On Feb 6, 11:34 pm, guruyaya wrote: > This is beutiful. Just beutiful > > On Feb 6, 8:54 pm, leone wrote: > > > > > > > > > Fine!http://www.globaleaks.org/
[web2py] Re: Workflow engine for web2py
I need this too. On Feb 7, 2:56 am, Ashraf Mansour wrote: > I am having the same interest... > > On Jan 19, 3:02 am, António Ramos wrote: > > > > > > > > > is it dificult to do something like this in web2py? > > >http://blog.aizatto.com/2009/12/07/ruby-on-rails-finite-state-machine...
[web2py] Re: Deploying web2py on webfaction and using tunneling
Let me understand you setup. Do you use a wf proxy and run web2py locally? Can you access admin both from http and https? If you access your app remotely, can you print {{=request.client}}, do you get localhost or 127.0.0.1? The problem with proxies is that web2py cannot reliably determine whether the request is local or remote and whether https was used or not. Therefore settings are either too strict (no admin, the default, use ssh tunnel) or too lose (it is not too bad but if you accidentally go over http, a potential attacker can steal you session cookies). Massimo On Feb 7, 5:51 am, Lucidguppy wrote: > I've gotten web2py working on my webfaction account with admin using > an https site pointing to the webapp and changing the > parameters_xxx.py file to the port that the web app should be using. > So now I have a regular site and a https site pointing to the port > that the app uses. I don't think wf allows you to access your app via > different ports - only the provided one - wf sees your standard > request and routes it to the correct and only port. > > Massimo gave me the impression that this was insecure via this reddit > comment. > > ***QUOTE*** > One is the parameters_*.py file. This file is required to enable admin > and normally it is created automatically when running the built-in web > server. In a production environment it is not created because you > should not run admin off port 80. Admin would not work anyway because > requires https unless in use a proxy, in which case if you enable > admin by manually creating this file, you open your system to > vulnerability (like using telnet instead of ssh). The proper way to > handle this is: > sudo -u www-data python -c "from gluon.main import save_password; > save_password(raw_input('admin password: '),443)" > and use admin only over https (port 443). Feel free to join us on the > web2py mailing list. > ***/QUOTE*** > > I can get a web2py install running by using ssh to get to my account, > download web2py, unzip it and then run it once setting the admin > password. I then kill the process and then use a script to launch > anyserver.py using a cherrypy server. > > My ultimate question is - if https is less secure to my wf app - how > do I use ssh to get to the apps admin? > The slice at "http://www.web2pyslices.com/slices/take_slice/71"; has > been tried and it didn't work or I didn't do it correctly. How do I > use ssh to access the web2py admin on webfaction? > > There is > this:http://docs.webfaction.com/user-guide/databases.html#starting-an-ssh-... > But it pertains to accessing databases.
[web2py] Re: web2py performance
Are you using trunk or stable. I believe there was an optimization in trunk in this respect but it was not benchmarks. I would like to know if it makes things better or worse in your case. On Feb 7, 7:54 am, Vinicius Assef wrote: > Yes, David. That's a point. > > But, I'd like to say if somebody needs to retrieve 100k lines through > a single query in an online application, something sounds bad. > > I'm used to work on tables with millions rows. If you don't elaborate > a good queries and indexes to minimize traffic between db server and > its client, things go down quickly. > > So, I don't think this kink of benchmark has some value to real applications. > > -- > Vinicius Assef. > > > > > > > > On Tue, Feb 7, 2012 at 7:56 AM, David Marko wrote: > > Yes its known behaviour because using standard DAL query the system has to > > convert every line into Python object, which is really time consuming for > > 100K documents.
Re: [web2py] Re: Workflow engine for web2py
Interrested too! Richard On Tue, Feb 7, 2012 at 9:38 AM, Massimo Di Pierro < massimo.dipie...@gmail.com> wrote: > I need this too. > > On Feb 7, 2:56 am, Ashraf Mansour wrote: > > I am having the same interest... > > > > On Jan 19, 3:02 am, António Ramos wrote: > > > > > > > > > > > > > > > > > is it dificult to do something like this in web2py? > > > > >http://blog.aizatto.com/2009/12/07/ruby-on-rails-finite-state-machine. > .. >
Re: [web2py] Workflow engine for web2py
+1 I would like to have it, lets start coding? http://zerp.ly/rochacbruno Em 18/01/2012 22:02, "António Ramos" escreveu: > is it dificult to do something like this in web2py? > > > http://blog.aizatto.com/2009/12/07/ruby-on-rails-finite-state-machine-plugin-workflow/ >
[web2py] Re: using radio widget can't receive the empty submit
It will work if you have values inside the IS_IN_SET validators in your controller, e.g. IS_IN_SET([1,2,3,4],multiple='multiple')
[web2py] How to disable debugging
Hello, I have attached the screenshot of the page rendered, and there is some debugging information. How can I disable it? regards Praveen <>
Re: [web2py] How to disable debugging
You are using generic views. Better to create your own views. But, if you want to disabled that, you need to edit the views/generic.html and remove the {{=response.toolbar()}} On Tue, Feb 7, 2012 at 1:05 PM, Praveen Bhat wrote: > Hello, > > I have attached the screenshot of the page rendered, and there is some > debugging information. > > How can I disable it? > > regards > Praveen > -- Bruno Rocha [http://rochacbruno.com.br]
Re: [web2py] How to disable debugging
Removing {{=response.toolbar()}} just prevents it from showing, or does it actually disable it from being called in the background and assigned to the response object? On Tue, Feb 7, 2012 at 7:25 AM, Bruno Rocha wrote: > You are using generic views. > > Better to create your own views. > > But, if you want to disabled that, you need to edit the views/generic.html > and remove the {{=response.toolbar()}} > > > On Tue, Feb 7, 2012 at 1:05 PM, Praveen Bhat wrote: > >> Hello, >> >> I have attached the screenshot of the page rendered, and there is some >> debugging information. >> >> How can I disable it? >> >> regards >> Praveen >> > > > > -- > > Bruno Rocha > [http://rochacbruno.com.br] > > -- -- Regards, Bruce Wade http://ca.linkedin.com/in/brucelwade http://www.wadecybertech.com http://www.warplydesigned.com http://www.fitnessfriendsfinder.com
[web2py] Re: Adding application specific data to httpserver.log ?
Thank you, Would there be any harm in adding environ['QUERY_STRING'] httpserver.log as a change in your main.py source code ? This would solve my issue and perhaps help others by giving a little more detail in the logs which for REST type applications will be very useful. One line added and two lines slightly altered around line 700 of main.py in gluon: line = '%s, %s, %s, %s, %s, %s, %f, %s\n' % ( #JC: added extra ', %s' before the \n environ['REMOTE_ADDR'], datetime.datetime.today().strftime('%Y-%m-%d %H:%M:%S'), environ['REQUEST_METHOD'], environ['PATH_INFO'].replace(',', '%2C'), environ['SERVER_PROTOCOL'], (status_headers[0])[:3], time.time() - time_in, # JC: add a comma at the end of this line environ['QUERY_STRING'] # JC: new line to show query parameters Thanks, John Cobo
[web2py] Postgres: what am i doing wrong ?
Hi all, I'm starting a new project in which I'm using Postgresql, but I have some problems. I have defined a couple of tables in models/db.py. I can see and manipulate those tables through web2py's admin interface, but when I try to use DAL I'm facing some problems. I can connect without problem, but afterwards I can't see nor access any tables. Here's a copy of a python interactive session: (courier)[julie@landing courier]$ python web2py/web2py.py -S courier web2py Web Framework Created by Massimo Di Pierro, Copyright 2007-2011 Version 1.99.3 (2011-12-09 16:18:03) stable Database drivers available: SQLite3, pymysql, PostgreSQL WARNING:web2py:import IPython error; use default python shell Python 2.7.2 (default, Jan 31 2012, 13:19:49) [GCC 4.6.2 20120120 (prerelease)] on linux2 Type "help", "copyright", "credits" or "license" for more information. (InteractiveConsole) >>> db = DAL('postgres://postgres:@localhost/courier') >>> print db.tables [] >>> As you can see, I apparently have no tables in my database but I can definitely see them in web2py's admin interface! Am I doing something wrong ? Spec: Web2py: 1.99.3 Postgres: 9.1.2 Psycopg2: 2.4.4
Re: [web2py] Postgres: what am i doing wrong ?
python web2py/web2py.py -S courier add -M python web2py/web2py.py -S courier -M mic 2012/2/7 Calycé : > Hi all, > > I'm starting a new project in which I'm using Postgresql, but I have > some problems. > I have defined a couple of tables in models/db.py. I can see and > manipulate those tables through web2py's admin interface, but when I > try to use DAL I'm facing some problems. I can connect without > problem, but afterwards I can't see nor access any tables. > > Here's a copy of a python interactive session: > (courier)[julie@landing courier]$ python web2py/web2py.py -S courier > web2py Web Framework > Created by Massimo Di Pierro, Copyright 2007-2011 > Version 1.99.3 (2011-12-09 16:18:03) stable > Database drivers available: SQLite3, pymysql, PostgreSQL > WARNING:web2py:import IPython error; use default python shell > Python 2.7.2 (default, Jan 31 2012, 13:19:49) > [GCC 4.6.2 20120120 (prerelease)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > (InteractiveConsole) db = DAL('postgres://postgres:@localhost/courier') print db.tables > [] > > As you can see, I apparently have no tables in my database but I can > definitely see them in web2py's admin interface! > Am I doing something wrong ? > > Spec: > Web2py: 1.99.3 > Postgres: 9.1.2 > Psycopg2: 2.4.4
[web2py] Re: Postgres: what am i doing wrong ?
Just tried it -> same results. FYI, I'm only using the interactive python shell to illustrate the problem I face I my app... On Feb 7, 4:56 pm, Michele Comitini wrote: > python web2py/web2py.py -S courier > > add -M > > python web2py/web2py.py -S courier -M > > mic > > 2012/2/7 Calycé : > > > > > > > > > Hi all, > > > I'm starting a new project in which I'm using Postgresql, but I have > > some problems. > > I have defined a couple of tables in models/db.py. I can see and > > manipulate those tables through web2py's admin interface, but when I > > try to use DAL I'm facing some problems. I can connect without > > problem, but afterwards I can't see nor access any tables. > > > Here's a copy of a python interactive session: > > (courier)[julie@landing courier]$ python web2py/web2py.py -S courier > > web2py Web Framework > > Created by Massimo Di Pierro, Copyright 2007-2011 > > Version 1.99.3 (2011-12-09 16:18:03) stable > > Database drivers available: SQLite3, pymysql, PostgreSQL > > WARNING:web2py:import IPython error; use default python shell > > Python 2.7.2 (default, Jan 31 2012, 13:19:49) > > [GCC 4.6.2 20120120 (prerelease)] on linux2 > > Type "help", "copyright", "credits" or "license" for more information. > > (InteractiveConsole) > db = DAL('postgres://postgres:@localhost/courier') > print db.tables > > [] > > > As you can see, I apparently have no tables in my database but I can > > definitely see them in web2py's admin interface! > > Am I doing something wrong ? > > > Spec: > > Web2py: 1.99.3 > > Postgres: 9.1.2 > > Psycopg2: 2.4.4
[web2py] web2py RBAC and "virtual table"
Hello, I would like to know if there is a way in web2py to have "virtual table" (mean subset of columns from a existing table) access controlled with the web2py built-in RBAC ?? I mean I have to denormalize to improve speed of an app that use to have many table that are all using the same pattern. It makes sens to denormalize since all data contains in these similar tables are requested all the time with joins. Also, it would make it much easier to refactor since I will not have to make the same change over 30 similar tables each time I have general modifications (I know about web2py inheritrance, but I use to sync web2py model and db model by hand, so I have to generate sql DDL)... May be I can just define a subset of model on the fly in controller ?? Is there anybody else having the same needs? If so, is there any plan about virtual table in web2py? Thanks Richard
Re: [web2py] Re: Postgres: what am i doing wrong ?
What do you expect to see in db.tables? Tables defined in model(s) or tables on database? On Tue, Feb 7, 2012 at 5:03 PM, Calycé wrote: > Just tried it -> same results. > FYI, I'm only using the interactive python shell to illustrate the > problem I face I my app... > > On Feb 7, 4:56 pm, Michele Comitini > wrote: > > python web2py/web2py.py -S courier > > > > add -M > > > > python web2py/web2py.py -S courier -M > > > > mic > > > > 2012/2/7 Calycé : > > > > > > > > > > > > > > > > > Hi all, > > > > > I'm starting a new project in which I'm using Postgresql, but I have > > > some problems. > > > I have defined a couple of tables in models/db.py. I can see and > > > manipulate those tables through web2py's admin interface, but when I > > > try to use DAL I'm facing some problems. I can connect without > > > problem, but afterwards I can't see nor access any tables. > > > > > Here's a copy of a python interactive session: > > > (courier)[julie@landing courier]$ python web2py/web2py.py -S courier > > > web2py Web Framework > > > Created by Massimo Di Pierro, Copyright 2007-2011 > > > Version 1.99.3 (2011-12-09 16:18:03) stable > > > Database drivers available: SQLite3, pymysql, PostgreSQL > > > WARNING:web2py:import IPython error; use default python shell > > > Python 2.7.2 (default, Jan 31 2012, 13:19:49) > > > [GCC 4.6.2 20120120 (prerelease)] on linux2 > > > Type "help", "copyright", "credits" or "license" for more information. > > > (InteractiveConsole) > > db = DAL('postgres://postgres:@localhost/courier') > > print db.tables > > > [] > > > > > As you can see, I apparently have no tables in my database but I can > > > definitely see them in web2py's admin interface! > > > Am I doing something wrong ? > > > > > Spec: > > > Web2py: 1.99.3 > > > Postgres: 9.1.2 > > > Psycopg2: 2.4.4 > -- Massimiliano
[web2py] Re: Possible bug when using upload with GAE
check the GAE data console (locally for me that is at 127.0.0.1:8080/_ah/admin/datastore) and see what the datatype of of the image is and how much data is stored. i thought that a blob type could be up to 1MB. for what it's worth, i use blobstore to store my images (does not have the 1mb limit) cfh
Re: [web2py] Re: Postgres: what am i doing wrong ?
May be web2py need a password to be define to acces model in shell?? So use -a parameter to set a pwd here my start command, notice I am not sure but have auto after the -M that maybe required?? : python web2py.py -a '12345' -i 127.0.0.1 -p 8001 -S apllication_name -M auto' Richard On Tue, Feb 7, 2012 at 11:12 AM, Massimiliano wrote: > What do you expect to see in db.tables? > > Tables defined in model(s) or tables on database? > > > > On Tue, Feb 7, 2012 at 5:03 PM, Calycé wrote: > >> Just tried it -> same results. >> FYI, I'm only using the interactive python shell to illustrate the >> problem I face I my app... >> >> On Feb 7, 4:56 pm, Michele Comitini >> wrote: >> > python web2py/web2py.py -S courier >> > >> > add -M >> > >> > python web2py/web2py.py -S courier -M >> > >> > mic >> > >> > 2012/2/7 Calycé : >> > >> > >> > >> > >> > >> > >> > >> > > Hi all, >> > >> > > I'm starting a new project in which I'm using Postgresql, but I have >> > > some problems. >> > > I have defined a couple of tables in models/db.py. I can see and >> > > manipulate those tables through web2py's admin interface, but when I >> > > try to use DAL I'm facing some problems. I can connect without >> > > problem, but afterwards I can't see nor access any tables. >> > >> > > Here's a copy of a python interactive session: >> > > (courier)[julie@landing courier]$ python web2py/web2py.py -S courier >> > > web2py Web Framework >> > > Created by Massimo Di Pierro, Copyright 2007-2011 >> > > Version 1.99.3 (2011-12-09 16:18:03) stable >> > > Database drivers available: SQLite3, pymysql, PostgreSQL >> > > WARNING:web2py:import IPython error; use default python shell >> > > Python 2.7.2 (default, Jan 31 2012, 13:19:49) >> > > [GCC 4.6.2 20120120 (prerelease)] on linux2 >> > > Type "help", "copyright", "credits" or "license" for more information. >> > > (InteractiveConsole) >> > db = DAL('postgres://postgres:@localhost/courier') >> > print db.tables >> > > [] >> > >> > > As you can see, I apparently have no tables in my database but I can >> > > definitely see them in web2py's admin interface! >> > > Am I doing something wrong ? >> > >> > > Spec: >> > > Web2py: 1.99.3 >> > > Postgres: 9.1.2 >> > > Psycopg2: 2.4.4 >> > > > > -- > Massimiliano >
Re: [web2py] Re: VPScolo.com Five dolar VPS, anybody knows it?
Excellent piece of information Ross! Thank you very much! On Tue, Feb 7, 2012 at 11:11 AM, Ross Peoples wrote: > I haven't heard of them before, but I have learned a quick lesson about > VPS providers: most of them are one-man operations that only last for a few > months. I have done a LOT of research on VPS providers over the last couple > of weeks and the one site I always end up turning to for advice on > providers is Low End Box: http://www.lowendbox.com/ > > I did a search for VPScolo on LEB and found an ad from 2010. So the fact > that they've been around for at least 2 years is a good sign. You don't get > a whole lot of resource though. So far, I have only found two VPS providers > that give you the most resources for your money. If you need bandwidth, go > for RethinkVPS. They offer unlimited transfer. If you need more memory, > look at ChicagoVPS. I got in on a good deal with them: 2GB of RAM, 2TB of > transfer for $7/month. > > As for the burst, you have 256 MB of RAM. The burst is like swap space. It > is there for temporary usage only. Many providers provide you with burst > memory in case your site is listed on Reddit or Slashdot and experiences a > sudden spike in traffic. If you are eating into burst memory often, your > provider will make you upgrade to a better plan, or ask you to leave. So > make sure that 256 MB is more than sufficient for your needs. > > As a quick note, I am not associated with VPS providers. I was looking for > one recently, so I started doing my homework for a provider that met my > needs. I should also mention that these are cheap plans, and are a step up > from shared hosting, but they are not going to be as high quality as a > provider such as VPS.net or Rackspace, etc. So there will be some downtime > every now and then. > -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___
[web2py] Movuca - Social CMS beta 0.1
Hi, By the end of the week I will release Movuca Social CMS Beta 0.1 (for release I just need to finish installation page, admin dashboard and web2py scheduler notification worker) But, I want to hear your feedback about it! *Main Changes:* - Now it defaults to bootstrap theme (but basic the is available) - License changed to AGPL3 (Gnu Afferro GPL) *Features working* - Home page with components and timeline - Featured Articles and members (most likes and users with more participation) - Multi content type (you can create your own content types and customize new/edit/show views) - Social actions (like, dislike, favorite) - Social icons (share on facebook, google+, tweet etc) - Comment system (internal, disqus, intense debate, facebook) - Code highlighting using google prettify - HTML Editor using plugin_ckeditor from Ross Peoples (thanks) - New tags widget (include it in web2py?) - Person profiles, boards and timelines - Contacts manager - Notifications (with configuration options per user) - Email notifications (with html email templates stored in database) - Search for articles and members - privacy options - Background process notification worker (to send notification emails as a separate process) *Todo* https://github.com/rochacbruno/Movuca/blob/master/TODO *Screenshots* http://min.us/mbcVYzyXsh#1 *Live demo:* http://movu.ca/demo *Code and issues:* https://github.com/rochacbruno/Movuca *Feedback:* http://movuca.userecho.com/ *Buy me a coffee:* rochacbr...@gmail.com on PayPal *Commercial support:* http://blouweb.com *It is Open Source, pull requests are very welcome!* *FYI.* web2pyslices will be updated to use Movuca as its base (this week) blouweb.com will offer "create your own social network" as a service for companies, groups, clubs and social intranets, also we are going to offer commercial support and commercial plugins when the app outs of beta. -- Bruno Rocha [http://rochacbruno.com.br]
Re: [web2py] Workflow engine for web2py
This library is small and easy to use: http://www.hforge.org/itools/docs/workflow/
Re: [web2py] How to disable debugging
Hello Bruce, Thanks for your quick reply. But I do not find any generic.html view file as I am using the Windows Webpy. Regards, Praveen On Tue, Feb 7, 2012 at 9:01 PM, Bruce Wade wrote: > Removing {{=response.toolbar()}} just prevents it from showing, or does it > actually disable it from being called in the background and assigned to the > response object? > > > On Tue, Feb 7, 2012 at 7:25 AM, Bruno Rocha wrote: > >> You are using generic views. >> >> Better to create your own views. >> >> But, if you want to disabled that, you need to edit the >> views/generic.html and remove the {{=response.toolbar()}} >> >> >> On Tue, Feb 7, 2012 at 1:05 PM, Praveen Bhat wrote: >> >>> Hello, >>> >>> I have attached the screenshot of the page rendered, and there is some >>> debugging information. >>> >>> How can I disable it? >>> >>> regards >>> Praveen >>> >> >> >> >> -- >> >> Bruno Rocha >> [http://rochacbruno.com.br] >> >> > > > -- > -- > Regards, > Bruce Wade > http://ca.linkedin.com/in/brucelwade > http://www.wadecybertech.com > http://www.warplydesigned.com > http://www.fitnessfriendsfinder.com >
Re: [web2py] Workflow engine for web2py
I know it in french, I didn't find it in english : http://fr.wikipedia.org/wiki/Liste_des_moteurs_de_workflow And what about XPDL? http://en.wikipedia.org/wiki/XPDL Richard On Tue, Feb 7, 2012 at 11:27 AM, omicron wrote: > This library is small and easy to use: > http://www.hforge.org/itools/docs/workflow/
[web2py] Re: Movuca - Social CMS beta 0.1
> > - License changed to AGPL3 (Gnu Afferro GPL) If I understand AGPL3 correctly, if someone deploys Movuca on a server, they will be required to allow all users of their website to download the entire source code of the site, including any customizations they make to the Movuca code in order to accommodate their app. I assume that will greatly limit its adoption. Anthony
[web2py] 1 Week Left! Web2py Application Exhibition
There is only ONE week left for submissions. If you plan to submit an application for the Web2py Application Exhibition, please send me an e-mail indicating your interest so I can have an idea of how many submissions to expect. Thanks! Mr.NetAdmn
[web2py] Re: [w2py-dev] Re: Movuca - Social CMS beta 0.1
On Tue, Feb 7, 2012 at 2:56 PM, Anthony wrote: > - License changed to AGPL3 (Gnu Afferro GPL) > > > If I understand AGPL3 correctly, if someone deploys Movuca on a server, > they will be required to allow all users of their website to download the > entire source code of the site, including any customizations they make to > the Movuca code in order to accommodate their app. I assume that will > greatly limit its adoption. > Yes, I wanted a way to keep it OPen Source and allow commercial use at the same time. I want every one to be able to use it, customize it and deploys, sell support, sell as a service. But I want to keep it Open Source (I mean, I dont want someone to take the code and release a tool called "blablabla" which is not open source) But, I think we can have closed plugins, acting in the same way as web2py plugins. Someone can develop a plugin and release the plugin with any license (not?) So if someone change the core, it will be needed to released the changes as open source. -- Bruno Rocha [http://rochacbruno.com.br]
Re: [web2py] How to disable debugging
On Tuesday, February 7, 2012 11:32:21 AM UTC-5, Praveen Bhat wrote: > > Hello Bruce, > > Thanks for your quick reply. > > But I do not find any generic.html view file as I am using the Windows > Webpy. > generic.html should be in /web2py/application/your_app/views (even in the Windows distribution). Note, it includes the following code: {{if request.is_local:}} {{=response.toolbar()}} {{pass}} So, the toolbar will appear only for local requests (i.e., on your development machine), not once the app is deployed to production. In any case, as Bruno mentioned, you should ultimately create your own action-specific views rather than rely on the generic views (particularly for HTML views). Anthony
Re: [web2py] How to disable debugging
On Tuesday, February 7, 2012 10:31:39 AM UTC-5, Detectedstealth wrote: > > Removing {{=response.toolbar()}} just prevents it from showing, or does it > actually disable it from being called in the background and assigned to the > response object? > .toolbar() is a method that is called to generate the toolbar -- if you remove {{=response.toolbar()}}, the method never gets called and no toolbar is generated. Nothing gets assigned to the response object at all, even when the method is called -- the method simply returns the HTML helpers to generate the toolbar, which gets serialized to HTML in the view. Anthony
Re: [web2py] Re: web2py performance
Massimo, if this question was to me, I don't face this situation with web2py yet. This is my experience, no matter what tools I use. -- Vinicius Assef On Tue, Feb 7, 2012 at 12:51 PM, Massimo Di Pierro wrote: > Are you using trunk or stable. I believe there was an optimization in > trunk in this respect but it was not benchmarks. I would like to know > if it makes things better or worse in your case. > > On Feb 7, 7:54 am, Vinicius Assef wrote: >> Yes, David. That's a point. >> >> But, I'd like to say if somebody needs to retrieve 100k lines through >> a single query in an online application, something sounds bad. >> >> I'm used to work on tables with millions rows. If you don't elaborate >> a good queries and indexes to minimize traffic between db server and >> its client, things go down quickly. >> >> So, I don't think this kink of benchmark has some value to real applications. >> >> -- >> Vinicius Assef. >> >> >> >> >> >> >> >> On Tue, Feb 7, 2012 at 7:56 AM, David Marko wrote: >> > Yes its known behaviour because using standard DAL query the system has to >> > convert every line into Python object, which is really time consuming for >> > 100K documents.
Re: [web2py] Re: [w2py-dev] Re: Movuca - Social CMS beta 0.1
I agree with Anthony, I think this type of license will limit the adoption greatly. Honestly I probably wont even look at the code now, not because I wasn't interested. Instead because 99% of my clients require to keep the code that makes their system unique and profitable. -- Regards, Bruce On Tue, Feb 7, 2012 at 9:06 AM, Bruno Rocha wrote: > > > On Tue, Feb 7, 2012 at 2:56 PM, Anthony wrote: > >> - License changed to AGPL3 (Gnu Afferro GPL) >> >> >> If I understand AGPL3 correctly, if someone deploys Movuca on a server, >> they will be required to allow all users of their website to download the >> entire source code of the site, including any customizations they make to >> the Movuca code in order to accommodate their app. I assume that will >> greatly limit its adoption. >> > > Yes, I wanted a way to keep it OPen Source and allow commercial use at > the same time. > > I want every one to be able to use it, customize it and deploys, sell > support, sell as a service. But I want to keep it Open Source (I mean, I > dont want someone to take the code and release a tool called "blablabla" > which is not open source) > > But, I think we can have closed plugins, acting in the same way as web2py > plugins. Someone can develop a plugin and release the plugin with any > license (not?) > > So if someone change the core, it will be needed to released the changes > as open source. > > -- > > Bruno Rocha > [http://rochacbruno.com.br] > > -- -- Regards, Bruce Wade http://ca.linkedin.com/in/brucelwade http://www.wadecybertech.com http://www.warplydesigned.com http://www.fitnessfriendsfinder.com
Re: [web2py] dataTables with serverside json
Finally got it to work... There was a problem with the init of DTs particularly this option : http://datatables.net/release-datatables/extras/FixedColumns/server-side-processing.html *fnInitComplete* * * * * It's not solving my speed problem as I expect it could do... So I will put it on hold, but I plan to implement a basic server interaction script as the php DTs example to make it easier deploy DTs with server side capability... Richard On Mon, Feb 6, 2012 at 6:10 PM, Bruno Rocha wrote: > Not, > > PowerGrid is based in pure Jquery Templates > > > -- > > Bruno Rocha > [http://rochacbruno.com.br] > >
Re: [web2py] Re: [w2py-dev] Re: Movuca - Social CMS beta 0.1
On Tue, Feb 7, 2012 at 3:15 PM, Bruce Wade wrote: > I agree with Anthony, I think this type of license will limit the adoption > greatly. Honestly I probably wont even look at the code now, not because I > wasn't interested. Instead because 99% of my clients require to keep the > code that makes their system unique and profitable. > I am open to change it, but I dont know nothing about licenses. Which license should I use if I want to allow free and commercial use and at the same time avoid someone form using the code base to release a commercial version os the same kinf of app? I mean, everyone should be able to use it to create a Social Network, intranet or website, everyone should be able to sell apps made with it and give commercial support. But no one can release a "CMS or Social network platform" free or commercial without making the source code available. Is there a license? -- Bruno Rocha [http://rochacbruno.com.br]
[web2py] Re: Postgres: what am i doing wrong ?
> > Just tried it -> same results. > FYI, I'm only using the interactive python shell to illustrate the > problem I face I my app... > When you use the -M option to load your models, are you then still doing this in your shell session: >>> db = DAL('postgres://postgres:@localhost/courier') If so, don't -- the db object will already be defined when your db.py file is executed, and the above will end up overwriting it (and therefore losing all of its table definitions from db.py). Just do: python web2py.py -S courier -M -N >>> db.tables (Note the -N option -- that prevents cron from starting.) If you're using the DAL outside of a web2py app, then you'll still need to create model definitions (i.e., with db.define_table) in your code -- the DAL doesn't know what tables and fields are in your db unless you tell it by defining the models. However, if you have already defined the models in an app somewhere, you might be able to make use of auto_import: http://web2py.com/books/default/chapter/29/6#Using-DAL-without-define-tables. Anthony
Re: [web2py] Re: [w2py-dev] Re: Movuca - Social CMS beta 0.1
The magic keyword is "distribute", both the GPL and LGPL would prevent proprietary closed forks (binary only releases). But, if you want that every site that uses your app would have to publish the source code, AGPL. Best regards Mariano Reingart http://www.sistemasagiles.com.ar http://reingart.blogspot.com On Tue, Feb 7, 2012 at 2:21 PM, Bruno Rocha wrote: > > > On Tue, Feb 7, 2012 at 3:15 PM, Bruce Wade wrote: > >> I agree with Anthony, I think this type of license will limit the >> adoption greatly. Honestly I probably wont even look at the code now, not >> because I wasn't interested. Instead because 99% of my clients require to >> keep the code that makes their system unique and profitable. >> > > I am open to change it, but I dont know nothing about licenses. > > Which license should I use if I want to allow free and commercial use and > at the same time avoid someone form using the code base to release a > commercial version os the same kinf of app? > > I mean, everyone should be able to use it to create a Social Network, > intranet or website, everyone should be able to sell apps made with it and > give commercial support. > > But no one can release a "CMS or Social network platform" free or > commercial without making the source code available. > > Is there a license? > > > -- > > Bruno Rocha > [http://rochacbruno.com.br] > >
[web2py] Re: web2py performance
On Tuesday, February 7, 2012 2:36:14 AM UTC-5, LightOfMooN wrote: > > I'm using loop for 10 inserts just one time to insert 100k records > in database. > All next time I just try to get response. > And now in our project we have much more than 100k records, that can > be filtered and sorted by some dinamic conditions. > In order to convert query results into a DAL Rows object, the DAL has to loop through all the records and convert each one to a Row object (doing some transformations, depending on the field types). This takes a long time for tens of thousands of records. The code could probably be made a bit more efficient, but some initial attempts resulted in only small improvements. I'm not sure it can get dramatically faster. If you really need to work with that many records at a time, you're probably better off using executesql and working with the raw results rather than converting to a DAL Rows object. Anthony
[web2py] a beginner question about queries
Hello. I have this model: db = DAL('sqlite://storage.sqlite') db.define_table('customers', Field('name'), Field('age'), format = '%(name)s' ) db.define_table('purchases', Field('name',db.customers), Field('cart') ) db.purchases.name.requires = IS_IN_DB(db,db.customers,'%(name)s') The table customers has these values in it: (Jack,17) (John,23) The table purchases has these values in it: (Jack, CD) (John, DVD) Now in my controller if I use the following query: query = db(db.purchases.id>0).select return (purchases = query) Now if in my view, I loop through purchases to type their name property, e.g. purchases[0].name, the id of the person from the customers table will be returned. What should I use alternatively to get the actual name of the person, e.g. Jack, or John? I don't want to have another query for that.
Re: [web2py] a beginner question about queries
Why not use represent? http://web2py.com/books/default/chapter/29/6?search=represent#Record-representation Richard On Tue, Feb 7, 2012 at 12:37 PM, shartha wrote: > Hello. > > I have this model: > db = DAL('sqlite://storage.sqlite') > > db.define_table('customers', >Field('name'), >Field('age'), >format = '%(name)s' > ) > > db.define_table('purchases', >Field('name',db.customers), >Field('cart') > ) > > db.purchases.name.requires = IS_IN_DB(db,db.customers,'%(name)s') > > The table customers has these values in it: > (Jack,17) > (John,23) > > The table purchases has these values in it: > (Jack, CD) > (John, DVD) > > Now in my controller if I use the following query: > query = db(db.purchases.id>0).select > return (purchases = query) > > Now if in my view, I loop through purchases to type their name > property, e.g. purchases[0].name, the id of the person from the > customers table will be returned. What should I use alternatively to > get the actual name of the person, e.g. Jack, or John? I don't want to > have another query for that.
Re: [web2py] Re: [w2py-dev] Re: Movuca - Social CMS beta 0.1
LGPL would probably be the best choice, meaning they can use the code for commercial however need to submit/supply source code changes that they make to the CMS directly, but allows them to keep their own unique code built on top of the CMS closed if they want. On Tue, Feb 7, 2012 at 9:29 AM, Mariano Reingart wrote: > The magic keyword is "distribute", both the GPL and LGPL would > prevent proprietary closed forks (binary only releases). > > But, if you want that every site that uses your app would have to publish > the source code, AGPL. > > Best regards > > Mariano Reingart > http://www.sistemasagiles.com.ar > http://reingart.blogspot.com > > > > On Tue, Feb 7, 2012 at 2:21 PM, Bruno Rocha wrote: > >> >> >> On Tue, Feb 7, 2012 at 3:15 PM, Bruce Wade wrote: >> >>> I agree with Anthony, I think this type of license will limit the >>> adoption greatly. Honestly I probably wont even look at the code now, not >>> because I wasn't interested. Instead because 99% of my clients require to >>> keep the code that makes their system unique and profitable. >>> >> >> I am open to change it, but I dont know nothing about licenses. >> >> Which license should I use if I want to allow free and commercial use and >> at the same time avoid someone form using the code base to release a >> commercial version os the same kinf of app? >> >> I mean, everyone should be able to use it to create a Social Network, >> intranet or website, everyone should be able to sell apps made with it and >> give commercial support. >> >> But no one can release a "CMS or Social network platform" free or >> commercial without making the source code available. >> >> Is there a license? >> >> >> -- >> >> Bruno Rocha >> [http://rochacbruno.com.br] >> >> > -- -- Regards, Bruce Wade http://ca.linkedin.com/in/brucelwade http://www.wadecybertech.com http://www.warplydesigned.com http://www.fitnessfriendsfinder.com
Re: [web2py] Re: [w2py-dev] Re: Movuca - Social CMS beta 0.1
OK, I am going to change it to LGPL3 (the same of web2py) -- Bruno Rocha [http://rochacbruno.com.br]
[web2py] Re: [w2py-dev] Re: Movuca - Social CMS beta 0.1
> > - License changed to AGPL3 (Gnu Afferro GPL) >> >> >> If I understand AGPL3 correctly, if someone deploys Movuca on a server, >> they will be required to allow all users of their website to download the >> entire source code of the site, including any customizations they make to >> the Movuca code in order to accommodate their app. I assume that will >> greatly limit its adoption. >> > > Yes, I wanted a way to keep it OPen Source and allow commercial use at > the same time. > > I want every one to be able to use it, customize it and deploys, sell > support, sell as a service. > But as soon as you deploy it, you have to let all of your users download the full site code. If someone hires you to build a site for them using Movuca, you have to tell them that the site they are paying you to build will ultimately be released to the public (in fact, they themselves will be responsible for making the source available for download). I'm not sure many people will want to try to make a commercial enterprise out of that model. > But I want to keep it Open Source (I mean, I dont want someone to take the > code and release a tool called "blablabla" which is not open source) > If that's the goal, then maybe consider GPL, which allows deployment on a server without source code distribution, but does not allow other forms of distribution without source code. Even better, maybe LGPL (like web2py), which lets you use it in conjunction with closed source code (though since Movuca is really an app, it may be difficult to truly separate it from closed source code that is part of the same app). > But, I think we can have closed plugins, acting in the same way as web2py > plugins. Someone can develop a plugin and release the plugin with any > license (not?) > I'm not sure about that: http://www.gnu.org/licenses/gpl-faq.html#MereAggregation http://www.gnu.org/licenses/gpl-faq.html#NFUseGPLPlugins Of course, you should choose whatever license you like -- it's your work. I'm just pointing out that something like AGPL (and even GPL) will probably limit its appeal for users with any kind of commercial intentions. Anthony
Re: [web2py] How to disable debugging
Hello, The "form" and "records" words appear even after taking off {{=response.toolbar()}} line from generic.html.. regards, Pravene
Re: [web2py] How to disable debugging
On Tuesday, February 7, 2012 11:54:59 AM UTC-5, Praveen Bhat wrote: > > Hello, > > The "form" and "records" words appear even after taking off > {{=response.toolbar()}} line from generic.html.. > Your controller is returning a dict containing "form" and "records" keys -- the following generic.html code automatically displays whatever is returned by the controller (which is stored in response._vars): {{=' '.join(x.capitalize() for x in request.function.split('_'))}} {{if len(response._vars)==1:}} {{=response._vars.values()[0]}} {{elif len(response._vars)>1:}} {{=BEAUTIFY(response._vars)}} {{pass}} Note, the above also automatically generates an H2 heading based on the function name. You can remove all that, but then there's not much point in having a generic.html view at all (what will it display?). Anthony
[web2py] Re: new web2py application
Cool stuff. I like the thought behind it, too. On Feb 7, 9:38 am, Massimo Di Pierro wrote: > This made the news it > italy:http://www.repubblica.it/tecnologia/2012/02/05/news/hacker_anti_corru... > Repubblica is the main national newspaper. > > Congratulations to the authors! > > Massimo > > On Feb 6, 11:34 pm, guruyaya wrote: > > > > > > > > > This is beutiful. Just beutiful > > > On Feb 6, 8:54 pm, leone wrote: > > > > Fine!http://www.globaleaks.org/
[web2py] 1.99.4 Active Directory LDAP Issue
Hi!! I have a lot of apps running with Windows LDAP and web2py (1.8) and everything works just fine. Now I'm trying to build an app from scratch using the same auth method with web2py 1.99.4. But it doesn't work. When I try to log in (after typing pass and username) I get a ticket this is what it says: Traceback (most recent call last): File "C:\web2py\web2py\gluon\restricted.py", line 204, in restricted exec ccode in environment File "C:/web2py/web2py/applications/fivrgen/controllers/default.py", line 61, in File "C:\web2py\web2py\gluon\globals.py", line 172, in self._caller = lambda f: f() File "C:/web2py/web2py/applications/fivrgen/controllers/default.py", line 22, in user return dict(form=auth()) File "C:\web2py\web2py\gluon\tools.py", line 1141, in __call__ return getattr(self,args[0])() File "C:\web2py\web2py\gluon\tools.py", line 1744, in login request.vars[passfield]): File "C:\web2py\web2py\gluon\contrib\login_methods\ldap_auth.py", line 92, in ldap_auth_aux if not isinstance(result, dict): UnboundLocalError: local variable 'result' referenced before assignment And this is how my code looks: from gluon.contrib.login_methods.ldap_auth import ldap_auth auth.settings.login_methods.append(ldap_auth(mode='ad', server='myworkingserver', base_dn='ou=xx,dc=xx,dc=xx,dc=xx,dc=xx')) auth.settings.actions_disabled=['register','change_password','request_reset_password','retrieve_username','profile'] ## create all tables needed by auth if not custom tables auth.define_tables(username = True) Am I doing something wrong??
[web2py] How to make an index table look like SQLFORM.grid?
How can I get the buttons to stick to the right side of my index table? My code looks something like this, after a couple of hours of reverse engineering. query = db.tbl.blah rows = db(query).select(db.tbl.id, db.tbl.f1, db.tbl.f2) thead = THEAD(TR(TH('Col1'), TH('Col2'), TH())) tbody = [] for row in rows: link = A('some action', URL('a_function, args=row.id), _class='button') tbody.append( TR(row.f1, row.f2, TD(link, _class='row_buttons')) ) table = TABLE(thead, tbody) div = DIV(table, _class='web2py_table') return div In the resulting table, the TD with the buttons slides to the right, just after the last data column. What am I missing?
[web2py] Re: Postgres: what am i doing wrong ?
What is the problem in your app? Do you have the same problem if you use SQLite? On Feb 7, 12:26 pm, Anthony wrote: > > Just tried it -> same results. > > FYI, I'm only using the interactive python shell to illustrate the > > problem I face I my app... > > When you use the -M option to load your models, are you then still doing > this in your shell session: > > >>> db = DAL('postgres://postgres:@localhost/courier') > > If so, don't -- the db object will already be defined when your db.py file > is executed, and the above will end up overwriting it (and therefore losing > all of its table definitions from db.py). Just do: > > python web2py.py -S courier -M -N > > >>> db.tables > > (Note the -N option -- that prevents cron from starting.) > > If you're using the DAL outside of a web2py app, then you'll still need to > create model definitions (i.e., with db.define_table) in your code -- the > DAL doesn't know what tables and fields are in your db unless you tell it > by defining the models. However, if you have already defined the models in > an app somewhere, you might be able to make use of > auto_import:http://web2py.com/books/default/chapter/29/6#Using-DAL-without-define > > Anthony
[web2py] default layout.html error (or just me)
Hi group, I am trying to build the simple image blog from the web2py book chapter 3. As far as I can see I have reentered the example code to the letter - but still I get an error (which I think stems from layout.html?) (using latest web2py on mac) Traceback (most recent call last): File "gluon/restricted.py", line 203, in restricted File "gluon/restricted.py", line 189, in compile2 File "/Users/andreas/web2py/web2py.app/Contents/Resources/applications/images/views/default/index.html", line 79 response.write('\n ', escape=False) ^ SyntaxError: invalid syntax TiA. Andreas
[web2py] Set username as default
I want to set username (Not id) to table when the record is created using "import_from_csv_file". The following model cause error because when you open the website auth.user_id is None. Can we set if statement says auth.user_id !=none, dba.auth_user(auth.user_id).username.upper() else "" ? Model --- db.define_table('IQWAGFTY', Field('TYPRCD', length=15), Field('TYUUSR', length=128, default=dba.auth_user(auth.user_id).username.upper()), Field('TYUDAT', 'datetime', default=request.now), primarykey=['TYPRCD']) I added the following after the table definition but strangely, "import_from_csv_file" doesn't pick up the default value if it's defined after define_table. if (auth.user_id != None): db.IQWAGFTY.default=dba.auth_user(auth.user_id).username.upper()
[web2py] Re: default layout.html error (or just me)
Can you paste the code in your controllers/default/index.html? Also, you should be able to scroll down near the bottom of the ticket to see the line of code in the view that triggers the issue.
[web2py] Re: default layout.html error (or just me)
Sorry, I meant views/default/index.html, not controllers/default/index.html.
[web2py] Re: Set username as default
I usually do this: default = auth.user.username.upper() if auth.user else None
Re: [web2py] default layout.html error (or just me)
you are missing {{ or }} somewhere in view On Tue, Feb 7, 2012 at 5:26 PM, Andreas Christoffersen < achristoffer...@gmail.com> wrote: > > Hi group, > > > I am trying to build the simple image blog from the web2py book chapter 3. As > far as I can see I have reentered the example code to the letter - but still > I get an error (which I think stems from layout.html?) (using latest web2py > on mac) > > > > Traceback (most recent call last): > > > > File "gluon/restricted.py", line 203, in restricted > > > > File "gluon/restricted.py", line 189, in compile2 > > > > File > "/Users/andreas/web2py/web2py.app/Contents/Resources/applications/images/views/default/index.html", > line 79 > > > > response.write('\n ', escape=False) > > > >^ > SyntaxError: invalid syntax > > > > TiA. > > > Andreas > > -- Bruno Rocha [http://rochacbruno.com.br]
[web2py] Re: Set username as default
db.IQWAGFTY.TYUUSR.default=dba.auth_user(auth.user_id).username.upper() On Feb 7, 1:31 pm, Omi Chiba wrote: > I want to set username (Not id) to table when the record is created > using "import_from_csv_file". > The following model cause error because when you open the website > auth.user_id is None. > > Can we set if statement says auth.user_id !=none, > dba.auth_user(auth.user_id).username.upper() else "" ? > > Model > --- > db.define_table('IQWAGFTY', > Field('TYPRCD', length=15), > Field('TYUUSR', length=128, > default=dba.auth_user(auth.user_id).username.upper()), > Field('TYUDAT', 'datetime', default=request.now), > primarykey=['TYPRCD']) > > I added the following after the table definition but strangely, > "import_from_csv_file" doesn't pick up the default value if it's > defined after define_table. > > if (auth.user_id != None): > > db.IQWAGFTY.default=dba.auth_user(auth.user_id).username.upper()
[web2py] Re: Set username as default
Thank you both !! It works perfectly. On Feb 7, 1:36 pm, Massimo Di Pierro wrote: > db.IQWAGFTY.TYUUSR.default=dba.auth_user(auth.user_id).username.upper() > > On Feb 7, 1:31 pm, Omi Chiba wrote: > > > > > > > > > I want to set username (Not id) to table when the record is created > > using "import_from_csv_file". > > The following model cause error because when you open the website > > auth.user_id is None. > > > Can we set if statement says auth.user_id !=none, > > dba.auth_user(auth.user_id).username.upper() else "" ? > > > Model > > --- > > db.define_table('IQWAGFTY', > > Field('TYPRCD', length=15), > > Field('TYUUSR', length=128, > > default=dba.auth_user(auth.user_id).username.upper()), > > Field('TYUDAT', 'datetime', default=request.now), > > primarykey=['TYPRCD']) > > > I added the following after the table definition but strangely, > > "import_from_csv_file" doesn't pick up the default value if it's > > defined after define_table. > > > if (auth.user_id != None): > > > db.IQWAGFTY.default=dba.auth_user(auth.user_id).username.upper()
[web2py] Re: Some very basic, but important questions.
Thanks Mariano for answers, On Feb 7, 2:11 pm, Mariano Reingart wrote: > > You can have your shared settings in a common python module, and then > import it in your model: > > from shared_settings import DB_URI > db=DAL(DBURI) This is obvious, what I was looking for was a web2py way of doing this, ie without imports, using autoload or exec. Isn't a constant defined in one of my apps' models available to other apps' models thanks to auto execution of models? > There is not direct support for shared views now, mainly because I think > you may be confused about terminology. > web2py "applications" are the similar to django "projects", so it would be > not required to share views across applications in web2py. > > Anyway, a more flexible view rendering system should be possible > (response.render already receives the template filename, extending this to > include a path should not be a major issue, see compileapp.run_view_in) I'm sure Massimo will take on this one because I've counted many other users requesting or asking for project-wide layouts/views. So for now, I guess it's not ready yet. > > > 3. What is the best way to create something like front controller? It > > should include common functions for all other controllers in all apps. > > According the "wikipedia" definition of front controllers, web2py > models/controllers implement that pattern, as they "provides a centralized > entry point for handling requests" > You can put common application-wide functions in the models, and specific > function in the controllers, including caching, redirecting, security, etc. Umm, no. I am not talking about common app-wide setting, what I meant was project wide common controller functions, like requiring login on all (but some) controllers. It would consolidate all request handling by channeling requests through a single handler which in turn would carry out common behavior, which can be modified at runtime. > > > 4. What are the alternatives to scopes (Rails) or custom model > > managers (Django) and model callbacks/observers (Rails) or signals > > (Django)? > > I do not remember any, but there are some discussions on the developer list > to implement some features like signals for data updates. > Also, there are some workaround depending in your needs. These are very essential, I am sure there must be some undocumented features for this. > > > 5. What is the best place to define view helpers and how to pass them > > to views? > > View helpers aren't mandatory in web2py (as a python template language is > used). > But, if you want to have functions to use in the views, you can put then in > the models or in modules. Well, putting view logic in models is a no-no but helper modules would be of use. Thanks for the tip! > > > And last, is Py3k compatible version under works or planned? > > Yes, there are two py3k "unnoficial" versions under development: > > a proof of concept running under python > 3.2:http://code.google.com/r/reingart-web2py/source/browse/?name=py3k > > a manual attempt to make a python 3 alternative > codebase:https://github.com/cannatag/web2py-python3 Great to hear that, keep it up please. Cheers, Metin.
[web2py] Re: [w2py-dev] Re: Movuca - Social CMS beta 0.1
Bruno's work is given for free, and if you don't share your changes back, keep it secret behind the server, it doesn't help the Movuca project. So for Bruno the GPL or even AGPL is a good option, as it keeps the code free (as in freedom). CMS is very different to a framework like web2py, which is only a base for application development and could be seen as similar to a system library. CMS is an application itself. It's not a component used to build bigger projects. The FSF discourage use of LGPL in such cases, because they goal is to spread and increase adoption of the free software. So they favor a scenario in which your software is released under the GPL, as all work derived from it would have to become free software too (which is not the case for LGPL). Also, I don't see any contradiction between GPL or AGPL and "commercial intentions". Your client is paying for a customised solution and is getting one no matter if the license is LGPL, GPL or AGPL. The only difference here is for Bruno and the community of people working with him on the CMS. They might ask for the source code and benefit from changes made by others. The same way as those others benefited in the first place from Bruno's CMS as they didn't have to write it from scratch. It's a win win situation. Where do you guys see problems with adoption and commercial use? GPL will prevent anyone from making a proprietary system that includes your code (LGPL allows that). However, it would be still possible to do it without code distribution, for example in a software as service model. Only AGPL will prevent that, as it requires to make the source available whenever the code is deployed on a server.
[web2py] Re: 1.99.4 Active Directory LDAP Issue
It's known issue and fixed version is in trunk. http://code.google.com/p/web2py/issues/detail?id=565&can=1&q=ldap On Feb 7, 12:53 pm, Ialejandro wrote: > Hi!! I have a lot of apps running with Windows LDAP and web2py (1.8) > and everything works just fine. Now I'm trying to build an app from > scratch using the same auth method with web2py 1.99.4. But it doesn't > work. When I try to log in (after typing pass and username) I get a > ticket this is what it says: > > Traceback (most recent call last): > File "C:\web2py\web2py\gluon\restricted.py", line 204, in restricted > exec ccode in environment > File "C:/web2py/web2py/applications/fivrgen/controllers/default.py", > line 61, in > File "C:\web2py\web2py\gluon\globals.py", line 172, in > self._caller = lambda f: f() > File "C:/web2py/web2py/applications/fivrgen/controllers/default.py", > line 22, in user > return dict(form=auth()) > File "C:\web2py\web2py\gluon\tools.py", line 1141, in __call__ > return getattr(self,args[0])() > File "C:\web2py\web2py\gluon\tools.py", line 1744, in login > request.vars[passfield]): > File "C:\web2py\web2py\gluon\contrib\login_methods\ldap_auth.py", > line 92, in ldap_auth_aux > if not isinstance(result, dict): > UnboundLocalError: local variable 'result' referenced before > assignment > > And this is how my code looks: > > from gluon.contrib.login_methods.ldap_auth import ldap_auth > auth.settings.login_methods.append(ldap_auth(mode='ad', > server='myworkingserver', > base_dn='ou=xx,dc=xx,dc=xx,dc=xx,dc=xx')) > > auth.settings.actions_disabled=['register','change_password','request_reset > _password','retrieve_username','profile'] > > ## create all tables needed by auth if not custom tables > auth.define_tables(username = True) > > Am I doing something wrong??
Re: [web2py] Re: [w2py-dev] Re: Movuca - Social CMS beta 0.1
That is exactly what I had in mind, now I dont know if I stay with AGPL or change to LGPL.. I chosen AGPL because I saw another related projetct using it ( http://noosfero.org/Site/About) On Tue, Feb 7, 2012 at 5:59 PM, Wikus van de Merwe < dupakrop...@googlemail.com> wrote: > Bruno's work is given for free, and if you don't share your changes back, > keep it secret behind the server, it doesn't help the Movuca project. So > for Bruno the GPL or even AGPL is a good option, as it keeps the code free > (as in freedom). > > CMS is very different to a framework like web2py, which is only a base for > application development and could be seen as similar to a system library. > CMS is an application itself. It's not a component used to build bigger > projects. The FSF discourage use of LGPL in such cases, because they goal > is to spread and increase adoption of the free software. So they favor a > scenario in which your software is released under the GPL, as all work > derived from it would have to become free software too (which is not the > case for LGPL). > > Also, I don't see any contradiction between GPL or AGPL and "commercial > intentions". Your client is paying for a customised solution and is getting > one no matter if the license is LGPL, GPL or AGPL. The only difference here > is for Bruno and the community of people working with him on the CMS. They > might ask for the source code and benefit from changes made by others. The > same way as those others benefited in the first place from Bruno's CMS as > they didn't have to write it from scratch. It's a win win situation. Where > do you guys see problems with adoption and commercial use? > > GPL will prevent anyone from making a proprietary system that includes > your code (LGPL allows that). However, it would be still possible to do it > without code distribution, for example in a software as service model. Only > AGPL will prevent that, as it requires to make the source available > whenever the code is deployed on a server. > > -- Bruno Rocha [http://rochacbruno.com.br]
Re: [web2py] Re: Some very basic, but important questions.
On Tue, Feb 7, 2012 at 4:50 PM, amiroff wrote: > > Thanks Mariano for answers, > > On Feb 7, 2:11 pm, Mariano Reingart wrote: > > > > You can have your shared settings in a common python module, and then > > import it in your model: > > > > from shared_settings import DB_URI > > db=DAL(DBURI) > > This is obvious, what I was looking for was a web2py way of doing > this, ie without imports, using autoload or exec. Isn't a constant > defined in one of my apps' models available to other apps' models > thanks to auto execution of models? No, it isn't. Again, this may be a confusion on terminology. Having available other app constants/models may be a bad idea (consider DBURI, it should be unique per app or your tables will overlap). Remember, apps are "projects" in web2py. "django apps" are more similar to "web2py plugins". web2py let you have several apps in the same site, but they are separate entities. You can see the official book for a more deep explanation: http://www.web2py.com/books/default/chapter/29/12#Component-plugins Sorry if I'm not clear enough, English is not one of my best skills, fell free to provide and example and we can analyse it. > > > There is not direct support for shared views now, mainly because I think > > you may be confused about terminology. > > web2py "applications" are the similar to django "projects", so it would be > > not required to share views across applications in web2py. > > > > Anyway, a more flexible view rendering system should be possible > > (response.render already receives the template filename, extending this to > > include a path should not be a major issue, see compileapp.run_view_in) > > I'm sure Massimo will take on this one because I've counted many other > users requesting or asking for project-wide layouts/views. So for now, > I guess it's not ready yet. > Again, maybe you mean site-wide layouts/views. Project wide layouts are currently available (they are the views in an app). For example, using the layout plugin you can change the layout of the entire app: http://web2py.com/layouts And yes, site-wide layouts would be helpful but they are not available yet, I'll write down this in my TODO list ;-) > > > > > > 3. What is the best way to create something like front controller? It > > > should include common functions for all other controllers in all apps. > > > > According the "wikipedia" definition of front controllers, web2py > > models/controllers implement that pattern, as they "provides a centralized > > entry point for handling requests" > > You can put common application-wide functions in the models, and specific > > function in the controllers, including caching, redirecting, security, etc. > > Umm, no. I am not talking about common app-wide setting, what I meant > was project wide common controller functions, like requiring login on > all (but some) controllers. It would consolidate all request handling > by channeling requests through a single handler which in turn would > carry out common behavior, which can be modified at runtime. > Again, project == app in web2py, so you can implement project wide functions just putting it in a controller or model, see the following example to change CRUD settings based on the function called: http://code.google.com/p/web2conf/source/browse/controllers/activity.py#6 For example, if you want that all the functions in a controller to require a valid login, just write at the beginning of your controller: if not auth.is_logged_in(): raise HTTP(403,"Not authorized") You also can use routes.py to have a single entry point and then dispatch each request as you like. Maybe if you have an example, we could translate it to web2py. > > > > > > 4. What are the alternatives to scopes (Rails) or custom model > > > managers (Django) and model callbacks/observers (Rails) or signals > > > (Django)? > > > > I do not remember any, but there are some discussions on the developer list > > to implement some features like signals for data updates. > > Also, there are some workaround depending in your needs. > > These are very essential, I am sure there must be some undocumented > features for this. There are some hooks like oncreate/onupdate/ondelete for forms, update/compute properties for fields, etc. There may be other methods too, but I'm not aware of them. > > > > > 5. What is the best place to define view helpers and how to pass them > > > to views? > > > > View helpers aren't mandatory in web2py (as a python template language is > > used). > > But, if you want to have functions to use in the views, you can put then in > > the models or in modules. > > Well, putting view logic in models is a no-no but helper modules would > be of use. Thanks for the tip! In the model, you can use represent & widget field properties to do some basic formatting, like the one done in other frameworks class model methods. web2py also comes with handy functions like prettydate in gluon.tools, but you can define your helpers
[web2py] Re: web2py performance
Did you remove the line in layout.html that links to an external FaceBook service? Things like this take time. On Feb 7, 1:24 am, LightOfMooN wrote: > Hi > Just download web2py, run it and go to edit welcome app. > > in db.py: > db.define_table('mytable',Field('myfield','string')) > > in controllers/default.py: > def index(): > if request.vars.add_rows: > for i in xrange(10): > db.mytable.insert(myfield='') > rows = db(db.mytable.id>0).select() > response.flash = "Welcome to web2py!" > return dict() > > in controllers/index.html: > {{extend 'layout.html'}} > > > > > Let's test it. > Click on "add_rows" button to insert 10 rows in database. > Then reload page. > There are just one query, that gets us one set of 100k rows. > Time to process query is less than 100ms, but page loads 5-6s! > Nothing passed to the view. > > So, my question is: > > Is web2py can be used in production for big sites, or just for small- > home-sites? > thx
[web2py] Re: [w2py-dev] Re: Movuca - Social CMS beta 0.1
> > Bruno's work is given for free, and if you don't share your changes back, > keep it secret behind the server, it doesn't help the Movuca project. So > for Bruno the GPL or even AGPL is a good option, as it keeps the code free > (as in freedom). > Under a more permissive license, a smaller percentage of users will contribute changes back to the project, but you will likely get a lot more users overall, so you may still get a lot of contributions. With a strong copyleft license, like AGPL, everyone contributes changes back, but the user base will likely be much smaller. If the goal is getting more contributions back to the project, it's not clear which approach will prevail. > CMS is very different to a framework like web2py, which is only a base for > application development and could be seen as similar to a system library. > CMS is an application itself. In most cases, users would not be deploying Movuca completely unmodified, and even if they did, the whole point of the AGPL/GPL license would be moot, as there would be no modifications to release. The license issues arise exactly in the context of modifying the system. Also, I don't see any contradiction between GPL or AGPL and "commercial > intentions". Your client is paying for a customised solution and is getting > one no matter if the license is LGPL, GPL or AGPL. Under the AGPL, your client is indeed getting a custom solution -- but then your client is required to give away that custom solution to their competitors for free. Not many commercial enterprises will want to pay for the development of a custom solution that they must then give away to the public for free. > The only difference here is for Bruno and the community of people working > with him on the CMS. They might ask for the source code and benefit from > changes made by others. Someone might integrate Movuca with their own custom functionality that is specifically related to their business, which might not necessarily even be of interest to Movuca. Even in that case, though, they would be required to release their proprietary code to the public under AGPL. > GPL will prevent anyone from making a proprietary system that includes > your code (LGPL allows that). However, it would be still possible to do it > without code distribution, for example in a software as service model. Only > AGPL will prevent that, as it requires to make the source available > whenever the code is deployed on a server. > Yes, GPL is probably at least tolerable in many situations, but AGPL is likely a deal breaker for most commercial applications. Anthony
[web2py] CSV Import/Export from different tables
For example, I have two tables, "request" and "result". I want user to download all open request (status="1") from "request" table and upload with the result to "result" table. What's the easy way to do ? db.define_table('request', Field('subject'), Field('status', default="1"), Field('result)) db.define_table('result', Field('subject'), Field('result)) Only thing I can think of is... 1. delete result table 2. Select request table with (status="1") and insert them to the result table But I'm on AS400 located in Japan and this additional insert process takes too much time for me. The best way is download the selected data with the header of result table...
[web2py] deletable = auth.has_permission different for grid and smartgrid?
I have following code in grid and smartgrid: deletable = auth.has_permission('management'), The button Delete shows in grid, but not in smartgrid. Is there a difference between the two, or I should dig deeper in possible permissions messup? Thanks, ADnan
Re: [web2py] CSV Import/Export from different tables
Do you have to let the user do that copy/paste because they add result to kind of empty CSV/Excel spreadsheet to feed your system or you only want to move data around once? In later case you can make a request at DB level or in web2py shell... Richard On Tue, Feb 7, 2012 at 3:48 PM, Omi Chiba wrote: > For example, I have two tables, "request" and "result". I want user to > download all open request (status="1") from "request" table and upload > with the result to "result" table. > > What's the easy way to do ? > > db.define_table('request', >Field('subject'), >Field('status', default="1"), >Field('result)) > > db.define_table('result', >Field('subject'), >Field('result)) > > > Only thing I can think of is... > > 1. delete result table > 2. Select request table with (status="1") and insert them to the > result table > > But I'm on AS400 located in Japan and this additional insert process > takes too much time for me. The best way is download the selected data > with the header of result table... > >
Re: [web2py] deletable = auth.has_permission different for grid and smartgrid?
I don't think there should be difference about that... Smartgrid supposed to be much the same as grid except that it follow link between tables referenced by the shown table... Would show more code to help list member to better help you? Richard On Tue, Feb 7, 2012 at 4:02 PM, Adi wrote: > > I have following code in grid and smartgrid: > > deletable = auth.has_permission('management'), > > The button Delete shows in grid, but not in smartgrid. Is there a > difference between the two, or I should dig deeper in possible permissions > messup? > > Thanks, > ADnan >
[web2py] Re: [w2py-dev] Re: Movuca - Social CMS beta 0.1
I'm not sure how much my opinion matters here, but a lot of times, I am not allowed to touch GPL code, especially AGPL code for a business project. The legal department avoids (A)GPL like the plague. There are just too many gotchas with it, whether real or imaginary. They much prefer I use MIT or BSD, and have started to come around to LGPL. But there is no way they will let me use anything more restrictive. Our legal department can't be the only one in the corporate world that feels the same way. So if you want real businesses to touch code, it has to be LGPL or better (less restrictive). I believe this was one of the reasons web2py is using LGPL now. But this is your project, and a great one at that! So feel free to license it however you like, just be aware of the adoption issues.
[web2py] Re: How to make an index table look like SQLFORM.grid?
solved! TD(blah, _style='text-align:right;') On Feb 7, 2:06 pm, Cliff wrote: > How can I get the buttons to stick to the right side of my index > table? > > My code looks something like this, after a couple of hours of reverse > engineering. > > query = db.tbl.blah > rows = db(query).select(db.tbl.id, db.tbl.f1, db.tbl.f2) > thead = THEAD(TR(TH('Col1'), TH('Col2'), TH())) > tbody = [] > for row in rows: > link = A('some action', URL('a_function, args=row.id), > _class='button') > tbody.append( > TR(row.f1, row.f2, TD(link, _class='row_buttons')) > ) > table = TABLE(thead, tbody) > div = DIV(table, _class='web2py_table') > return div > > In the resulting table, the TD with the buttons slides to the right, > just after the last data column. > > What am I missing?
Re: [web2py] Workflow engine for web2py
How to use this in web2py ? dummies tutorial? 2012/2/7 omicron > This library is small and easy to use: > http://www.hforge.org/itools/docs/workflow/
[web2py] Re: CSV Import/Export from different tables
I think my case is the former. Like Sales support team prepare the reply for the open request at the end of the day and upload. In the evening, I have scheduled job on my AS400 do the upgrade from result to request table with other information. Insert each rows takes long time compared to update or delete. I think it's slow because simply it will generate the number of statement with the same number of rows. (500 rows = 500 insert statements) Can we simply copy the selected rows to another ? I'm not sure. On Feb 7, 3:19 pm, Richard Vézina wrote: > Do you have to let the user do that copy/paste because they add result to > kind of empty CSV/Excel spreadsheet to feed your system or you only want to > move data around once? > > In later case you can make a request at DB level or in web2py shell... > > Richard > > > > > > > > On Tue, Feb 7, 2012 at 3:48 PM, Omi Chiba wrote: > > For example, I have two tables, "request" and "result". I want user to > > download all open request (status="1") from "request" table and upload > > with the result to "result" table. > > > What's the easy way to do ? > > > db.define_table('request', > > Field('subject'), > > Field('status', default="1"), > > Field('result)) > > > db.define_table('result', > > Field('subject'), > > Field('result)) > > > Only thing I can think of is... > > > 1. delete result table > > 2. Select request table with (status="1") and insert them to the > > result table > > > But I'm on AS400 located in Japan and this additional insert process > > takes too much time for me. The best way is download the selected data > > with the header of result table...
Re: [web2py] default layout.html error (or just me)
I was missing a paranthesis... sorry for the confusion - and thanks for the help... Sometimes taking a walk and comming back to the editor is the best way to handle errors. I had: {{=LI(A(image.title, _href=URL("show", args=image.id))}}$ but should have had: {{=LI(A(image.title, _href=URL("show", args=image.id)))}}$ Sorry again. On Tue, Feb 7, 2012 at 8:36 PM, Bruno Rocha wrote: > you are missing {{ or }} somewhere in view > > > On Tue, Feb 7, 2012 at 5:26 PM, Andreas Christoffersen < > achristoffer...@gmail.com> wrote: > >> >> Hi group, >> >> >> I am trying to build the simple image blog from the web2py book chapter 3. >> As far as I can see I have reentered the example code to the letter - but >> still I get an error (which I think stems from layout.html?) (using latest >> web2py on mac) >> >> >> >> Traceback (most recent call last): >> >> >> >> >> >> File "gluon/restricted.py", line 203, in restricted >> >> >> >> >> >> File "gluon/restricted.py", line 189, in compile2 >> >> >> >> >> >> File >> "/Users/andreas/web2py/web2py.app/Contents/Resources/applications/images/views/default/index.html", >> line 79 >> >> >> >> >> >> response.write('\n ', escape=False) >> >> >> >> >> >>^ >> SyntaxError: invalid syntax >> >> >> >> TiA. >> >> >> Andreas >> >> > > > -- > > Bruno Rocha > [http://rochacbruno.com.br] > >
Re: [web2py] Workflow engine for web2py
There is no ubuntu official package as far as I can see, so you will have to follow the installation information explain into the tar ball available here : http://www.hforge.org/itools/ Then : from itools.workflow import Workflow And the rest is explained in the docs : http://www.hforge.org/itools/docs/workflow/ I think you will pretty much have to build your own logic to make use of workflow for given objects (tables and rows)... But there is surely a way that this lib could be included into web2py core so we can make use of workflow utility readily. Richard 2012/2/7 António Ramos > How to use this in web2py ? > dummies tutorial? > > 2012/2/7 omicron > >> This library is small and easy to use: >> http://www.hforge.org/itools/docs/workflow/ > > >
Re: [web2py] Re: keep shared objects permanently in RAM: Is it possible ?
Hi Mariano, what do you mean by permanently importing the data in a module ? As far as I know, every request will reload ALL the models and module again... and again... and again in the mean time I'm reading about mmap as suggested by Michele... even is it looks like (I have not studied it yet) it still uses the FS... What I'm trying to do is to save the LOADING "model + modules" time of every request... (not sure if WSGI has some limitations here...) thanks On Tue, Feb 7, 2012 at 11:03 AM, Mariano Reingart wrote: > You can use a multi-threaded webserver, permanently importing the data in > a module. -- Sebastian E. Ovide
Re: [web2py] Workflow engine for web2py
I don't know workflow engines in the general sense that well. I once created a full documentation management system where each document couple have a workflow assigned to it. The workflow (predefined, or created on-the-fly) would push the document around from person to person, ensuring that each person completed their step in the time allotted, otherwise an email would get sent to their manager. Would a workflow engine allow me to do the same thing, or is this a different type of workflow engine?
Re: [web2py] default layout.html error (or just me)
Glad you figured it out!