Re: [web2py] embedded graphics
Richard, Thanks. I have to figure out what this exact means because I am new to Web2py. Important is the graphics device you use, which one is that Agg, Cairo or something else? Richard Op 23-8-2011 21:53, Richard Vézina schreef: Hello Richard, I think if I had to do what you want to do (I will have to do something similar soon) that I would use compute type field to generate my graph with lambda function base on orther field input data for processing and output from my lambda a graph under PNG image type and store the result in db or server directory upload. I am more inclined into use Matplotlib since it is better fit since it is python lib (but nerver use Matplotlib)... Also, if my processing become to complex for a lambda function, I will use internal function : __functionName(input1, input2, etc.) Function beginning by __ are not expose to final user so they don't need decorator... Hope this help. Richard On Tue, Aug 23, 2011 at 1:57 PM, Richard richard.dijks...@planet.nl mailto:richard.dijks...@planet.nl wrote: Hello, I want to create a scientific website with embedded graphics on Mac OS. Plots are created through Rpy2 and Matplotlib. All the modules run corretly on my Mac but what graphics type will give me the embedded plots and where should I place relevant code within the Web2py framework? Thank you for your reply. Richard Interne Virusdatabase is verouderd. Gecontroleerd door AVG - www.avg.com Versie: 9.0.872 / Virusdatabase: 271.1.1/3830 - datum van uitgifte: 08/12/11 20:34:00
[web2py] Re: migrate=True not creating table ?
Already tried it, did not worked (and just did, still not working). Isn't it for modifying the table only, and not when creating a new one ? I mean, after deleting the table I wanted to change, I thought it's normal for the migrate=False,fake_migrate=True not to work, isn't it ? On Aug 23, 5:22 pm, Richard Vézina ml.richard.vez...@gmail.com wrote: set it : migrate=False,fake_migrate=True http://www.web2py.com/book/default/chapter/06?search=fake#Fixing-Brok... Then it F5 to refresh your page... It should correct your database schema... You can potentially lost data you have entered so, make sure you backup everything if important before doing that. Richard On Tue, Aug 23, 2011 at 11:17 AM, TomPliss tompl...@gmail.com wrote: Hey (noob here again), I needed to change the type of a field in my DB (the Date one of a table was a string, i'm changing its require to IS_DATE). but the values for existing entries were wrong (string has no attribute year), so went on oh, only tests are in this table, let's drop it, and drop it in the sqlite I got, watching the DB. So I get my DB, with a table not here. I restart the web2py server, but the table still isn't here. I save the model.py, restart (with the side sqlite off), still not here. I checked in the book, chapter 06, By default, migrate is set to True. Isn't that what tells web2py to create the table, if it doesn't exist ? What am I missing ?
[web2py] Re: migrate=True not creating table ?
In this situation look in the application/databases directory for a file with the table name as part of the file name. Remove or move the file somewhere else and then restart the web2py server. The table should now reappear and will be empty.
[web2py] Re: migrate=True not creating table ?
Hi Tom, Did you remove the table's .table file from the databases folder? The way I proceed this problem is: In the database's management tool delete/drop the table; Trash the table's .table file in the databases folder; In db.py set migrate to migrate='tablename.table' Save db.py Return to admin/default/design/appname Go to the database administration Return to db.py to set migrate to migrate=False Kind regards, Annet.
[web2py] Re: migrate=True not creating table ?
It's nearly working ! The table was dropped, I renamed the .table file, got migrate='tabename.table', saved model.py and restarted the server. I get this error : class 'sqlite3.OperationalError'(near IGNORE: syntax error) at the last field of the missing table line : Field('FIN_CO1', label='Documentations', writable=False), migrate='ficheIntervention.table') with this Function argument list : (self=gluon.dal.SQLiteAdapter object at 0x019E2EB0, *a=('CREATE TABLE ficheIntervention(\n id INTEGER P...,\n FIN_VIS CHAR(512),\n FIN_CO1 CHAR(512)\n);',), **b={}) It seems web2py is trying to create the table (Yay !), but not succeeding. The only ignore word I have in the database come from the ondelete='ignore' I have on every reference in my table, and it didn't prevent web2py from working before (worked for a week with it, just fine, and with ondelete='ignore' active). Any idea about what is happening ? On Aug 24, 8:49 am, annet annet.verm...@gmail.com wrote: Hi Tom, Did you remove the table's .table file from the databases folder? The way I proceed this problem is: In the database's management tool delete/drop the table; Trash the table's .table file in the databases folder; In db.py set migrate to migrate='tablename.table' Save db.py Return to admin/default/design/appname Go to the database administration Return to db.py to set migrate to migrate=False Kind regards, Annet.
Re: [web2py] Re: uuid - Postgresql-type
On 24 August 2011 02:59, pbreit pbreitenb...@gmail.com wrote: That would probably require a new DAL field type which I'm guessing would require some consideration. What advantages are you looking for? As I understand it the present field is a 64-character field. A native uuid-field would take up 128 bits. On large databases that would make a big difference as far as resources go. Regards Johann -- May grace and peace be yours in abundance through the full knowledge of God and of Jesus our Lord! His divine power has given us everything we need for life and godliness through the full knowledge of the one who called us by his own glory and excellence. 2 Pet. 1:2b,3a
[web2py] Re: URL inside .load component
Thanks very much, that made it. I couldn't find documentation about the extension=False option for the URL function, it would be nice to have it in the book. Greets. On 23 ago, 18:47, Anthony abasta...@gmail.com wrote: On Tuesday, August 23, 2011 12:14:43 PM UTC-4, Álvaro J. Iradier wrote: Hi, I've created a component mycomponent.load to be used with the LOAD() method. But inside the mycomponent.load I want to have a link to another function in the same controller. When I do: {{=URL(r=request, f='otherfunction')}}, the .load extension is automatically added, so I end up being linked to the nonexisting URL http://.../mycontroller/otherfunction.load;. Is this the intended behavior? I can guess there is something about the extension from this fragment of the book: If you LOAD a component having the .load extension and the corresponding controller function redirects to another action (for example a login form), the .load extension propagates and the new url (the one to redirect too) is also loaded with a .load extension. but is there a way to remove the .load extension when using URL inside a component? Your component isn't redirecting, so this is not due to the propogation of the .load extension upon redirect. However, the URL function will automatically use the extension of the current request if the extension isn't specified (unless the extension of the current request is html). Since the request that loads the component has a .load extension, the URL function will automatically add a .load extension as well. To avoid this, just specify an explicit extension (e.g., extension='html'). Note, if you want the link to point to an html page, but you don't want the resulting URL to actually include the .html extension, then you can explicitly set extension=False. In that case, web2py will default to requesting the .html view (as it always does when there is no url extension), but it won't show .html in the URL. See near the end of this section in the book:http://web2py.com/book/default/chapter/04#URL. Anthony
[web2py] Re: migrate=True not creating table ?
Getting the ondelete='ignore' away from the missing table declaration let web2py create it. The problem is I want the ondelete='ignore' to be here, so I'm putting it back. Another problem : The DATE field seems to cause errors, when trying to read it. I'm gettign an error : type 'exceptions.AttributeError'('str' object has no attribute 'year') when trying to show it in a SQLTable, or when filling a SQLForm with an existing record. In the Database, the field has written the date as 2007-06-05. Err ... are DATE working correctly ? Am I missing something (again) ?
[web2py] Re: migrate=True not creating table ?
The only ignore word I have in the database come from the ondelete='ignore' I have on every reference in my table, and it didn't prevent web2py from working before (worked for a week with it, just fine, and with ondelete='ignore' active). Any idea about what is happening ? What happens if you set ondelete=IGNORE to ondelete=NO ACTION.?
[web2py] Re: migrate=True not creating table ?
thanks about the ondelete=NO ACTION, it's working ! actually, even ondelete=ignore works, if it is added after the table is created (even if it is not in the book). I still have the DATE error, unfortunatly, and don't know if it is related to the table creation problem... On Aug 24, 9:51 am, annet annet.verm...@gmail.com wrote: The only ignore word I have in the database come from the ondelete='ignore' I have on every reference in my table, and it didn't prevent web2py from working before (worked for a week with it, just fine, and with ondelete='ignore' active). Any idea about what is happening ? What happens if you set ondelete=IGNORE to ondelete=NO ACTION.?
[web2py] Re: migrate=True not creating table ?
Hum, actually, it's not working as I thought... I thought there was an value for the ondelete option that would force web2py to delete the reference when the referenced object is deleted, but not to delete de referencing object... from what I just read in the book, there isn't :( Anyway, the DATE error ... Where should it come from ?
Re : Re: [web2py] Re: fluxflex
Hello Seems fantastic, yet I cannot access the admin page 1- create a project projecttest 2- Setup = github import 3- Url : https://github.com/nus/web2py-for-fluxflex.git 4- Branche : get_new_stable 5- Run intialize script and import ... import starded project avaliable Web2py welcome page Ok Then I check for my database password here : https://www.fluxflex.com/projects/projecttest/instruction/database (notice phpmyadmin is working) Return in the web2py welcomeapp and try admin page : http://projecttest.fluxflex.com/admin But it says that admin is unvailable because it cannot find the password's file Does I made something wrong ?
[web2py] Re: migrate=True not creating table ?
In your table definition the date field should be defined like this: Field('some_date',type='date') ... and the validator: db.table.some_date.requires=IS_DATE(str(T('%Y-%m-%d'))) Hope this helps you solve the problem.
Re: [web2py] Re: fluxflex
David Marko, It is large file size for fluxflex server. I contacted fluxflex support by email and heard how to set POST size more. There is not answear yet. Please wait a few days. 2011/8/24 David Marko dma...@tiscali.cz: My packed application (web2py.app.twister.w2p) has 1.4MB
Re: Re : Re: [web2py] Re: fluxflex
JmiXIII, You need to access to your admin page HTTPS. https://projecttest.fluxflex.com/admin 2011/8/24 JmiXIII sylvn.p...@gmail.com: Hello Seems fantastic, yet I cannot access the admin page 1- create a project projecttest 2- Setup = github import 3- Url : https://github.com/nus/web2py-for-fluxflex.git 4- Branche : get_new_stable 5- Run intialize script and import ... import starded project avaliable Web2py welcome page Ok Then I check for my database password here :https://www.fluxflex.com/projects/projecttest/instruction/database (notice phpmyadmin is working) Return in the web2py welcomeapp and try admin page : http://projecttest.fluxflex.com/admin But it says that admin is unvailable because it cannot find the password's file Does I made something wrong ?
[web2py] Re: migrate=True not creating table ?
OK ... now, I feel silly ... On Aug 24, 10:30 am, annet annet.verm...@gmail.com wrote: In your table definition the date field should be defined like this: Field('some_date',type='date') ... and the validator: db.table.some_date.requires=IS_DATE(str(T('%Y-%m-%d'))) Hope this helps you solve the problem.
[web2py] DB - removing reference when deleting referenced object...
Hey guys (yeah, i'm still here), I'd like to know what is the best way to remove a DB reference when the referenced object is removed. Is it possible directly in the db.py ? Is it possible to do it without modifying every form.accept including a reference in the form ? PS: talking about removing the reference, not the referencing object ;)
Re: [web2py] Re: table, grid, smartgrid, getting better
With this code: tabel = SQLFORM.grid(db.akb_articles) or tabel = SQLFORM.smartgrid(db.akb_articles) I get the same result except that the reference to line 1631 in sqlhtml.py is not there when I use .grid: Traceback (most recent call last): File /home/js/web2py/gluon/restricted.py, line 194, in restricted exec ccode in environment File /home/js/web2py/applications/akb/controllers/default.py http://localhost:8000/admin/default/edit/akb/controllers/default.py, line 326, in module File /home/js/web2py/gluon/globals.py, line 146, in lambda self._caller = lambda f: f() File /home/js/web2py/applications/akb/controllers/default.py http://localhost:8000/admin/default/edit/akb/controllers/default.py, line 153, in artikels tabel = SQLFORM.smartgrid(db.akb_articles,editable=False) File /home/js/web2py/gluon/sqlhtml.py, line 1631, in smartgrid user_signature=user_signature,**kwargs) File /home/js/web2py/gluon/sqlhtml.py, line 1495, in grid value=field.represent(value,rrow) TypeError: lambda() takes exactly 1 argument (2 given) What am I missing? Regards Johann -- May grace and peace be yours in abundance through the full knowledge of God and of Jesus our Lord! His divine power has given us everything we need for life and godliness through the full knowledge of the one who called us by his own glory and excellence. 2 Pet. 1:2b,3a
[web2py] Re: testing scheduler in windows
Help please! Em 23 de agosto de 2011 10:27, António Ramos ramstei...@gmail.comescreveu: hello i´m testing scheduler from trunk in windows and following Maximo video on Vimeo i have a strange behaviour when i load python web2py.py -K a0 see attached file It keeps repeating the loading messages. When i hit Ctrl C i seems to start the scheduler. Is this normal?
[web2py] Re: Memory problems on Webfaction
Check out this thread https://groups.google.com/group/web2py/browse_thread/thread/24b6d1b3a51eebb6 I followed Vasile's indications and it's working great! On Aug 23, 8:42 pm, Johann Spies johann.sp...@gmail.com wrote: On 23 August 2011 21:36, Gour-Gadadhara Dasa g...@atmarama.net wrote On Tue, 23 Aug 2011 21:21:50 +0200 Johann Spies johann.sp...@gmail.com wrote: I experience memory usage problems on Webfaction from time to time. Even after doubling the initial configuration from 80Mb to 160Mb I get messages like intermittently this from Webfaction: Install your own instance of nginx, Cherokee...and save memory. I cannot move from Webfaction in this case. We have bought a 2 year contract. I have read mentions of nginx on this list but know about nothing about it. Can this be done on Webfaction? How? Regards Johann -- May grace and peace be yours in abundance through the full knowledge of God and of Jesus our Lord! His divine power has given us everything we need for life and godliness through the full knowledge of the one who called us by his own glory and excellence. 2 Pet. 1:2b,3a
Re: [web2py] Re: Memory problems on Webfaction
On 24 August 2011 11:51, robsan rob...@gmail.com wrote: Check out this thread https://groups.google.com/group/web2py/browse_thread/thread/24b6d1b3a51eebb6 I followed Vasile's indications and it's working great! Thanks robsan. Did it make a significant difference to the memory consumption on Webfaction? Regards Johann -- May grace and peace be yours in abundance through the full knowledge of God and of Jesus our Lord! His divine power has given us everything we need for life and godliness through the full knowledge of the one who called us by his own glory and excellence. 2 Pet. 1:2b,3a
[web2py] grdevices Rpy2
Richard, Because Rpy2 can have a png file as outputdevice I'll try within web2py application to embed this into HTML. How to create this output: http://rpy.sourceforge.net/rpy2/doc-dev/html/graphics.html regards, Richard
Re : Re: [web2py] Re: table, grid, smartgrid, getting better
Nice Look, I would appreciate sortable function and why not column specific search as you have in PowerTable but I think it might be a bit heavy for minimalist app.
[web2py] Re: embedded graphics
Richard, Because Rpy2 can have a png file as outputdevice I'll try within web2py application to embed this into HTML. How to create this output: http://rpy.sourceforge.net/rpy2/doc-dev/html/graphics.html regards, Richard PS this posting is ok I hope. On 23 aug, 21:53, Richard Vézina ml.richard.vez...@gmail.com wrote: Hello Richard, I think if I had to do what you want to do (I will have to do something similar soon) that I would use compute type field to generate my graph with lambda function base on orther field input data for processing and output from my lambda a graph under PNG image type and store the result in db or server directory upload. I am more inclined into use Matplotlib since it is better fit since it is python lib (but nerver use Matplotlib)... Also, if my processing become to complex for a lambda function, I will use internal function : __functionName(input1, input2, etc.) Function beginning by __ are not expose to final user so they don't need decorator... Hope this help. Richard On Tue, Aug 23, 2011 at 1:57 PM, Richard richard.dijks...@planet.nl wrote: Hello, I want to create a scientific website with embedded graphics on Mac OS. Plots are created through Rpy2 and Matplotlib. All the modules run corretly on my Mac but what graphics type will give me the embedded plots and where should I place relevant code within the Web2py framework? Thank you for your reply. Richard- Tekst uit oorspronkelijk bericht niet weergeven - - Tekst uit oorspronkelijk bericht weergeven -
[web2py] Greenplum support in web2py
Hello, I'm trying to use greenplum database with web2py. It is modified postgresql to support big data storage, it uses many postgresql's tools. I created test apllication, and tables are created, but if I try to register, I get following error: Traceback (most recent call last): File /home/users/brushek/web2py/gluon/restricted.py, line 192, in restricted exec ccode in environment File /home/users/brushek/web2py/applications/testgp/controllers/ default.py, line 71, in module File /home/users/brushek/web2py/gluon/globals.py, line 145, in lambda self._caller = lambda f: f() File /home/users/brushek/web2py/applications/testgp/controllers/ default.py, line 33, in user return dict(form=auth()) File /home/users/brushek/web2py/gluon/tools.py, line 1080, in __call__ return getattr(self,args[0])() File /home/users/brushek/web2py/gluon/tools.py, line 1778, in register onvalidation=onvalidation,hideerror=self.settings.hideerror): File /home/users/brushek/web2py/gluon/sqlhtml.py, line 1223, in accepts self.vars.id = self.table.insert(**fields) File /home/users/brushek/web2py/gluon/dal.py, line 4786, in insert return self._db._adapter.insert(self,self._listify(fields)) File /home/users/brushek/web2py/gluon/dal.py, line 848, in insert id = self.lastrowid(table) File /home/users/brushek/web2py/gluon/dal.py, line 1768, in lastrowid self.execute(select currval('%s') % table._sequence_name) File /home/users/brushek/web2py/gluon/dal.py, line 1262, in execute return self.log_execute(*a, **b) File /home/users/brushek/web2py/gluon/dal.py, line 1257, in log_execute ret = self.cursor.execute(*a,**b) NotSupportedError: currval() not supported Does anybody tryied to use greenplum with web2py ? Regards brushek
[web2py] Re: Janrain/site login
Thank you, Anthony. I've read the manual and looked for info before asking the question, but I obviously missed that. Thank you for pointing it out. Eric On Aug 22, 9:39 am, Anthony abasta...@gmail.com wrote: See the Multiple Login Forms section at the end of this section:http://web2py.com/book/default/chapter/08#Other-Login-Methods-and-Log There's also this:http://www.web2pyslices.com/slices/take_slice/124. Anthony On Monday, August 22, 2011 8:30:18 AM UTC-4, Eric Scott wrote: Is there anyway to use both Janrain and give users to option to register for a local account using Auth? I've looked and looked and can't find anything. I can get my app to let users register for a local account, but then I can't find anyway to include that option on the login page in addition to the Janrain frame. Also, does Janrain load very slow for others? I've not been impressed by their download speeds. When setting up Janrain, I just put in my Janrain domain name and API key in the appropriate place, and enabled Janrain. Am I missing something. Is there something else I need to do to make it run faster? Like cache the graphics on the user's machine? Thank you, Eric
[web2py] Re: Memory problems on Webfaction
I would say so, with 2 uwsgi and 2 nginx instances the total is ~24Mb. :) On Aug 24, 11:11 am, Johann Spies johann.sp...@gmail.com wrote: On 24 August 2011 11:51, robsan rob...@gmail.com wrote: Check out this thread https://groups.google.com/group/web2py/browse_thread/thread/24b6d1b3a... I followed Vasile's indications and it's working great! Thanks robsan. Did it make a significant difference to the memory consumption on Webfaction? Regards Johann -- May grace and peace be yours in abundance through the full knowledge of God and of Jesus our Lord! His divine power has given us everything we need for life and godliness through the full knowledge of the one who called us by his own glory and excellence. 2 Pet. 1:2b,3a
Re: [web2py] Re: table, grid, smartgrid, getting better
Another typo: http://code.google.com/p/web2py/source/browse/applications/welcome/static/css/base.css#593 tbody instead ybody. It's very nice, another thing yesterday I have an exception using with table auth_membership. 2011/8/24 Bruno Rocha rochacbr...@gmail.com JqueryUI Applied! (Any Theme from http://jqueryui.com/themeroller) Take a look in attached screenshots (a patch is comming to Massimo's mail) -- http://martin.tecnodoc.com.ar
Re: [web2py] Re: table, grid, smartgrid, getting better
TypeError: lambda() takes exactly 1 argument (2 given) It seems this is only when I use certain models. With some other it works nicely. Further experimentation showed that if I removed *format = lambda r: r.nameor T(Unknown) * as well as a *.represent*-line using lambda to show a link it works. Is that a bug or a feature? Regards Johann -- May grace and peace be yours in abundance through the full knowledge of God and of Jesus our Lord! His divine power has given us everything we need for life and godliness through the full knowledge of the one who called us by his own glory and excellence. 2 Pet. 1:2b,3a
Re: [web2py] Re: table, grid, smartgrid, getting better
I solved the typo and I will send it with the patch, because I changed few lines in CSS. On Wed, Aug 24, 2011 at 7:52 AM, Martín Mulone mulone.mar...@gmail.comwrote: Another typo: http://code.google.com/p/web2py/source/browse/applications/welcome/static/css/base.css#593 tbody instead ybody. It's very nice, another thing yesterday I have an exception using with table auth_membership. 2011/8/24 Bruno Rocha rochacbr...@gmail.com JqueryUI Applied! (Any Theme from http://jqueryui.com/themeroller) Take a look in attached screenshots (a patch is comming to Massimo's mail) -- http://martin.tecnodoc.com.ar -- -- Bruno Rocha [ About me: http://zerp.ly/rochacbruno ] [ Aprenda a programar: http://CursoDePython.com.br ] [ O seu aliado nos cuidados com os animais: http://AnimalSystem.com.br ] [ Consultoria em desenvolvimento web: http://www.blouweb.com ]
Re: [web2py] Re: table, grid, smartgrid, getting better
Working demo: http://labs.blouweb.com/web2pygrid (Choose a theme) Note that darker themes conflicts with base.css (but this is not a problem, users can override it with !important, in case of use darker themes)
Re: [web2py] Re: Memory problems on Webfaction
glad to see that I was helpful my personal experience with webfaction is a great one, thanks to nginx, uwsgi and of course web2py :) now uwsgi has a http protocol, and nginx installation is not needed anymore I will post later what and how I use now
[web2py] Re: table, grid, smartgrid, getting better
Is that a bug or a feature? LOL, good moment to remembering this. Bugs are referred to jokingly as undocumented features A Bug is Just an Undocumented Feature! http://en.wikipedia.org/wiki/Undocumented_feature
[web2py] Re: table, grid, smartgrid, getting better
Feature! it used to be that represent = lambda value:... but then we moved on to represent = lambda value, row:... previous code has been made backward compatible (will accept both) but new code (grid and smartgrid) will expect the new syntax. On Aug 24, 5:54 am, Johann Spies johann.sp...@gmail.com wrote: TypeError: lambda() takes exactly 1 argument (2 given) It seems this is only when I use certain models. With some other it works nicely. Further experimentation showed that if I removed *format = lambda r: r.nameor T(Unknown) * as well as a *.represent*-line using lambda to show a link it works. Is that a bug or a feature? Regards Johann -- May grace and peace be yours in abundance through the full knowledge of God and of Jesus our Lord! His divine power has given us everything we need for life and godliness through the full knowledge of the one who called us by his own glory and excellence. 2 Pet. 1:2b,3a
[web2py] Re: Memory problems on Webfaction
Please do... this is interesting! On Aug 24, 6:27 am, Vasile Ermicioi elff...@gmail.com wrote: glad to see that I was helpful my personal experience with webfaction is a great one, thanks to nginx, uwsgi and of course web2py :) now uwsgi has a http protocol, and nginx installation is not needed anymore I will post later what and how I use now
[web2py] Dynamically created png in HTML
I am running on my Mac the following code which creates a png file in / tmp. Looks ok but I can't include this in my default/index view. What is going wrong? Create a png file in controller: def index(): from rpy2.robjects.packages import importr from rpy2 import robjects from rpy2.robjects import Formula from rpy2.robjects.vectors import IntVector, FloatVector from rpy2.robjects.lib import grid grdevices = importr('grDevices') grdevices.png(file=/tmp/rweb2output.png , width=512, height=512) # Plotting code rprint = robjects.globalenv.get(print) stats = importr('stats') base = importr('base') lattice= importr('lattice') xyplot = lattice.xyplot datasets=importr('datasets') mtcars = datasets.mtcars formula = Formula('mpg ~ wt') formula.getenvironment()['mpg'] = mtcars.rx2('mpg') formula.getenvironment()['wt'] = mtcars.rx2('wt') p=lattice.xyplot(formula) rprint(p) # close graphical device so file will be closed. grdevices.dev_off() view in viewer: p Here is the R output via a tmp png file object src=/tmp/rweb2output.png obj text /OBJECT /p I have tried some other options with OBJECT and DATA and IMG. Regards, Richard
Re: [web2py] Re: Memory problems on Webfaction
On 24 August 2011 13:27, Vasile Ermicioi elff...@gmail.com wrote: glad to see that I was helpful my personal experience with webfaction is a great one, thanks to nginx, uwsgi and of course web2py :) now uwsgi has a http protocol, and nginx installation is not needed anymore I will post later what and how I use now That is something to look forward to. I will wait for your howto before I attempt any change to my present setup. Thanks in advance. Regards Johann -- May grace and peace be yours in abundance through the full knowledge of God and of Jesus our Lord! His divine power has given us everything we need for life and godliness through the full knowledge of the one who called us by his own glory and excellence. 2 Pet. 1:2b,3a
[web2py] Re: testing scheduler in windows
It is failing on import platform a standard python module. Can you run it form shell? What windows version? What python version? On Aug 23, 4:27 am, António Ramos ramstei...@gmail.com wrote: hello i´m testing scheduler from trunk in windows and following Maximo video on Vimeo i have a strange behaviour when i load python web2py.py -K a0 see attached file It keeps repeating the loading messages. When i hit Ctrl C i seems to start the scheduler. Is this normal? Scheduler.jpg 245KViewDownload
Re: [web2py] Re: table, grid, smartgrid, getting better
On 24 August 2011 13:47, Massimo Di Pierro massimo.dipie...@gmail.comwrote: Feature! it used to be that represent = lambda value:... but then we moved on to represent = lambda value, row:... previous code has been made backward compatible (will accept both) but new code (grid and smartgrid) will expect the new syntax. I could find one example of the new syntax but so far did not see any documentation. How would would the old syntax in the following situation have to change (in other words, how do I use 'record' in this case)? def dosomething_with_the_field(x): return(something_else) db.sometable.somefield.represent = lambda value: dosomething_with_the_field(value) Regards Johann -- May grace and peace be yours in abundance through the full knowledge of God and of Jesus our Lord! His divine power has given us everything we need for life and godliness through the full knowledge of the one who called us by his own glory and excellence. 2 Pet. 1:2b,3a
Re: Re : Re: [web2py] Re: fluxflex
JmiXIII, You need a better landing page. This one does not make justice to this excellent project: http://www.fluxflex.com/library/47 Massimo On Aug 24, 3:37 am, Yota Ichino www.i...@gmail.com wrote: JmiXIII, You need to access to your admin page HTTPS.https://projecttest.fluxflex.com/admin 2011/8/24 JmiXIII sylvn.p...@gmail.com: Hello Seems fantastic, yet I cannot access the admin page 1- create a project projecttest 2- Setup = github import 3- Url : https://github.com/nus/web2py-for-fluxflex.git 4- Branche : get_new_stable 5- Run intialize script and import ... import starded project avaliable Web2py welcome page Ok Then I check for my database password here :https://www.fluxflex.com/projects/projecttest/instruction/database (notice phpmyadmin is working) Return in the web2py welcomeapp and try admin page : http://projecttest.fluxflex.com/admin But it says that admin is unvailable because it cannot find the password's file Does I made something wrong ?
Re : Re: Re : Re: [web2py] Re: fluxflex
Good thanks a lot. I thought I've tried it but my browser confused me with (I must have made a mistake) Anyway thanks to you and to this community.
[web2py] Re: SQLFORM.demo will blow your mind
Currently using SQLFORM.grid even the show link require autentication. How can I define required permissions for each action ? (show, edit, delete) ?
Re: [web2py] Re: testing scheduler in windows
i´m running from the command prompt c:\python26_32\python.exe d:\web2pyMercurial\Web2py.py -K a0 Python is 2.6.5 32bits and Windows 7(64Bits) Thank you 2011/8/24 Massimo Di Pierro massimo.dipie...@gmail.com It is failing on import platform a standard python module. Can you run it form shell? What windows version? What python version? On Aug 23, 4:27 am, António Ramos ramstei...@gmail.com wrote: hello i´m testing scheduler from trunk in windows and following Maximo video on Vimeo i have a strange behaviour when i load python web2py.py -K a0 see attached file It keeps repeating the loading messages. When i hit Ctrl C i seems to start the scheduler. Is this normal? Scheduler.jpg 245KViewDownload
Re: [web2py] Re: table, grid, smartgrid, getting better
TypeError: lambda() takes exactly 1 argument (2 given) I still get this error with the following model (all 'represent' lines commented out): db.define_table('akb_articles', Field('title'), Field('primaryauthor'), Field('authors', 'text'), Field('rp_author', length=64, requires = IS_EMPTY_OR(IS_IN_DB(db,'akb_reprint.uuid', '%(rp_author)s'))), Field('journal', requires = IS_IN_DB(db,'akb_journal.uuid', '%(title)s')), Field('bib_id'), Field('bib_pages'), Field('doctype'), Field('language'), Field('abstract', 'text'), Field('bib_vol'), Field('bib_date'), Field('url'), Field('pubyear', compute= lambda x: x['bib_date'][-4:]), Field('ut', # isi-unieke rekordnommer requires=IS_EMPTY_OR(IS_NOT_IN_DB(db,'akb_articles.ut'))), Field('scopus_id', requires=IS_EMPTY_OR(IS_NOT_IN_DB(db,'akb_articles.scopus_id'))), Field('sabinet_id', requires=IS_EMPTY_OR(IS_NOT_IN_DB(db,'akb_articles.sabinet_id'))), Field('isap_id', requires=IS_EMPTY_OR(IS_NOT_IN_DB(db,'akb_articles.isap_id'))), Field('category', 'list:string', IS_EMPTY_OR( IS_IN_DB(db,'akb_categories.uuid', '%(category)s', multiple=True))), Field('heading', 'list:string', IS_EMPTY_OR( IS_IN_DB(db,'akb_headings.uuid', '%(headings)s', multiple=True))), Field('art_eq',compute= lambda x: art_ekw(x)), akb_signature, #format = '%(title)s' ) There is no 'lambda' in akb_signature. Regards Johann -- May grace and peace be yours in abundance through the full knowledge of God and of Jesus our Lord! His divine power has given us everything we need for life and godliness through the full knowledge of the one who called us by his own glory and excellence. 2 Pet. 1:2b,3a
Re: [web2py] Re: Mobile detector
Nice work on that Angelo, I did have to change a few things, since 'dist' will not always exist (like when a non-Linux desktop machine visits). So this is what I did: When any 'dist' or 'os' returns is_mobile=True, then the result will have is_mobile at the root. So you can test for mobile like this: ua = request.user_agent() if ua.is_mobile: ... else: ... This should simplify things a bit. I also modified the simple_detect() method (in case anyone uses it) to return a third item in the tuple which is either True or False for is_mobile. I have attached the new user_agent_parser.py file so that you can test and confirm it works for you. If so, let me know and I will submit this for inclusion into the trunk. Nice job!
Re: [web2py] Re: Mobile detector
Forgot to attach, sorry Extract client information from http user agent The module does not try to detect all capabilities of browser in current form (it can easily be extended though). Aim is * fast * very easy to extend * reliable enough for practical purposes * and assist python web apps to detect clients. Taken from http://pypi.python.org/pypi/httpagentparser (MIT license) Modified my Ross Peoples for web2py to better support iPhone and iPad. import sys from storage import Storage class DetectorsHub(dict): _known_types = ['os', 'dist', 'flavor', 'browser'] def __init__(self, *args, **kw): dict.__init__(self, *args, **kw) for typ in self._known_types: self.setdefault(typ, []) self.registerDetectors() def register(self, detector): if detector.info_type not in self._known_types: self[detector.info_type] = [detector] self._known_types.insert(detector.order, detector.info_type) else: self[detector.info_type].append(detector) def reorderByPrefs(self, detectors, prefs): if prefs is None: return [] elif prefs == []: return detectors else: prefs.insert(0, '') def key_name(d): return d.name in prefs and prefs.index(d.name) or sys.maxint return sorted(detectors, key=key_name) def __iter__(self): return iter(self._known_types) def registerDetectors(self): detectors = [v() for v in globals().values() \ if DetectorBase in getattr(v, '__mro__', [])] for d in detectors: if d.can_register: self.register(d) class DetectorBase(object): name = # to perform match in DetectorsHub object info_type = override me result_key = override me order = 10 # 0 is highest look_for = string to look for skip_if_found = [] # strings if present stop processin can_register = False is_mobile = False prefs = Storage() # dict(info_type = [name1, name2], ..) version_splitters = [/, ] _suggested_detectors = None def __init__(self): if not self.name: self.name = self.__class__.__name__ self.can_register = (self.__class__.__dict__.get('can_register', True)) def detect(self, agent, result): if agent and self.checkWords(agent): result[self.info_type] = Storage(name=self.name) result[self.info_type].is_mobile = self.is_mobile if not result.is_mobile: result.is_mobile = result[self.info_type].is_mobile version = self.getVersion(agent) if version: result[self.info_type].version = version return True return False def checkWords(self, agent): for w in self.skip_if_found: if w in agent: return False if self.look_for in agent: return True return False def getVersion(self, agent): # - version string /None vs = self.version_splitters return agent.split(self.look_for + vs[0])[-1].split(vs[1])[0].strip() class OS(DetectorBase): info_type = os can_register = False version_splitters = [;, ] class Dist(DetectorBase): info_type = dist can_register = False class Flavor(DetectorBase): info_type = flavor can_register = False class Browser(DetectorBase): info_type = browser can_register = False class Macintosh(OS): look_for = 'Macintosh' prefs = Storage(dist=None) def getVersion(self, agent): pass class Firefox(Browser): look_for = Firefox class Konqueror(Browser): look_for = Konqueror version_splitters = [/, ;] class Opera(Browser): look_for = Opera def getVersion(self, agent): return agent.split(self.look_for)[1][1:].split(' ')[0] class Netscape(Browser): look_for = Netscape class MSIE(Browser): look_for = MSIE skip_if_found = [Opera] name = Microsoft Internet Explorer version_splitters = [ , ;] class Galeon(Browser): look_for = Galeon class Safari(Browser): look_for = Safari def checkWords(self, agent): unless_list = [Chrome, OmniWeb] if self.look_for in agent: for word in unless_list: if word in agent: return False return True def getVersion(self, agent): if Version/ in agent: return agent.split('Version/')[-1].split(' ')[0].strip() else: # Mobile Safari return agent.split('Safari ')[-1].split(' ')[0].strip() class Linux(OS): look_for = 'Linux' prefs = Storage(browser=[Firefox], dist=[Ubuntu, Android], flavor=None) def getVersion(self, agent): pass class Macintosh(OS): look_for = 'Macintosh' prefs =
Re: [web2py] iconset
As much as jQuery UI can be a pain and the library somewhat big, the ThemeRoller is awesome. They do a good job with CSS
[web2py] How to use SQLFORM.grid
The following is not working. What is the syntax suppose to be? def journal_grid(): query = db.akb_journal.publisher == db.akb_publisher.uuid fields = [db.akb_journal.title,db.akb_journal.standard_name, db.akb_journal.issn, db.akb_journal.abbrev_iso, db.akb_publisher.publisher, db.akb_journal.subject] form = SQLFORM.grid(db.akb_journal,query, fields, deletable= False) return dict(form = form) Errors: query is not iterable and the field list does not have a table-object. Regards Johann -- May grace and peace be yours in abundance through the full knowledge of God and of Jesus our Lord! His divine power has given us everything we need for life and godliness through the full knowledge of the one who called us by his own glory and excellence. 2 Pet. 1:2b,3a
[web2py] Re: Allowing provisional login with email only
Just set a cookie for the email address until you can trust it?
Re: [web2py] Re: Mobile detector
Hi Ross, I thought deeply on the implication on using the dist object. There are many points in favour: 1) Only dist object could be mobile ones from the code, Android - Iphone - Ipad are all dist objects. 2) If you want to detect Windows Mobile in a near future, you'll create a new dist object right? Then you can add the is_mobile flag there. 3) I think that is_mobile flag should be in dist object, because a Linux could have a dist like ubuntu whithout is_mobile or a dist like android whit is_mobile = True. I agree whit you that the is_mobile flag should be on root of the result object and not on a leaf object as dist, we could copy the flag if found at the end of detect phase. Furthermore I think that is a waste copying everey time the is_mobile flag to the root of result also when the useragent is not mobile. I think that the detect method should be like this: def detect(self, agent, result): if agent and self.checkWords(agent): result[self.info_type] = Storage(name=self.name) is_mobile = getattr(self, 'is_mobile', False) if version: result[self.info_type].version = version if is_mobile: result.is_mobile = \ result[self.info_type].is_mobile = is_mobile return True return False The getattr is really a speedy python operation and the if is_mobile is evaluated to True only one time, the one it founds a dist whit is_mobile = True. What do you think? 2011/8/24 Ross Peoples ross.peop...@gmail.com: Forgot to attach, sorry
Re: [web2py] Dynamically created png in HTML
The source of your image looks strange... Is the image really in MAC root /tmp/ folder? Can you get it with your file browser? If so there is maybe OS permissions issue or the file could get earased... Web2py use www-data user (not sure on MAC)... So try to give this user access to the generated files... I would use : path to web2py create a folder like /output_r/ and write my images there... Also I would use this syntax : src={{=URL('static','SUBFOLDER/FILENAME.png')}} to get my files in view... Richard On Wed, Aug 24, 2011 at 8:29 AM, Richard richard.dijks...@planet.nl wrote: I am running on my Mac the following code which creates a png file in / tmp. Looks ok but I can't include this in my default/index view. What is going wrong? Create a png file in controller: def index(): from rpy2.robjects.packages import importr from rpy2 import robjects from rpy2.robjects import Formula from rpy2.robjects.vectors import IntVector, FloatVector from rpy2.robjects.lib import grid grdevices = importr('grDevices') grdevices.png(file=/tmp/rweb2output.png , width=512, height=512) # Plotting code rprint = robjects.globalenv.get(print) stats = importr('stats') base = importr('base') lattice= importr('lattice') xyplot = lattice.xyplot datasets=importr('datasets') mtcars = datasets.mtcars formula = Formula('mpg ~ wt') formula.getenvironment()['mpg'] = mtcars.rx2('mpg') formula.getenvironment()['wt'] = mtcars.rx2('wt') p=lattice.xyplot(formula) rprint(p) # close graphical device so file will be closed. grdevices.dev_off() view in viewer: p Here is the R output via a tmp png file object src=/tmp/rweb2output.png obj text /OBJECT /p I have tried some other options with OBJECT and DATA and IMG. Regards, Richard
[web2py] Re: MSSQL DAL multiple cascade paths not allowed
I would prefer to leave this as it is for backward compatibility reasons but you can do Field(, ondelete=no action) correct? In any case open an issue on google code. On Aug 17, 2:16 pm, Omi Chiba ochib...@gmail.com wrote: I was fololwing the web2py book with mssql for my database. db.define_table('comment', Field('page_id', db.page), Field('body', 'text'), Field('created_on', 'datetime', default=request.now), Field('created_by', db.auth_user, default=auth.user_id)) will generate CREATE TABLE comment( id INT IDENTITY PRIMARY KEY, page_id INT NULL, CONSTRAINT comment_page_id__constraint FOREIGN KEY (page_id) REFERENCES page(id) ON DELETE CASCADE, body TEXT NULL, created_on DATETIME NULL, created_by INT NULL, CONSTRAINT comment_created_by__constraint FOREIGN KEY (created_by) REFERENCES auth_user(id) ON DELETE CASCADE ) and will cause the error says: Introducing FOREIGN KEY constraint 'comment_created_by__constraint' on table 'comment' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints. Msg 1750, Level 16, State 0, Line 1 Could not create constraint. See previous errors. The details for the error is descrived in herehttp://support.microsoft.com/kb/321843 After I made the change on dal.py it worked fine. def __init__( self, fieldname, type='string', length=None, default=DEFAULT, required=False, requires=DEFAULT, # ondelete='CASCADE', ondelete='NO ACTION', Can we make this change as path to avoid the error for mssql ? I'm not sure if other database has the same problem.
[web2py] Re: fluxflex
Yota Ichino, Thanks for your prompt response! It looks working well. Another big issue. How to upgrade to the latest web2py (when available)? Every time I do a git import in fluxflex panel, with or WITHOUT checking Run initialize scripts for setting up the project, ends up with my whole web2py project being completely reset. My manually uploaded web2py apps and their data will be lost. I've read the doc [1] by the help of Google Translate, but still can not figure out how to trigger the deploy-only mode. By the way, problems raised on Fluxflex's support forum [2] never got answered. Not a good service standard I expected. (Shrug.) [1] http://jp.doc.fluxflex.com/settoappumodotodepuroimodo [2] http://getsatisfaction.com/fluxflex Regards, Ray On Aug 24, 3:10 am, Yota Ichino www.i...@gmail.com wrote: Iceberg, Massimo Di Pierro, Your idea is great. These influence me and I rewrite .flx file. It is created on same github project with branch get_new_stable.https://github.com/nus/web2py-for-fluxflex/tree/get_new_stable We can import this branch by using Github import menu. The branch doing: 1. get new stable file from web2py.com. 2. unzip 3. deploying This idea's strong point: - User can get new stable file everytime. Iceberg, How to write .flx file is inhttp://jp.doc.fluxflex.com/and other library code. 2011/8/23 Massimo Di Pierro massimo.dipie...@gmail.com: I think there should be a recommended way to created branded versions of web2py. I would recommend: - getting the latest official stable - unzip - add your own init app, with landing branded page etc, linking admin. - have a standard mechanism to add a brand logo to admin as well - rezip and distribute we could create a hook (div) for the admin logo, a sample branded init, and a script to create this. Massimo On Aug 22, 2:24 am, Iceberg iceb...@21cn.com wrote: Omi Chiba, Thanks VERY MUCH for your effort on building the web2py installation package (a.k.a. library on fluxflex). Deploying web2py on a hosting server has never been so easy! (I start crying for the hours I spent in setting up my first web2py instance on my previous hosting provider.) One thing though. Your web2py library is a forked (and tailored) version of official web2py 1.98.2. This way it will soon be outdated when web2py trunk grows into 1.99, 1.100, etc.. So I see the only practical way is: 1. modify your .flx file (in order to get rid of the public_html directory, shall we?) 2. and commit it into the trunk. 3. and then someone of us (if not Massimo) maintain an identical clone (rather than a fork) of web2py on github, until fluxflex will support google code as app backend someday. (Will they?) Later we will figure out a way to upload (perhaps download too?) each web2py app, one by one. By the way, how did you find out how to write the .flx file? I did not see any documentation section on fluxflex site. Hope to know more so that we can tweak more. Regards, Ray On Aug 21, 8:37 pm, Omi Chiba ochib...@gmail.com wrote: Ichino who is a member of web2py Japan created a library on fluxflex and it works great ! http://www.fluxflex.com/library/47 1. Sign up fluxflex 2. Create new project (e.g. ochiba) 3. Install the library (It will be done in one second!) 4. Access to your project with HTTPS not HTTP (e.g.https://ochiba.fluxflex.com) 5. Access Administrative Interface with /admin (e.g.https://ochiba.fluxflex.com/admin ) 5. Admin password is the same as your MySQL database on fluxflex project. Enjoy :)
Re: [web2py] Re: User-friendly checkbox/radio-button widget in gluon/sqlhtml.py
I've re-implemented the code using LABEL, as Anthony advised. http://code.google.com/r/ryo1kato-web2py/source/list?name=better-checkbox2 And demo is updated also http://ryo1kato.appspot.com/checkbox The code is shorter, but still ugly. But I couldn't figure out how to improve even more, despite I (briefly) studied a little bit more about HTML4, CSS and JavaScript. (hope there's 'parent' selector, and :checked support in IE6...) Any idea? -- R.Kato On Tue, Aug 23, 2011 at 23:35, Anthony abasta...@gmail.com wrote: I think using label for=[input id]input text/label would be a good start (certainly a lot simpler). web2py already uses that to label fields in SQLFORMs and for the Remember me checkbox on login forms. The base.css even sets the cursor to 'pointer' for all label elements, so you get a pointer whenever you hover over a label. To enable more sophisticated effects (e.g., dynamic style changes), maybe wrap the input and label in a span container with a special class, as suggested, and leave it up to the developer to add additional effects via CSS/jQuery. Anthony On Tuesday, August 23, 2011 9:44:03 AM UTC-4, ryo1kato wrote: Well, actually I'm embarrassed that I didn't know about LABLE And yes, I'm pretty sure that the change can be more simple. Primarily what I want is clickable option value(label) for radio/checkboxes. Besides, * Preferably, more large clickable area (*1) * Dynamic style change (as shown on the demo) * IE6 support. would be good for easy-to-use UI. Regards, --- (*1) In my current implementation, span class=...label and input ... are clickable. But I think this is still a bit too small to click. Perhaps making container(a box containing both input and label) clickable is more easy-to use. (span class=..._container in my example) On Tue, Aug 23, 2011 at 22:25, Massimo Di Pierro massimo@gmail.com wrote: here there is substantial JS to add to web2py_ajax and perhaps we can make it more compact. What is more specifically the problem that you want to solve? Be able to check/uncheck clicking on option value instead of checkbox/radio button? On Aug 23, 6:34 am, ryo1kato ryo1...@gmail.com wrote: Hi, I'm frustrated that I can't check/select the checkboxes / radio- buttons by clicking on their labels rather than the box/buttons. So, here's my own solution for web2py, because I couldn't find any by quick googling. *http://bit.ly/nsNAmq(deep link inhttp://code.google.com/) * Demo is available on here:http://ryo1kato.appspot.com/checkbox/default/ (Tested on IE6, Firefox5,6, GoogleChrome13) ...It's quite possible you have better solution, because I'm pretty new to both web2py and HTML/JavaScript. However, I'm happy if this feature is supported as web2py's default. (perhaps by someone's better implementation...) -- R.Kato -- R.Kato -- R.Kato
[web2py] Re: Dynamically created png in HTML
On Wednesday, August 24, 2011 8:29:11 AM UTC-4, Richard wrote: p Here is the R output via a tmp png file object src=/tmp/rweb2output.png obj text /OBJECT /p Since src is a relative url, it will end up being http://127.0.0.1:8000/tmp/rweb2output.png (assuming you're running on your local machine on the default port). Instead, put the file inside your application's 'static' folder (you can create a 'tmp' subfolder in there), and use src={{=URL('static','tmp/rweb2output.png')}}. Also, use an img tag instead of object. Anthony
Re: [web2py] Re: Mobile detector
This works like a charm! def detect(self, agent, result): if agent and self.checkWords(agent): result[self.info_type] = Storage(name=self.name) version = self.getVersion(agent) if version: result[self.info_type].version = version if self.is_mobile: result.is_mobile = \ result[self.info_type].is_mobile = self.is_mobile return True return False 2011/8/24 Angelo Compagnucci angelo.compagnu...@gmail.com: Hi Ross, I thought deeply on the implication on using the dist object. There are many points in favour: 1) Only dist object could be mobile ones from the code, Android - Iphone - Ipad are all dist objects. 2) If you want to detect Windows Mobile in a near future, you'll create a new dist object right? Then you can add the is_mobile flag there. 3) I think that is_mobile flag should be in dist object, because a Linux could have a dist like ubuntu whithout is_mobile or a dist like android whit is_mobile = True. I agree whit you that the is_mobile flag should be on root of the result object and not on a leaf object as dist, we could copy the flag if found at the end of detect phase. Furthermore I think that is a waste copying everey time the is_mobile flag to the root of result also when the useragent is not mobile. I think that the detect method should be like this: def detect(self, agent, result): if agent and self.checkWords(agent): result[self.info_type] = Storage(name=self.name) is_mobile = getattr(self, 'is_mobile', False) if version: result[self.info_type].version = version if is_mobile: result.is_mobile = \ result[self.info_type].is_mobile = is_mobile return True return False The getattr is really a speedy python operation and the if is_mobile is evaluated to True only one time, the one it founds a dist whit is_mobile = True. What do you think? 2011/8/24 Ross Peoples ross.peop...@gmail.com: Forgot to attach, sorry
[web2py] web2py classes
I am teaching a certificate course on web2py again: http://www.cdm.depaul.edu/ipd/Programs/Pages/WebDevelopmentwithPython.aspx In case anybody is interested. massimo
[web2py] Re: How to use SQLFORM.grid
I think the first argument should be either a table or a query, but don't pass a table and a query as the first two arguments. Anthony On Wednesday, August 24, 2011 10:09:22 AM UTC-4, spyker wrote: The following is not working. What is the syntax suppose to be? def journal_grid(): query = db.akb_journal.publisher == db.akb_publisher.uuid fields = [db.akb_journal.title,db.akb_journal.standard_name, db.akb_journal.issn, db.akb_journal.abbrev_iso, db.akb_publisher.publisher, db.akb_journal.subject] form = SQLFORM.grid(db.akb_journal,query, fields, deletable= False) return dict(form = form) Errors: query is not iterable and the field list does not have a table-object. Regards Johann -- May grace and peace be yours in abundance through the full knowledge of God and of Jesus our Lord! His divine power has given us everything we need for life and godliness through the full knowledge of the one who called us by his own glory and excellence. 2 Pet. 1:2b,3a
[web2py] Re : Re: fluxflex
Hello, Does'nt it work with the upgrade button of the admin page ?
Re: [web2py] Re: User-friendly checkbox/radio-button widget in gluon/sqlhtml.py
Is all the JS just to get the dynamic highlighting? If so, I'm not sure it's worth adding to the framework. Instead, maybe just add a class to the label (or a wrapping span), and let the developer add dynamic highlighting or other effects if desired. Anthony On Wednesday, August 24, 2011 10:36:20 AM UTC-4, ryo1kato wrote: I've re-implemented the code using LABEL, as Anthony advised. http://code.google.com/r/ryo1kato-web2py/source/list?name=better-checkbox2 And demo is updated also http://ryo1kato.appspot.com/checkbox The code is shorter, but still ugly. But I couldn't figure out how to improve even more, despite I (briefly) studied a little bit more about HTML4, CSS and JavaScript. (hope there's 'parent' selector, and :checked support in IE6...) Any idea? -- R.Kato On Tue, Aug 23, 2011 at 23:35, Anthony abas...@gmail.com wrote: I think using label for=[input id]input text/label would be a good start (certainly a lot simpler). web2py already uses that to label fields in SQLFORMs and for the Remember me checkbox on login forms. The base.css even sets the cursor to 'pointer' for all label elements, so you get a pointer whenever you hover over a label. To enable more sophisticated effects (e.g., dynamic style changes), maybe wrap the input and label in a span container with a special class, as suggested, and leave it up to the developer to add additional effects via CSS/jQuery. Anthony On Tuesday, August 23, 2011 9:44:03 AM UTC-4, ryo1kato wrote: Well, actually I'm embarrassed that I didn't know about LABLE And yes, I'm pretty sure that the change can be more simple. Primarily what I want is clickable option value(label) for radio/checkboxes. Besides, * Preferably, more large clickable area (*1) * Dynamic style change (as shown on the demo) * IE6 support. would be good for easy-to-use UI. Regards, --- (*1) In my current implementation, span class=...label and input ... are clickable. But I think this is still a bit too small to click. Perhaps making container(a box containing both input and label) clickable is more easy-to use. (span class=..._container in my example) On Tue, Aug 23, 2011 at 22:25, Massimo Di Pierro massi...@gmail.com wrote: here there is substantial JS to add to web2py_ajax and perhaps we can make it more compact. What is more specifically the problem that you want to solve? Be able to check/uncheck clicking on option value instead of checkbox/radio button? On Aug 23, 6:34 am, ryo1kato ryo...@gmail.com wrote: Hi, I'm frustrated that I can't check/select the checkboxes / radio- buttons by clicking on their labels rather than the box/buttons. So, here's my own solution for web2py, because I couldn't find any by quick googling. *http://bit.ly/nsNAmq(deep link inhttp://code.google.com/) * Demo is available on here:http://ryo1kato.appspot.com/checkbox/default/ (Tested on IE6, Firefox5,6, GoogleChrome13) ...It's quite possible you have better solution, because I'm pretty new to both web2py and HTML/JavaScript. However, I'm happy if this feature is supported as web2py's default. (perhaps by someone's better implementation...) -- R.Kato -- R.Kato -- R.Kato
[web2py] Re: User-friendly checkbox/radio-button widget in gluon/sqlhtml.py
Your idea is really good. I think I have a solution in trunk that only requires a change to sqlhtml.py and that will also allow to style the options using pure css. Can you try it? massimo On Aug 24, 9:36 am, KATO Ryoichi ryo1k...@gmail.com wrote: I've re-implemented the code using LABEL, as Anthony advised. http://code.google.com/r/ryo1kato-web2py/source/list?name=better-chec... And demo is updated also http://ryo1kato.appspot.com/checkbox The code is shorter, but still ugly. But I couldn't figure out how to improve even more, despite I (briefly) studied a little bit more about HTML4, CSS and JavaScript. (hope there's 'parent' selector, and :checked support in IE6...) Any idea? -- R.Kato On Tue, Aug 23, 2011 at 23:35, Anthony abasta...@gmail.com wrote: I think using label for=[input id]input text/label would be a good start (certainly a lot simpler). web2py already uses that to label fields in SQLFORMs and for the Remember me checkbox on login forms. The base.css even sets the cursor to 'pointer' for all label elements, so you get a pointer whenever you hover over a label. To enable more sophisticated effects (e.g., dynamic style changes), maybe wrap the input and label in a span container with a special class, as suggested, and leave it up to the developer to add additional effects via CSS/jQuery. Anthony On Tuesday, August 23, 2011 9:44:03 AM UTC-4, ryo1kato wrote: Well, actually I'm embarrassed that I didn't know about LABLE And yes, I'm pretty sure that the change can be more simple. Primarily what I want is clickable option value(label) for radio/checkboxes. Besides, * Preferably, more large clickable area (*1) * Dynamic style change (as shown on the demo) * IE6 support. would be good for easy-to-use UI. Regards, --- (*1) In my current implementation, span class=...label and input ... are clickable. But I think this is still a bit too small to click. Perhaps making container(a box containing both input and label) clickable is more easy-to use. (span class=..._container in my example) On Tue, Aug 23, 2011 at 22:25, Massimo Di Pierro massimo@gmail.com wrote: here there is substantial JS to add to web2py_ajax and perhaps we can make it more compact. What is more specifically the problem that you want to solve? Be able to check/uncheck clicking on option value instead of checkbox/radio button? On Aug 23, 6:34 am, ryo1kato ryo1...@gmail.com wrote: Hi, I'm frustrated that I can't check/select the checkboxes / radio- buttons by clicking on their labels rather than the box/buttons. So, here's my own solution for web2py, because I couldn't find any by quick googling. *http://bit.ly/nsNAmq(deeplink inhttp://code.google.com/) * Demo is available on here:http://ryo1kato.appspot.com/checkbox/default/ (Tested on IE6, Firefox5,6, GoogleChrome13) ...It's quite possible you have better solution, because I'm pretty new to both web2py and HTML/JavaScript. However, I'm happy if this feature is supported as web2py's default. (perhaps by someone's better implementation...) -- R.Kato -- R.Kato -- R.Kato
[web2py] Re: Time intervals with MySQL and DAL
Sorry to repost but I was surprised there were no responses. It seems like time interval arithmetic must be fairly common for web2py applications. Has no one else run into a similar problem? Thanks, G On Aug 23, 8:27 am, G glenn.calt...@gmail.com wrote: Hello, I've noticed that the cleanup task in scheduler.py is not working for me. Looking into it, it appears that the handling of time intervals in MySQL through DAL is not being done properly. This code db(db.task_scheduled.status.belongs(statuses)) \ (db.task_scheduled.last_run_time+60now)._select() generates the following sql SELECT task_scheduled.id, task_scheduled.name, task_scheduled.group_name, task_scheduled.status, task_scheduled.func, task_scheduled.args, task_scheduled.vars, task_scheduled.enabled, task_scheduled.start_time, task_scheduled.next_run_time, task_scheduled.stop_time, task_scheduled.repeats, task_scheduled.period, task_scheduled.timeout, task_scheduled.times_run, task_scheduled.last_run_time, task_scheduled.assigned_worker_name FROM task_scheduled WHERE ((task_scheduled.status IN ('completed')) AND ((task_scheduled.last_run_time + '60') '2011-08-23 15:01:38')); However, if I execute the following in MySQL: SELECT last_run_time + '60' '2011-08-23 15:01:38' FROM task_scheduled ORDER BY ID DESC LIMIT 1; I get all zeros and MySQL even provides a warning about incorrect DOUBLE value '2011-08-23 15:01:38' If you do SELECT '2011-08-23 15:01:38' + 60; you also get this warning and the result is meaningless 2071. Is this an error in the MySQL adapter for DAL or is the query missing something to explicitly tell MySQL to do time interval arithmatic? Thanks, G
Re: [web2py] Re: User-friendly checkbox/radio-button widget in gluon/sqlhtml.py
Sure! (I'm not sure about coding style, but perhaps it's better not to touch web2py_ajax.js for this kind of fix?) On Thu, Aug 25, 2011 at 00:01, Massimo Di Pierro massimo.dipie...@gmail.com wrote: Your idea is really good. I think I have a solution in trunk that only requires a change to sqlhtml.py and that will also allow to style the options using pure css. Can you try it? massimo On Aug 24, 9:36 am, KATO Ryoichi ryo1k...@gmail.com wrote: I've re-implemented the code using LABEL, as Anthony advised. http://code.google.com/r/ryo1kato-web2py/source/list?name=better-chec... And demo is updated also http://ryo1kato.appspot.com/checkbox The code is shorter, but still ugly. But I couldn't figure out how to improve even more, despite I (briefly) studied a little bit more about HTML4, CSS and JavaScript. (hope there's 'parent' selector, and :checked support in IE6...) Any idea? -- R.Kato On Tue, Aug 23, 2011 at 23:35, Anthony abasta...@gmail.com wrote: I think using label for=[input id]input text/label would be a good start (certainly a lot simpler). web2py already uses that to label fields in SQLFORMs and for the Remember me checkbox on login forms. The base.css even sets the cursor to 'pointer' for all label elements, so you get a pointer whenever you hover over a label. To enable more sophisticated effects (e.g., dynamic style changes), maybe wrap the input and label in a span container with a special class, as suggested, and leave it up to the developer to add additional effects via CSS/jQuery. Anthony On Tuesday, August 23, 2011 9:44:03 AM UTC-4, ryo1kato wrote: Well, actually I'm embarrassed that I didn't know about LABLE And yes, I'm pretty sure that the change can be more simple. Primarily what I want is clickable option value(label) for radio/checkboxes. Besides, * Preferably, more large clickable area (*1) * Dynamic style change (as shown on the demo) * IE6 support. would be good for easy-to-use UI. Regards, --- (*1) In my current implementation, span class=...label and input ... are clickable. But I think this is still a bit too small to click. Perhaps making container(a box containing both input and label) clickable is more easy-to use. (span class=..._container in my example) On Tue, Aug 23, 2011 at 22:25, Massimo Di Pierro massimo@gmail.com wrote: here there is substantial JS to add to web2py_ajax and perhaps we can make it more compact. What is more specifically the problem that you want to solve? Be able to check/uncheck clicking on option value instead of checkbox/radio button? On Aug 23, 6:34 am, ryo1kato ryo1...@gmail.com wrote: Hi, I'm frustrated that I can't check/select the checkboxes / radio- buttons by clicking on their labels rather than the box/buttons. So, here's my own solution for web2py, because I couldn't find any by quick googling. *http://bit.ly/nsNAmq(deeplink inhttp://code.google.com/) * Demo is available on here:http://ryo1kato.appspot.com/checkbox/default/ (Tested on IE6, Firefox5,6, GoogleChrome13) ...It's quite possible you have better solution, because I'm pretty new to both web2py and HTML/JavaScript. However, I'm happy if this feature is supported as web2py's default. (perhaps by someone's better implementation...) -- R.Kato -- R.Kato -- R.Kato -- R.Kato
[web2py] Re: DB - removing reference when deleting referenced object...
Are you saying you want to do ON DELETE SET NULL (i.e., set the value of the reference field to NULL when the referenced object is deleted)? web2py Fields take an ondelete argument that defaults to CASCADE (which will delete referencing records when the referenced object is deleted). I suppose you could try ondelete='SET NULL' and see if it works. See http://web2py.com/book/default/chapter/06#Record-Representation (explains all the arguments to Field). Anthony On Wednesday, August 24, 2011 4:53:18 AM UTC-4, TomPliss wrote: Hey guys (yeah, i'm still here), I'd like to know what is the best way to remove a DB reference when the referenced object is removed. Is it possible directly in the db.py ? Is it possible to do it without modifying every form.accept including a reference in the form ? PS: talking about removing the reference, not the referencing object ;)
Re: [web2py] Re: User-friendly checkbox/radio-button widget in gluon/sqlhtml.py
I dont understand why we do need jquery to take this action? just incluce label for='' and this wiill be done! or not?
Re: [web2py] Re: User-friendly checkbox/radio-button widget in gluon/sqlhtml.py
No, we don't need jQuery. Just using plain JavaScript, and it's for dynamic style update. And yes, If we only want to check/uncheck by click on labels, LABEL is sufficient. On Thu, Aug 25, 2011 at 00:18, Bruno Rocha rochacbr...@gmail.com wrote: I dont understand why we do need jquery to take this action? just incluce label for='' and this wiill be done! or not? -- R.Kato
[web2py] Re: URL inside .load component
On Wednesday, August 24, 2011 3:16:38 AM UTC-4, Álvaro J. Iradier wrote: Thanks very much, that made it. I couldn't find documentation about the extension=False option for the URL function, it would be nice to have it in the book. It's in there -- re-read my last sentence. :-)
Re: [web2py] Re: User-friendly checkbox/radio-button widget in gluon/sqlhtml.py
I say don't use Javascript if it can be done with a simple html label element. I think Bruno is working on a patch for that (plus more flexible formstyle): https://groups.google.com/d/msg/web2py-developers/N8GfwA3p4jk/XULfOX5PlmYJ. Anthony On Wednesday, August 24, 2011 11:26:17 AM UTC-4, ryo1kato wrote: No, we don't need jQuery. Just using plain JavaScript, and it's for dynamic style update. And yes, If we only want to check/uncheck by click on labels, LABEL is sufficient. On Thu, Aug 25, 2011 at 00:18, Bruno Rocha rocha...@gmail.com wrote: I dont understand why we do need jquery to take this action? just incluce label for='' and this wiill be done! or not? -- R.Kato
[web2py] Re: User-friendly checkbox/radio-button widget in gluon/sqlhtml.py
I think you are right.I just did not try it. On Aug 24, 10:18 am, Bruno Rocha rochacbr...@gmail.com wrote: I dont understand why we do need jquery to take this action? just incluce label for='' and this wiill be done! or not?
[web2py] Google App Engine : Python 2.7 runtime is opened for Trusted Tester
Signup here: https://docs.google.com/spreadsheet/viewform?formkey=dDVaelk0NkhHMVA2NU5kS1hfajNfM0E6MQ
Re: [web2py] Re: User-friendly checkbox/radio-button widget in gluon/sqlhtml.py
I say don't use Javascript if it can be done with a simple html label element. Right, but I couldn't figure out how for dynamic style update; what's formstyle? Anyway, I should shut up and wait when someone skilled than me is working for similar thing ;-) On Thu, Aug 25, 2011 at 00:32, Anthony abasta...@gmail.com wrote: I say don't use Javascript if it can be done with a simple html label element. I think Bruno is working on a patch for that (plus more flexible formstyle): https://groups.google.com/d/msg/web2py-developers/N8GfwA3p4jk/XULfOX5PlmYJ. Anthony On Wednesday, August 24, 2011 11:26:17 AM UTC-4, ryo1kato wrote: No, we don't need jQuery. Just using plain JavaScript, and it's for dynamic style update. And yes, If we only want to check/uncheck by click on labels, LABEL is sufficient. On Thu, Aug 25, 2011 at 00:18, Bruno Rocha rocha...@gmail.com wrote: I dont understand why we do need jquery to take this action? just incluce label for='' and this wiill be done! or not? -- R.Kato -- R.Kato
[web2py] Problems running a module in web2py shell
I'm having trouble running a module in the web2py shell. It's having difficulty with a db query that I execute with no problems in any controller. Here's the traceback: Traceback (most recent call last): File console, line 1, in module File /home/www-data/web2py/gluon/custom_import.py, line 280, in __call__ fromlist, level) File /home/www-data/web2py/gluon/custom_import.py, line 74, in __call__ level) File applications/baristacode/modules/real_addcard.py, line 37, in module rows = db(db.card.number==cardnum).select() File /home/www-data/web2py/gluon/dal.py, line 4331, in __getattr__ return self[key] File /home/www-data/web2py/gluon/dal.py, line 4325, in __getitem__ return dict.__getitem__(self, str(key)) KeyError: 'card' I use python web2py.py -S app -M and I always check to be sure the db is available in the shell, as well as the models. I'm also able to execute the query by itself in the shell, but when it's in a module, I get the KeyError above. I've tried importing the module and using execfile, and in both cases the script runs fine until the first db query. Any hints or suggestions? Thank you, Eric
Re: [web2py] Re: Dynamically created png in HTML
Anthony, Richard, Thank you for the feedback. Getting the png file from the static area could be done, and how do I get the dynamically create file in that static area? What would the output path be in : grdevices.png(file=/tmp/rweb2output.png , width=512, height=512) Richard Op 24-8-2011 16:37, Anthony schreef: On Wednesday, August 24, 2011 8:29:11 AM UTC-4, Richard wrote: p Here is the R output via a tmp png file object src=/tmp/rweb2output.png obj text /OBJECT /p Since src is a relative url, it will end up being http://127.0.0.1:8000/tmp/rweb2output.png (assuming you're running on your local machine on the default port). Instead, put the file inside your application's 'static' folder (you can create a 'tmp' subfolder in there), and use src={{=URL('static','tmp/rweb2output.png')}}. Also, use an img tag instead of object. Anthony Interne Virusdatabase is verouderd. Gecontroleerd door AVG - www.avg.com Versie: 9.0.872 / Virusdatabase: 271.1.1/3830 - datum van uitgifte: 08/12/11 20:34:00
[web2py] Re: field inheritance
@ Andrew: thanks, yes that is the idea. @ Bruno: thank you, but I would like to be able to template also from existing tables (legacy mostly) not just from explicit template definitions, the sample function above does that I believe.
[web2py] Link calling function w/results in modal popup?
Hello! I'm curious to get some recommendations on how best to approach this - possibly using the Minimal Modal plugin, but I'm open to whatever other methods might achieve it. I have a table of results being displayed. There is a field in each row that contains information which I don't want visible in the actual table. I'd like a reveal link/button in that field of each row to pop up a modal window with the information which can then be dismissed. I don't want this information to be embedded within the page source itself, so the reveal link needs to be creating the modal popup and calling a function/URL that returns the info to be shown. Any pointers and/or code examples that might help me achieve this in a sane manner? :) Thanks! - Aaron
Re: [web2py] Re: Memory problems on Webfaction
[web2py] wget http://www.web2py.com/examples/static/web2py_src.zip unzip web2py_src.zip python2.7 web2py.py #seems needed before using it [uwsgi] wget http://projects.unbit.it/downloads/uwsgi-0.9.8.3.tar.gz tar xvzf uwsgi-0.9.8.3.tar.gz cd uwsgi-0.9.8.3 /home/yourname/bin/python2.7 uwsgiconfig.py --build mv uwsgi /home/yourname/bin uwsgi --protocol=http --socket 127.0.0.1:your_custom_port_number --pythonpath /home/yourname/web2py --module wsgihandler -d /home/yourname/tmp/uwsgi.log -t 20 --async 24 --ugreen --limit-as 64 -r --no-orphans -M -p 1 --touch-reload /home/yourname/tmp/uwsgireload.txt --reload-on-rss 50 touch /home/yourname/tmp/uwsgireload.txt [utils] ps -u fermer -o rss,command notes/comments: - --protocol=http means that you don't need another webserver - it is still nginx + uwsgi because you have webfaction nginx instance in front - I use touch /home/yourname/tmp/uwsgireload.txt to reload uwsgi server, it is useful when I change routes.py file, or adding some modules in site-packages folder - -M -p 1 will generate 2 processes, a master process and a slave one an example of website powered by web2py+uwsgi+webfaction(nginx) is http://fermer.md/ (hosted in Amsterdam) for Johann: you need to check uwsgi documentation to configure itself these paramaters --async 24- number of green threads --ugreen --limit-as 64 - memory limit per process !!! -p 1- number of processes, total memory that is allowed to be consumed is = number of processes * limit-as for Massimo: - Robert is working on uwsgi - pypy integration, please make web2py pypy compatible, - please add my website (fermer.md) to web2py powered websites and please add me to web2py professional website, or tell me what to do to achieve that thank you :)
Re: [web2py] Re: Dynamically created png in HTML
Try this : URL('static','SUBFOLDER/FILENAME') Richard On Wed, Aug 24, 2011 at 11:55 AM, Richard Dijkstra richard.dijks...@planet.nl wrote: Anthony, Richard, Thank you for the feedback. Getting the png file from the static area could be done, and how do I get the dynamically create file in that static area? What would the output path be in : grdevices.png(file=/tmp/rweb2output.png , width=512, height=512) Richard Op 24-8-2011 16:37, Anthony schreef: On Wednesday, August 24, 2011 8:29:11 AM UTC-4, Richard wrote: p Here is the R output via a tmp png file object src=/tmp/rweb2output.png obj text /OBJECT /p Since src is a relative url, it will end up being http://127.0.0.1:8000/tmp/rweb2output.png (assuming you're running on your local machine on the default port). Instead, put the file inside your application's 'static' folder (you can create a 'tmp' subfolder in there), and use src={{=URL('static','tmp/rweb2output.png')}}. Also, use an img tag instead of object. Anthony Interne Virusdatabase is verouderd. Gecontroleerd door AVG - www.avg.com Versie: 9.0.872 / Virusdatabase: 271.1.1/3830 - datum van uitgifte: 08/12/11 20:34:00
Re: [web2py] Re: Dynamically created png in HTML
file=URL('static','SUBFOLDER/FILENAME') On Wed, Aug 24, 2011 at 12:09 PM, Richard Vézina ml.richard.vez...@gmail.com wrote: Try this : URL('static','SUBFOLDER/FILENAME') Richard On Wed, Aug 24, 2011 at 11:55 AM, Richard Dijkstra richard.dijks...@planet.nl wrote: Anthony, Richard, Thank you for the feedback. Getting the png file from the static area could be done, and how do I get the dynamically create file in that static area? What would the output path be in : grdevices.png(file=/tmp/rweb2output.png , width=512, height=512) Richard Op 24-8-2011 16:37, Anthony schreef: On Wednesday, August 24, 2011 8:29:11 AM UTC-4, Richard wrote: p Here is the R output via a tmp png file object src=/tmp/rweb2output.png obj text /OBJECT /p Since src is a relative url, it will end up being http://127.0.0.1:8000/tmp/rweb2output.png (assuming you're running on your local machine on the default port). Instead, put the file inside your application's 'static' folder (you can create a 'tmp' subfolder in there), and use src={{=URL('static','tmp/rweb2output.png')}}. Also, use an img tag instead of object. Anthony Interne Virusdatabase is verouderd. Gecontroleerd door AVG - www.avg.com Versie: 9.0.872 / Virusdatabase: 271.1.1/3830 - datum van uitgifte: 08/12/11 20:34:00
[web2py] Re: Link calling function w/results in modal popup?
That first example looks very close. Let me study that one a bit... Thanks! - Aaron On Aug 24, 12:08 pm, Anthony abasta...@gmail.com wrote: Maybehttp://labs.blouweb.com/PowerGrid/default/gridinpopuporhttp://powertable.blouweb.com/category. On Wednesday, August 24, 2011 12:03:31 PM UTC-4, Aaron Mahler wrote: Hello! I'm curious to get some recommendations on how best to approach this - possibly using the Minimal Modal plugin, but I'm open to whatever other methods might achieve it. I have a table of results being displayed. There is a field in each row that contains information which I don't want visible in the actual table. I'd like a reveal link/button in that field of each row to pop up a modal window with the information which can then be dismissed. I don't want this information to be embedded within the page source itself, so the reveal link needs to be creating the modal popup and calling a function/URL that returns the info to be shown. Any pointers and/or code examples that might help me achieve this in a sane manner? :) Thanks! - Aaron
Re: [web2py] Re: Dynamically created png in HTML
On Wednesday, August 24, 2011 11:55:56 AM UTC-4, Richard wrote: Anthony, Richard, Thank you for the feedback. Getting the png file from the static area could be done, and how do I get the dynamically create file in that static area? What would the output path be in : grdevices.png(file=/tmp/rweb2output.png , width=512, height=512) For the path to save the file: import os file=os.path.join(request.folder,'static','tmp','rweb2output.png') request.folder should contain the full path to your application folder. Then you just need to add 'static', 'tmp', and the filename to assemble the full path. Anthony
Re: [web2py] Re: User-friendly checkbox/radio-button widget in gluon/sqlhtml.py
On Wednesday, August 24, 2011 11:50:38 AM UTC-4, ryo1kato wrote: I say don't use Javascript if it can be done with a simple html label element. Right, but I couldn't figure out how for dynamic style update; Yes, using label will make the labels clickable, but won't do dynamic style updating. I like the idea of dynamic styling, but just not sure it belongs in the core framework code -- then users who don't like it or want to implement it differently will have to disable it. Maybe if it's optional, and the code is relatively simple. what's formstyle? See http://web2py.com/book/default/chapter/07#SQLFORM (scroll down a bit). It defaults to table format, but can also be set to ul or divs. However, radio buttons and checkboxes are always in tables, regardless of formstyle -- we want to make that more flexible. Anthony
[web2py] Re: Time intervals with MySQL and DAL
sorry for the oversight. Can you please open a google code issue? On Aug 24, 10:03 am, G glenn.calt...@gmail.com wrote: Sorry to repost but I was surprised there were no responses. It seems like time interval arithmetic must be fairly common for web2py applications. Has no one else run into a similar problem? Thanks, G On Aug 23, 8:27 am, G glenn.calt...@gmail.com wrote: Hello, I've noticed that the cleanup task in scheduler.py is not working for me. Looking into it, it appears that the handling of time intervals in MySQL through DAL is not being done properly. This code db(db.task_scheduled.status.belongs(statuses)) \ (db.task_scheduled.last_run_time+60now)._select() generates the following sql SELECT task_scheduled.id, task_scheduled.name, task_scheduled.group_name, task_scheduled.status, task_scheduled.func, task_scheduled.args, task_scheduled.vars, task_scheduled.enabled, task_scheduled.start_time, task_scheduled.next_run_time, task_scheduled.stop_time, task_scheduled.repeats, task_scheduled.period, task_scheduled.timeout, task_scheduled.times_run, task_scheduled.last_run_time, task_scheduled.assigned_worker_name FROM task_scheduled WHERE ((task_scheduled.status IN ('completed')) AND ((task_scheduled.last_run_time + '60') '2011-08-23 15:01:38')); However, if I execute the following in MySQL: SELECT last_run_time + '60' '2011-08-23 15:01:38' FROM task_scheduled ORDER BY ID DESC LIMIT 1; I get all zeros and MySQL even provides a warning about incorrect DOUBLE value '2011-08-23 15:01:38' If you do SELECT '2011-08-23 15:01:38' + 60; you also get this warning and the result is meaningless 2071. Is this an error in the MySQL adapter for DAL or is the query missing something to explicitly tell MySQL to do time interval arithmatic? Thanks, G
[web2py] Re: Link calling function w/results in modal popup?
Maybe http://labs.blouweb.com/PowerGrid/default/gridinpopup or http://powertable.blouweb.com/category. On Wednesday, August 24, 2011 12:03:31 PM UTC-4, Aaron Mahler wrote: Hello! I'm curious to get some recommendations on how best to approach this - possibly using the Minimal Modal plugin, but I'm open to whatever other methods might achieve it. I have a table of results being displayed. There is a field in each row that contains information which I don't want visible in the actual table. I'd like a reveal link/button in that field of each row to pop up a modal window with the information which can then be dismissed. I don't want this information to be embedded within the page source itself, so the reveal link needs to be creating the modal popup and calling a function/URL that returns the info to be shown. Any pointers and/or code examples that might help me achieve this in a sane manner? :) Thanks! - Aaron
[web2py] Re: How to use SQLFORM.grid
I think you want: def journal_grid(): query = db.akb_journal.publisher == db.akb_publisher.uuid fields = [db.akb_journal.title,db.akb_journal.standard_name, db.akb_journal.issn, db.akb_journal.abbrev_iso, db.akb_publisher.publisher, db.akb_journal.subject] form = SQLFORM.grid(query, fields, deletable= False) return dict(form = form) or def journal_grid(): form = SQLFORM.smartgrid(db.akb_journal, deletable= False) return dict(form = form) On Aug 24, 9:09 am, Johann Spies johann.sp...@gmail.com wrote: The following is not working. What is the syntax suppose to be? def journal_grid(): query = db.akb_journal.publisher == db.akb_publisher.uuid fields = [db.akb_journal.title,db.akb_journal.standard_name, db.akb_journal.issn, db.akb_journal.abbrev_iso, db.akb_publisher.publisher, db.akb_journal.subject] form = SQLFORM.grid(db.akb_journal,query, fields, deletable= False) return dict(form = form) Errors: query is not iterable and the field list does not have a table-object. Regards Johann -- May grace and peace be yours in abundance through the full knowledge of God and of Jesus our Lord! His divine power has given us everything we need for life and godliness through the full knowledge of the one who called us by his own glory and excellence. 2 Pet. 1:2b,3a
[web2py] Re: web2py hosting
fluxflex.com On Jul 7, 8:50 am, stargate kyoukh...@gmail.com wrote: For hosting I would usehttps://www.dotcloud.com/But only for big projects. On Jul 1, 1:17 pm, DenesL denes1...@yahoo.ca wrote: Information collected from actual users of the service. Comments can belong to several people, and can be positive (+), negative (-) or other (~). This post will be updated periodically. Hosting company: Webfaction Type of service: latest web2py version: Python version: 2.4/3.2 OS version: Linux 2.6.18 Aprox. cost: 8 dollars/month (depends on plan) Geo location: USA + great control panel, great support, feature rich, many auxiliary services available. + I am very happy with them. - Personally, my experience with webfaction WAS NOT GOOD. My web2py websites, often were slow or down. - recently changed my 20 web2py apps from webfaction. ~ is very nice if you have only one low traffic website. + I have a webfaction account with around 3-4 apps at the cheapest plan which is really low and it works very well. Until now, a great experience with them, almost 2 years. Hosting company: vps.net Type of service: vps web2py version: they provide ubuntu images, I install web2py myself Python version: depends on the ubuntu image OS version: ubuntu Aprox. cost: $20/month + $5/month for backups Geo location: USA + England Hosting company: IPage Type of service: web2py version: web2py (with CGI) Python version: OS version: Aprox. cost: Geo location: - very poor technical support, VERY slow, I would not recommend it ! Hosting company: linode.com Type of service: web2py version: Python version: OS version: Aprox. cost: $19 512RAM Geo location: + In 10 minutes you have a web2py app running on Linode with Uwsgi and Nginx, just need to use the script that comes with web2py as a stack script on Linode. Hosting company: alwaysdata.com Type of service: free web2py version: Python version: 2.6 OS version: Aprox. cost: 9 euros/mo alwaysdata.com/plans/shared Geo location: servers are located in France ~ ssh, phpmyadmin Other hosting companies from web2py powered sites: 123-reg.co.uk amazonaws.com dreamhost.com GAE gandi.net godaddy.com jiffybox.de prgmr.com slicehost.net
Re: [web2py] Re: Mobile detector
Well, the reason is_mobile is in the base object is for polymorphism to work. If we later did do a WindowsMobile(Dist): class, we can easily set is_mobile = True in it, since Dist is a subclass of the DetectorBase. I just left is_mobile attached to the response even if it's not mobile because it makes it easier to test. Someone may test by trying if ua.is_mobile == False. So if is_mobile doesn't exist, it equals None and the test will fail. The routine runs pretty quickly. The thing that takes the longest is string searching.
[web2py] web2py on fluxflex (free hosting) VIDEO/HOWTO
So far this is the best web2py deployment experience. This is how it should work on every web hosting provider: http://vimeo.com/28112026
Re: [web2py] web2py on fluxflex (free hosting) VIDEO/HOWTO
Thanks! 2011/8/24 Massimo Di Pierro massimo.dipie...@gmail.com So far this is the best web2py deployment experience. This is how it should work on every web hosting provider: http://vimeo.com/28112026 -- * Sebastian Batalla.- http://www.linkedin.com/in/sbatalla*
[web2py] Re: Problems running a module in web2py shell
try print db.tables On Aug 24, 10:55 am, Eric Scott erictransla...@gmail.com wrote: I'm having trouble running a module in the web2py shell. It's having difficulty with a db query that I execute with no problems in any controller. Here's the traceback: Traceback (most recent call last): File console, line 1, in module File /home/www-data/web2py/gluon/custom_import.py, line 280, in __call__ fromlist, level) File /home/www-data/web2py/gluon/custom_import.py, line 74, in __call__ level) File applications/baristacode/modules/real_addcard.py, line 37, in module rows = db(db.card.number==cardnum).select() File /home/www-data/web2py/gluon/dal.py, line 4331, in __getattr__ return self[key] File /home/www-data/web2py/gluon/dal.py, line 4325, in __getitem__ return dict.__getitem__(self, str(key)) KeyError: 'card' I use python web2py.py -S app -M and I always check to be sure the db is available in the shell, as well as the models. I'm also able to execute the query by itself in the shell, but when it's in a module, I get the KeyError above. I've tried importing the module and using execfile, and in both cases the script runs fine until the first db query. Any hints or suggestions? Thank you, Eric
[web2py] Re: Link calling function w/results in modal popup?
Just to be sure I'm not missing a far simpler approach here... is there a way with the Minimal Modal plugin to assign the results of a function call to its content argument? - Aaron On Aug 24, 12:11 pm, Aaron Mahler amah...@sbc.edu wrote: That first example looks very close. Let me study that one a bit... Thanks! - Aaron On Aug 24, 12:08 pm, Anthony abasta...@gmail.com wrote: Maybehttp://labs.blouweb.com/PowerGrid/default/gridinpopuporhttp://powerta On Wednesday, August 24, 2011 12:03:31 PM UTC-4, Aaron Mahler wrote: Hello! I'm curious to get some recommendations on how best to approach this - possibly using the Minimal Modal plugin, but I'm open to whatever other methods might achieve it. I have a table of results being displayed. There is a field in each row that contains information which I don't want visible in the actual table. I'd like a reveal link/button in that field of each row to pop up a modal window with the information which can then be dismissed. I don't want this information to be embedded within the page source itself, so the reveal link needs to be creating the modal popup and calling a function/URL that returns the info to be shown. Any pointers and/or code examples that might help me achieve this in a sane manner? :) Thanks! - Aaron
[web2py] Re: Allowing provisional login with email only
Pbreit I do not think that fake logging in with others email is a risk as all they will see is the cart that has not been checked out. Anthony and villas, thanks for your feedback. Maybe you are right that email in session is good enough. I will have to index all orders on index instead of auth.user.id. Peter On Aug 24, 3:10 pm, villas villa...@gmail.com wrote: Just set a cookie for the email address until you can trust it?
[web2py] Re: Allowing provisional login with email only
On Wednesday, August 24, 2011 1:41:22 PM UTC-4, peter wrote: Pbreit I do not think that fake logging in with others email is a risk as all they will see is the cart that has not been checked out. Some people may consider it a violation of their privacy if you expose their shopping cart contents to the public. Anthony
Re: [web2py] Re: Dynamically created png in HTML
Richard, Anthony, You have sent me in the right direction; it works :) Richard Op 24-8-2011 18:09, Richard Vézina schreef: Try this : URL('static','SUBFOLDER/FILENAME') Richard On Wed, Aug 24, 2011 at 11:55 AM, Richard Dijkstra richard.dijks...@planet.nl mailto:richard.dijks...@planet.nl wrote: Anthony, Richard, Thank you for the feedback. Getting the png file from the static area could be done, and how do I get the dynamically create file in that static area? What would the output path be in : grdevices.png(file=/tmp/rweb2output.png , width=512, height=512) Richard Op 24-8-2011 16:37, Anthony schreef: On Wednesday, August 24, 2011 8:29:11 AM UTC-4, Richard wrote: p Here is the R output via a tmp png file object src=/tmp/rweb2output.png obj text /OBJECT /p Since src is a relative url, it will end up being http://127.0.0.1:8000/tmp/rweb2output.png (assuming you're running on your local machine on the default port). Instead, put the file inside your application's 'static' folder (you can create a 'tmp' subfolder in there), and use src={{=URL('static','tmp/rweb2output.png')}}. Also, use an img tag instead of object. Anthony Interne Virusdatabase is verouderd. Gecontroleerd door AVG -www.avg.com http://www.avg.com Versie: 9.0.872 / Virusdatabase: 271.1.1/3830 - datum van uitgifte: 08/12/11 20:34:00 Interne Virusdatabase is verouderd. Gecontroleerd door AVG - www.avg.com Versie: 9.0.872 / Virusdatabase: 271.1.1/3830 - datum van uitgifte: 08/12/11 20:34:00
[web2py] Re: update=request.now not working
Aha! This was driving me crazy yesterday! Thanks for looking into the issue. Jim On Aug 23, 8:21 pm, Massimo Di Pierro massimo.dipie...@gmail.com wrote: oops...fixed in trunk. Please check it. On Aug 23, 7:31 pm, pbreit pbreitenb...@gmail.com wrote: I believe this change is responsible:http://code.google.com/p/web2py/source/detail?r=8b75dd7c4554c3fd1e5f7...
[web2py] Re: Link calling function w/results in modal popup?
If you want to use the Minimal Modal plugin, it looks like you can specify a URL as the 'callback' argument to PluginMModal(), though you'll also have to specify the 'id' argument to identify the modal div for the callback. Anthony On Wednesday, August 24, 2011 1:12:40 PM UTC-4, Aaron Mahler wrote: Just to be sure I'm not missing a far simpler approach here... is there a way with the Minimal Modal plugin to assign the results of a function call to its content argument? - Aaron On Aug 24, 12:11 pm, Aaron Mahler ama...@sbc.edu wrote: That first example looks very close. Let me study that one a bit... Thanks! - Aaron On Aug 24, 12:08 pm, Anthony abas...@gmail.com wrote: Maybehttp:// labs.blouweb.com/PowerGrid/default/gridinpopuporhttp://powerta On Wednesday, August 24, 2011 12:03:31 PM UTC-4, Aaron Mahler wrote: Hello! I'm curious to get some recommendations on how best to approach this - possibly using the Minimal Modal plugin, but I'm open to whatever other methods might achieve it. I have a table of results being displayed. There is a field in each row that contains information which I don't want visible in the actual table. I'd like a reveal link/button in that field of each row to pop up a modal window with the information which can then be dismissed. I don't want this information to be embedded within the page source itself, so the reveal link needs to be creating the modal popup and calling a function/URL that returns the info to be shown. Any pointers and/or code examples that might help me achieve this in a sane manner? :) Thanks! - Aaron
Re: [web2py] Re: fluxflex
I merged get_new_stable branch into master branch. 2011/8/24 Yota Ichino www.i...@gmail.com: Iceberg, Massimo Di Pierro, Your idea is great. These influence me and I rewrite .flx file. It is created on same github project with branch get_new_stable. https://github.com/nus/web2py-for-fluxflex/tree/get_new_stable We can import this branch by using Github import menu. The branch doing: 1. get new stable file from web2py.com. 2. unzip 3. deploying This idea's strong point: - User can get new stable file everytime. Iceberg, How to write .flx file is in http://jp.doc.fluxflex.com/ and other library code. 2011/8/23 Massimo Di Pierro massimo.dipie...@gmail.com: I think there should be a recommended way to created branded versions of web2py. I would recommend: - getting the latest official stable - unzip - add your own init app, with landing branded page etc, linking admin. - have a standard mechanism to add a brand logo to admin as well - rezip and distribute we could create a hook (div) for the admin logo, a sample branded init, and a script to create this. Massimo On Aug 22, 2:24 am, Iceberg iceb...@21cn.com wrote: Omi Chiba, Thanks VERY MUCH for your effort on building the web2py installation package (a.k.a. library on fluxflex). Deploying web2py on a hosting server has never been so easy! (I start crying for the hours I spent in setting up my first web2py instance on my previous hosting provider.) One thing though. Your web2py library is a forked (and tailored) version of official web2py 1.98.2. This way it will soon be outdated when web2py trunk grows into 1.99, 1.100, etc.. So I see the only practical way is: 1. modify your .flx file (in order to get rid of the public_html directory, shall we?) 2. and commit it into the trunk. 3. and then someone of us (if not Massimo) maintain an identical clone (rather than a fork) of web2py on github, until fluxflex will support google code as app backend someday. (Will they?) Later we will figure out a way to upload (perhaps download too?) each web2py app, one by one. By the way, how did you find out how to write the .flx file? I did not see any documentation section on fluxflex site. Hope to know more so that we can tweak more. Regards, Ray On Aug 21, 8:37 pm, Omi Chiba ochib...@gmail.com wrote: Ichino who is a member of web2py Japan created a library on fluxflex and it works great ! http://www.fluxflex.com/library/47 1. Sign up fluxflex 2. Create new project (e.g. ochiba) 3. Install the library (It will be done in one second!) 4. Access to your project with HTTPS not HTTP (e.g.https://ochiba.fluxflex.com) 5. Access Administrative Interface with /admin (e.g.https://ochiba.fluxflex.com/admin ) 5. Admin password is the same as your MySQL database on fluxflex project. Enjoy :)
[web2py] Understanding Rocket Threads
Hi, First a little background: My application involves displaying and auto- refreshing data both in the form of text from .load components and dynamically generated images. I use JavaScript setInterval calls so that ideally the refreshes should occur some time after the last refresh completes. As it turns out, this does not work for the images because using jQuery to update the .attr with the new img src returns immediately, not after the image is loaded. Anyway, the amount of time required to generate these images and text data can be somewhat random, so I'm finding that my site will work for a while, but eventually the long duration requests will pile up and the site becomes unresponsive. Interestingly, the admin interface is still as responsive as usual. I also notice that killing web2py will not cause a clean exit, there will still be a thread working furiously on the queued requests. Thus it looks like rocket is using only one thread for the requests on the main page, while the other threads sit idle and ready to service other pages e.g. the admin interface. I tried to look through the code of rocket.py to decide if this is indeed the case, but I wasn't able to conclude one way or another. Since the admin interface is still responsive, this does not appear to be an issue of the global interpreter lock. I found that starting many web2py servers on different ports, and then directing the refresh calls to use a dedicated server for each data source alleviated the problem somewhat, further suggesting to me that only one thread is being used per session/browser/whatever to call it. I expect to have no more than 2 users at a time for my application, so I was hoping Rocket would be sufficient for this application. Would I have better luck with apache or the like? I appreciate any advice on the matter. The code I'm using in the view to refresh the data is listed below Thank you for the help, G View: --- default/index.html div id=test3{{=LOAD('default','calc3.load')}}/div img id=test2 src={{=URL('default','calc2.png')}}/img img id=test1 src={{=URL('default','calc1.png')}}/img script jQuery(window).load(function() {setCalc1Timeout();setCalc2Timeout();setCalc3Timeout()}); function updateCalc3() { jQuery('#test3').load('{{=URL(default,calc3.load)}}',setCalc3Timeout); } function setCalc3Timeout() { setTimeout(updateCalc3, 2000); } function setCalc2Timeout() { setTimeout(updateCalc2,5000); } function updateCalc2() { d = new Date(); jQuery('#test2').attr('src',calc2.png+?+d.getTime()); setCalc2Timeout(); } function setCalc1Timeout() { setTimeout(updateCalc1,5000); } function updateCalc1() { d = new Date(); jQuery('#test1').attr('src',calc1.png+?+d.getTime()); setCalc1Timeout(); } /script
[web2py] Re: Understanding Rocket Threads
I should also mention I'm open to other suggestions to alleviate this problem. The end goal is to display information (text or image) then request an update, and when it's ready, display the new text/ information. G On Aug 24, 11:39 am, G glenn.calt...@gmail.com wrote: Hi, First a little background: My application involves displaying and auto- refreshing data both in the form of text from .load components and dynamically generated images. I use JavaScript setInterval calls so that ideally the refreshes should occur some time after the last refresh completes. As it turns out, this does not work for the images because using jQuery to update the .attr with the new img src returns immediately, not after the image is loaded. Anyway, the amount of time required to generate these images and text data can be somewhat random, so I'm finding that my site will work for a while, but eventually the long duration requests will pile up and the site becomes unresponsive. Interestingly, the admin interface is still as responsive as usual. I also notice that killing web2py will not cause a clean exit, there will still be a thread working furiously on the queued requests. Thus it looks like rocket is using only one thread for the requests on the main page, while the other threads sit idle and ready to service other pages e.g. the admin interface. I tried to look through the code of rocket.py to decide if this is indeed the case, but I wasn't able to conclude one way or another. Since the admin interface is still responsive, this does not appear to be an issue of the global interpreter lock. I found that starting many web2py servers on different ports, and then directing the refresh calls to use a dedicated server for each data source alleviated the problem somewhat, further suggesting to me that only one thread is being used per session/browser/whatever to call it. I expect to have no more than 2 users at a time for my application, so I was hoping Rocket would be sufficient for this application. Would I have better luck with apache or the like? I appreciate any advice on the matter. The code I'm using in the view to refresh the data is listed below Thank you for the help, G View: --- default/index.html div id=test3{{=LOAD('default','calc3.load')}}/div img id=test2 src={{=URL('default','calc2.png')}}/img img id=test1 src={{=URL('default','calc1.png')}}/img script jQuery(window).load(function() {setCalc1Timeout();setCalc2Timeout();setCalc3Timeout()}); function updateCalc3() { jQuery('#test3').load('{{=URL(default,calc3.load)}}',setCalc3Timeout); } function setCalc3Timeout() { setTimeout(updateCalc3, 2000); } function setCalc2Timeout() { setTimeout(updateCalc2,5000); } function updateCalc2() { d = new Date(); jQuery('#test2').attr('src',calc2.png+?+d.getTime()); setCalc2Timeout(); } function setCalc1Timeout() { setTimeout(updateCalc1,5000); } function updateCalc1() { d = new Date(); jQuery('#test1').attr('src',calc1.png+?+d.getTime()); setCalc1Timeout(); } /script
[web2py] socialdevcampchicago.com
DePaul University is the premiere sponsor for SocialDevCamp (http:// 2011.socialdevcampchicago.com/), which is this weekend. If you would like to attend, you can register at http://sdcchi2011.eventbrite.com/ I will be there on Friday
[web2py] cache.ram represent lambda problem with None or empty field
Hello, I try to cache.ram a lambda represent function like Massimo suggest in this post : http://www.mail-archive.com/web2py@googlegroups.com/msg52736.html My problem is that there record where the field to be represent is empty... I was using the and/or trick before like this that was working ok : db.table1.create_by.represent=\ lambda value: (value!=None and %(initials)s %db.auth_user[value]) or 'None' But now, I want to speed my app a bit with cache.ram... This work great as long as the field have been filled : represent=lambda id: cache.ram('%id' %id, lambda:db.auth_user(id).initials, 3600) I try many different things, like : represent=lambda id: cache.ram((id!=None and '%id' %id, lambda:db.auth_user(id).initials) or 'None', 3600) # NOT WORKING CAUSE : TypeError: 'int' object is not callable represent=lambda id: cache.ram('%id' %id, lambda:db.auth_user(id).initials if id!=None else 'None', 3600) # NOT WORKING CAUSE : TypeError: %d format: a number is required, not NoneType Also try with function... Any idea... Thanks Richard