[web2py] [OT] Ubuntu 12.10 will no longer ship with Python 2
Well...for starters, web2py, fabric and pil are 2.7. So, yes, I think it is an absolutely, insanely user-hostile decision. The python ecosystem is not even close to ready to move to 3. And from what I can tell, 3 offers minimal benefits. --
[web2py] Best Method to implement a "like" button
Check out: http://web2py.com/books/default/chapter/29/11#Voting-and-rating --
web2py@googlegroups.com
Hello web2py users ... I am going out of my mind with this ! I am trying to cook up a widget ... ( or a plugin ) inspired from the SELECT_OR_ADD_OPTION widget ! but it uses radio buttons instead of a dropdown select menu, it is about selecting a profile picture among a number of pics shown and defined and where the user has the alternative option to ADD ( or upload his own pic ( by uploading that picture from his computer hard drive for example ) and have it shown in the same view without refreshing the page with its related radio button selected to choose the newly uploaded picture from the pack and affect the field of the form ( table ) upon submit ! How can I succeed in tweaking the SELECT_OR_ADD_OPTION widget and mixing it with the js scripts proposed here : http://blueimp.github.com/jQuery-File-Upload/ Please advise, any assistance with this matter will be greatly appreciated ! I am going out of my mind with this ! .. nothing works ! ... this shows me I got so much to learn .. any suggestion anyone ! PS. I used the IS_IN_SET instead of IS_IN_DB, and I defined the image set like this : default_pics = { 1:IMG(_src=URL('static','images/picture1.png')), 2:IMG(_src=URL('static','images/picture2.png')), 3:IMG(_src=URL('static','images/picture3.png')), 4: . } The images are showing up ... but the rest just cannot work out !! ... any suggestions any one ? ... That would be a nice widget to have around ! --
Re: [web2py] Re: Sorting ajax return
Thanks for the replies guys. select().as_list() did the job for me. Luckily I don't have belongs in the query. On Mon, Sep 10, 2012 at 10:01 AM, Marek Mollin wrote: > bear in mind if you have belongs in query(rdbms optimizes ids when using > belongs), you might have to sort manualy via python builtin sorted (which > can sort all iterables) > > W dniu niedziela, 9 września 2012 17:55:26 UTC+2 użytkownik Anthony > napisał: > >> Do you have to use .as_dict()? Instead, you could use .as_list(), and >> you'll get a list of dictionaries instead of a dictionary of dictionaries. >> The list will retain the order of the original select (presumably you could >> use "orderby" to have the database return the records in the order you >> want). >> >> Anthony >> >> On Sunday, September 9, 2012 10:42:32 AM UTC-4, dundee wrote: >>> >>> >>> Hi all, >>> >>> I have an ajax call to some values and I use the ...select().as_dict in >>> my controller so that I can return a dict to process the results in my view. >>> Now I realize that I need these values to be sorted. As a dict >>> (..select().as_dict) is not ordered, how can this be accomplished? >>> >>> Once I needed something like this but I used the Collections module and >>> the OrderedDict, but this is different. >>> >>> I need some opinions on the best approach for this. >>> >>> >>> Thanks. >>> >>> >>> Regards >>> >>> Kevin >>> >> -- > > > > -- Kevin Miller Acting Data Controller Department of Computing UWI, Mona Kingston 7 --
[web2py] Re: SOAP XML Return Objects
Thanks! This helps a lot. On Tuesday, September 11, 2012 9:35:55 AM UTC+8, howesc wrote: > > in the controllers directory, create a file say 'mysoapservice.py'. > include something like: > def soapfunction(): > retval = {} > retval['tradeNo'] = 27 > retval['volume'] = 10 > retval['descr'] = 'this is a test' > #add stuff to the dict here > return retval > > then make sure in the views directory you have a folder called > 'mysoapservice' that contains a file called 'soapfunction.xxx' where 'xxx' > is replaced with the extension that is on the URL called by the requester. > say the request is for /app/mysoapservice/soapfunction.xml then your view > file would be named 'soapfunction.xml'. see the book for ways to override > this default behavior. > > the view file would look like: > > > {{=tradeNo}} > {{=volume}} > {{=descr}} > > > > > > > > > > > On Monday, September 10, 2012 5:17:07 PM UTC-7, devrunner wrote: >> >> Hi cfh. thanks. I'm fairly new to web2py and python, can you provide a >> sample code for me to start with. I really appreciate your reply. >> >> On Tuesday, September 11, 2012 7:17:09 AM UTC+8, howesc wrote: >>> >>> you can make a "view" that formats the output however you likeso >>> when your controller method is called it returns a dict that is then >>> rendered by your custom view. >>> >>> does that make sense? does that help you? >>> >>> cfh >>> >>> On Monday, September 10, 2012 12:31:46 AM UTC-7, devrunner wrote: I wanted to return an xml similar to this : using a SOAP WebService. The example i'm seeing is just for primitive datatypes, I wanted to have a user defined object. Is this possible? Thanks. --
[web2py] Re: SOAP XML Return Objects
in the controllers directory, create a file say 'mysoapservice.py'. include something like: def soapfunction(): retval = {} retval['tradeNo'] = 27 retval['volume'] = 10 retval['descr'] = 'this is a test' #add stuff to the dict here return retval then make sure in the views directory you have a folder called 'mysoapservice' that contains a file called 'soapfunction.xxx' where 'xxx' is replaced with the extension that is on the URL called by the requester. say the request is for /app/mysoapservice/soapfunction.xml then your view file would be named 'soapfunction.xml'. see the book for ways to override this default behavior. the view file would look like: {{=tradeNo}} {{=volume}} {{=descr}} On Monday, September 10, 2012 5:17:07 PM UTC-7, devrunner wrote: > > Hi cfh. thanks. I'm fairly new to web2py and python, can you provide a > sample code for me to start with. I really appreciate your reply. > > On Tuesday, September 11, 2012 7:17:09 AM UTC+8, howesc wrote: >> >> you can make a "view" that formats the output however you likeso when >> your controller method is called it returns a dict that is then rendered by >> your custom view. >> >> does that make sense? does that help you? >> >> cfh >> >> On Monday, September 10, 2012 12:31:46 AM UTC-7, devrunner wrote: >>> >>> I wanted to return an xml similar to this : >>> >>> >>> >>> >>> >>> >>> >>> using a SOAP WebService. The example i'm seeing is just for primitive >>> datatypes, I wanted to have a user defined object. Is this possible? Thanks. >>> >>> --
[web2py] Re: SOAP XML Return Objects
Hi cfh. thanks. I'm fairly new to web2py and python, can you provide a sample code for me to start with. I really appreciate your reply. On Tuesday, September 11, 2012 7:17:09 AM UTC+8, howesc wrote: > > you can make a "view" that formats the output however you likeso when > your controller method is called it returns a dict that is then rendered by > your custom view. > > does that make sense? does that help you? > > cfh > > On Monday, September 10, 2012 12:31:46 AM UTC-7, devrunner wrote: >> >> I wanted to return an xml similar to this : >> >> >> >> >> >> >> >> using a SOAP WebService. The example i'm seeing is just for primitive >> datatypes, I wanted to have a user defined object. Is this possible? Thanks. >> >> --
[web2py] Re: Trying to reproduce Ex. in manual, sec. 6.21.1 (inner joins)
Anyway, I changed the code in trunk so that the example in the book works as described. On Monday, 10 September 2012 17:27:01 UTC-5, Massimo Di Pierro wrote: > > There is a mistake in the book. It should have been: > > rows = db(db.person).select(db.person.ALL, db.dog.ALL, join=db.dog.on( > db.person.id==db.dog.owner)) > > or > > rows = db(db.person).select(db.person.ALL, db.dog.ALL, left=db.dog.on( > db.person.id==db.dog.owner)) > > Perhaps is should default to select all fields as he book suggests. I will > look into this. Please open a ticket with a suggestion for enhancement. > > On Monday, September 10, 2012 4:58:25 PM UTC-5, MichaelF wrote: >> >> I have a db structure similar to the person/dog tables in section "6.21 >> One to many relation." I try the inner join (second form, from the book): >> >> 1 >>> rows = db(db.person).select(join=db.dog.on(db.person.id >> ==db.dog.owner)) >> 2 >>> for row in rows: >> 3 print row.person.name, 'has', row.dog.name >> 4 Alex has Skipper >> 5 Alex has Snoopy >> 6 Bob has Puppy >> >> In my db the 'person' table is 'Meet', and 'dog' is 'Session'. Here's >> what I used: >> >> meetAndSession = db(db.Meet).select(join=db.Session.on(db.Meet.id == >> db.Session.Meet)) >> >> I get back the 'person' ('Meet') fields, but not the 'dog' ('Session') >> fields. For the Meet.Session field I get back a Set object. Should I be >> using that as the set of Session records associated with the Meet record. >> (I tried to reference row.Meet.Session.id, but got told there was no >> such field. I also tried row.Session.id and got told the same thing.) As >> the example shows row.dog.name, shouldn't I have a >> row.Session.? >> >> Here's what "db stats" tells me it used: >> >> SELECT Meet.id, Meet.Meet_name, Meet.Start_date, Meet.End_date, >> Meet.Is_championship FROM Meet JOIN Session ON (Meet.id = Session.Meet) >> WHERE (Meet.id > 0); >> >> >> Given that, of course I'm getting no 'dog' ('Session') fields. What am I >> missing? >> >> >> Thanks. >> >> --
[web2py] Re: SOAP XML Return Objects
you can make a "view" that formats the output however you likeso when your controller method is called it returns a dict that is then rendered by your custom view. does that make sense? does that help you? cfh On Monday, September 10, 2012 12:31:46 AM UTC-7, devrunner wrote: > > I wanted to return an xml similar to this : > > > > > > > > using a SOAP WebService. The example i'm seeing is just for primitive > datatypes, I wanted to have a user defined object. Is this possible? Thanks. > > --
[web2py] Re: Deploying as RPM
For an update here. I was able to go with two very simple spec files since I use puppet for the cron jobs, apache config files, etc and I simply made two RPMs, one of stock web2py and one of my application with my app listing web2py as a dependency. What you're discussing, LightDot, sounds interesting. -- #-- # P A C K A G E I N F O #-- Name: sap2py Version: 1.0 Release: 1 Summary: Usage reports License: LGPLv3 Group:System Environment/Daemons BuildArch: noarch Source0: web2py-%{version}.tar.gz Buildroot: %{_tmppath}/web2py %description (description) #-- # B U I L D #-- %prep %setup -q %build #-- # I N S T A L L F I L E S #-- %install [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT mkdir -p -m 755 /opt/sap/www/ cp -r web2py /opt/sap/www/
[web2py] Best Method to implement a "like" button
I have 3 datatables as follows: db.define_table('songs', Field('songname'), format='%(songname)s') db.define_table('likes', Field('username', 'reference auth_user'), Field('songname', 'reference songs')) with the 3rd table being db.auth_user I would like to implement a "like" button, where clicking it adds an entry to the intermediate table 'likes'. For example, if User1 likes Song1, it would perform the following: db.likes.insert(username=auth.user.id, songname=1) Right now I have the like button as the following in the view: {{=A('like me', callback=URL('add_like'))}} and the function as: def add_like(): db.likes.insert(username=auth.user.id, songname=1) The problem I'm having is that a user should only be allowed to 'like' a song once; if the user has already liked the song, clicking on 'like' again should remove that like. Basically a toggle functionality for the 'like' button. I'm not sure how to implement the last part, as it seems checking the entire database for the existence of that record on every 'like' click is overkill. Is there an eloquent way (minimal database calls) to go about implementing this toggle functionality for a 'like' button? --
[web2py] Re: Just knew about Server-Sent Events and want to share it with you
Hey thanks ! That's something nice to have around, i prefer to hack+grow on some example than start from zero. Anyway i guess that some two-way json-rpc could be implemented on top of SSE to make realtime streaming apps a breeze. As opposed to the complication of deployment that are websockets. Ciao. Segunda-feira, 10 de Setembro de 2012 17:07:19 UTC+1, Paolo Caruccio escreveu: > > Some time ago I converted the example of html5rocks ( > http://googlecodesamples.com/html5/sse/sse.html) in a simple web2py app. > Please pay attention it's a toy app and so check for errors and security > holes before use the code in production. > > I reused the code for a message system between server and client to > communicate database tables change. > > After you Installed the app, access > http://localhost:8000/SSE_clock/default/sse to view the clock example > > > Il giorno domenica 9 settembre 2012 12:00:53 UTC+2, smoggy ha scritto: >> >> Stream Updates with Server-Sent Events: >> >> Are like websockets but unidirectional, from the server to the client. >> Most modern browsers support it. >> >> It can be combined with XmlHttpRequest / ajax if the client needs to >> send events to the server, i.e. "emulate" websockets. >> >> From https://github.com/rwldrn/jquery.eventsource: >> "Q. why use EventSource rather than Websockets? >> A. EventSource is easier to setup on server (uses http), lighter and >> most of the times - that's what you acually need. (via temp01)" >> >> Other resources: >> >> Discussions: >> http://www.html5rocks.com/en/tutorials/eventsource/basics/ >> >> http://www.prodigyproductionsllc.com/articles/programming/javascript/avoid-using-eventsource-server-sent-events/ >> >> >> A JS library: https://github.com/Yaffle/EventSource >> Implemetation on python2/3: https://github.com/niwibe/sse.git >> DJango implementation: https://github.com/niwibe/django-sse.git >> > --
[web2py] Re: Trying to reproduce Ex. in manual, sec. 6.21.1 (inner joins)
There is a mistake in the book. It should have been: rows = db(db.person).select(db.person.ALL, db.dog.ALL, join=db.dog.on( db.person.id==db.dog.owner)) or rows = db(db.person).select(db.person.ALL, db.dog.ALL, left=db.dog.on( db.person.id==db.dog.owner)) Perhaps is should default to select all fields as he book suggests. I will look into this. Please open a ticket with a suggestion for enhancement. On Monday, September 10, 2012 4:58:25 PM UTC-5, MichaelF wrote: > > I have a db structure similar to the person/dog tables in section "6.21 > One to many relation." I try the inner join (second form, from the book): > > 1 >>> rows = db(db.person).select(join=db.dog.on(db.person.id > ==db.dog.owner)) > 2 >>> for row in rows: > 3 print row.person.name, 'has', row.dog.name > 4 Alex has Skipper > 5 Alex has Snoopy > 6 Bob has Puppy > > In my db the 'person' table is 'Meet', and 'dog' is 'Session'. Here's what > I used: > > meetAndSession = db(db.Meet).select(join=db.Session.on(db.Meet.id == > db.Session.Meet)) > > I get back the 'person' ('Meet') fields, but not the 'dog' ('Session') > fields. For the Meet.Session field I get back a Set object. Should I be > using that as the set of Session records associated with the Meet record. > (I tried to reference row.Meet.Session.id, but got told there was no such > field. I also tried row.Session.id and got told the same thing.) As the > example shows row.dog.name, shouldn't I have a row.Session.? > > Here's what "db stats" tells me it used: > > SELECT Meet.id, Meet.Meet_name, Meet.Start_date, Meet.End_date, > Meet.Is_championship FROM Meet JOIN Session ON (Meet.id = Session.Meet) WHERE > (Meet.id > 0); > > > Given that, of course I'm getting no 'dog' ('Session') fields. What am I > missing? > > > Thanks. > > --
Re: [web2py] Re: Lazy Tables and Cached Results on GAE
Actually I was wrong. If you update a record it does not update the cached ones. On Monday, September 10, 2012 11:29:02 AM UTC-5, Felipe Meirelles wrote: > > Oh, thats nice, all just works the way I use to work with GAE cache. > > Great work Massimo, hope I can start to contribute soon. > > Thank you. > > On Mon, Sep 10, 2012 at 1:08 PM, Massimo Di Pierro > > > wrote: > >> You cannot invalidate a single row if you are caching the all set of rows. >> >> Mind that if you do rows.update_records(...) and rows is cached, it >> should update the cached row as well. >> >> >> On Monday, 10 September 2012 08:16:07 UTC-5, Felipe Meirelles wrote: >> >>> But it will invalidate all the cache data. I want to invalidate just one >>> row cache, is this possible? >>> >>> On Mon, Sep 10, 2012 at 10:14 AM, Massimo Di Pierro < >>> massimo@gmail.com> wrote: >>> If you use cache.ram or cache.disk you can do cache.ram.clear() cache.disk.clear() this will clear all ram. You can also pass a regex to clear to clear only some keys. On Monday, 10 September 2012 07:49:27 UTC-5, Felipe Meirelles wrote: > > Only one more question, can I enforce the cache to invalidate (as when > I know the record has changed) or update the select cache manulay? > > On Monday, September 10, 2012 9:44:18 AM UTC-3, Massimo Di Pierro > wrote: >> >> 2.0.8 is known to work fine on GAE. >> >> On Monday, 10 September 2012 07:05:11 UTC-5, Felipe Meirelles wrote: >>> >>> Anyone tested the new 2.0.2 changes on GAE? Should this work fine? >>> >>> Can someone tell me how the internals work for this two features and >>> how to use it? >>> >>> Thanks. >>> >> -- >>> >>> >>> >>> -- >>> Att, >>> Felipe Meirelles. >>> >>> -- >> >> >> >> > > > > -- > Att, > Felipe Meirelles. > > --
[web2py] Trying to reproduce Ex. in manual, sec. 6.21.1 (inner joins)
I have a db structure similar to the person/dog tables in section "6.21 One to many relation." I try the inner join (second form, from the book): 1 >>> rows = db(db.person).select(join=db.dog.on(db.person.id==db.dog.owner)) 2 >>> for row in rows: 3 print row.person.name, 'has', row.dog.name 4 Alex has Skipper 5 Alex has Snoopy 6 Bob has Puppy In my db the 'person' table is 'Meet', and 'dog' is 'Session'. Here's what I used: meetAndSession = db(db.Meet).select(join=db.Session.on(db.Meet.id == db.Session.Meet)) I get back the 'person' ('Meet') fields, but not the 'dog' ('Session') fields. For the Meet.Session field I get back a Set object. Should I be using that as the set of Session records associated with the Meet record. (I tried to reference row.Meet.Session.id, but got told there was no such field. I also tried row.Session.id and got told the same thing.) As the example shows row.dog.name, shouldn't I have a row.Session.? Here's what "db stats" tells me it used: SELECT Meet.id, Meet.Meet_name, Meet.Start_date, Meet.End_date, Meet.Is_championship FROM Meet JOIN Session ON (Meet.id = Session.Meet) WHERE (Meet.id > 0); Given that, of course I'm getting no 'dog' ('Session') fields. What am I missing? Thanks. --
Re: [web2py] Numerical List of Entries
Maybe this could be useful http://goo.gl/g61nt On Mon, Sep 10, 2012 at 6:55 PM, AE wrote: > Hello I was wondering if anyone can tell me how I can create a numerical > list of pages to use with my pagination > > I have a db query that selects alphabetically based on the title and would > like to create a numerical index of the pages to link to. Currently I am > using web2py_utils for pagination and it displays 10 per page pagination > shouldn't matter cause it will just cycle through every entry. > > I was thinking more of how google does it in there search they display 1 2 > 3 4 5 6 up to 10 pages until you select 10 then it displays 11 12 13 etc :-) > > *cheers > > and ty for any help :-) > > > -- > > > > -- Massimiliano --
[web2py] Re: Sublime Text 2 Setup
seems to work well. thanks. On Sunday, September 9, 2012 9:53:50 PM UTC-7, luckysmack wrote: > > I have seen a few people on here mention they used sublime text. So i was > curious as if anyone was willing to share anything special they did to > setup ST to work with web2py for things like autocompletion (assuming code > intel) or other web2py hints/goodies someone might know about, such as > plugins, that help with web2py in general. Thanks. --
[web2py] Re: dropbox python api
Problem sorted by Massimo in under 12 hours. Amazing responsiveness Peter --
[web2py] Numerical List of Entries
Hello I was wondering if anyone can tell me how I can create a numerical list of pages to use with my pagination I have a db query that selects alphabetically based on the title and would like to create a numerical index of the pages to link to. Currently I am using web2py_utils for pagination and it displays 10 per page pagination shouldn't matter cause it will just cycle through every entry. I was thinking more of how google does it in there search they display 1 2 3 4 5 6 up to 10 pages until you select 10 then it displays 11 12 13 etc :-) *cheers and ty for any help :-) --
Re: [web2py] Help with python module import error
Aha! That did it. For the record, on Webfaction an application server is restarted with $HOME/webapps/app_name/apache2/bin/restart Thanks for pointing me in the right direction. I'm obviously going to have to learn a lot more about the server end of things :) But I really appreciate the help. Ian On Monday, September 10, 2012 4:26:59 PM UTC-4, rochacbruno wrote: > > If you are running on webfaction, maybe it is under apache and mod_wsgi, > so you need to restart Apache to reload the mod_wsgi. > > $service apache2 restart > > or > > $/etc/init.d/apache2 restart > > (but you need to check if it is running apache, nginx or other) > --
[web2py] Re: SQLFORM formstyle argument changes
I'm not sure it makes much difference, but I just submitted a patch to change that. Anthony On Monday, September 10, 2012 1:45:27 PM UTC-4, Jim Karsten wrote: > > The *SQLFORM formstyle* argument can change from a string to a function. > For example: > > sqlform = SQLFORM(db.mytable, formstyle='table3cols') > > Now (sqlform.formstyle == 'table3cols') returns *False*. * > sqlform.formstyle* is now a function named *formstyle_table3cols*. > > I haven't had any problems with it but is this not poor design? > --
Re: [web2py] Help with python module import error
If you are running on webfaction, maybe it is under apache and mod_wsgi, so you need to restart Apache to reload the mod_wsgi. $service apache2 restart or $/etc/init.d/apache2 restart (but you need to check if it is running apache, nginx or other) --
Re: [web2py] Help with python module import error
Hi Bruno, No, I haven't restarted. Somehow I thought that hitting "reload routes" would accomplish the same thing, but now that I think about it that wouldn't make sense. So now my really dumb question. Is restarting web2py on the server (Linux) just a matter of doing this? $killall web2py $python2.7 path_to_install/web2py.py Or will that start the rocket server? (I'm running Apache/2.2.17 (Unix) mod_wsgi/3.3 Python/2.7.3) I know, this is something I should know by now, but somehow it has never come up! The installation was done for me by Webfaction (and before that by a Fluxflex script). Ian On Monday, September 10, 2012 4:03:05 PM UTC-4, rochacbruno wrote: > > > if the package is in your Python wen2py have to see this.. > > you can try inside web2py code (i.e models) > > import sys > sys.path.append("/path/to/installed/package") > > Have you restarted web2py since you installed the module? > > On Mon, Sep 10, 2012 at 4:52 PM, monotasker > > wrote: > >> >> I'm having trouble on Webfaction with web2py not finding the pytz module, >> even though it is found fine in my local environment. I've >> already installed the module using easy_install at myname/lib/python2.7 (as >> per Webfaction instructions), and I've confirmed that I can import it from >> the python prompt (in an ssh session). I've also confirmed that web2py is >> running on python2.7. But I'm still getting an import error. Any ideas? >> >> I thought I might try putting the package in my site-packages directory, >> but I'm not exactly sure what to put there. Would I use easy_install or do >> I need to put some files there manually? >> >> Thanks, >> >> Ian >> >> >> -- >> >> >> >> > > > --
Re: [web2py] Help with python module import error
if the package is in your Python wen2py have to see this.. you can try inside web2py code (i.e models) import sys sys.path.append("/path/to/installed/package") Have you restarted web2py since you installed the module? On Mon, Sep 10, 2012 at 4:52 PM, monotasker wrote: > > I'm having trouble on Webfaction with web2py not finding the pytz module, > even though it is found fine in my local environment. I've > already installed the module using easy_install at myname/lib/python2.7 (as > per Webfaction instructions), and I've confirmed that I can import it from > the python prompt (in an ssh session). I've also confirmed that web2py is > running on python2.7. But I'm still getting an import error. Any ideas? > > I thought I might try putting the package in my site-packages directory, > but I'm not exactly sure what to put there. Would I use easy_install or do > I need to put some files there manually? > > Thanks, > > Ian > > > -- > > > > --
[web2py] Help with python module import error
I'm having trouble on Webfaction with web2py not finding the pytz module, even though it is found fine in my local environment. I've already installed the module using easy_install at myname/lib/python2.7 (as per Webfaction instructions), and I've confirmed that I can import it from the python prompt (in an ssh session). I've also confirmed that web2py is running on python2.7. But I'm still getting an import error. Any ideas? I thought I might try putting the package in my site-packages directory, but I'm not exactly sure what to put there. Would I use easy_install or do I need to put some files there manually? Thanks, Ian --
[web2py] SQLFORM formstyle argument changes
The *SQLFORM formstyle* argument can change from a string to a function. For example: sqlform = SQLFORM(db.mytable, formstyle='table3cols') Now (sqlform.formstyle == 'table3cols') returns *False*. *sqlform.formstyle*is now a function named *formstyle_table3cols*. I haven't had any problems with it but is this not poor design? --
Re: [web2py] Re: Lazy Tables and Cached Results on GAE
Oh, thats nice, all just works the way I use to work with GAE cache. Great work Massimo, hope I can start to contribute soon. Thank you. On Mon, Sep 10, 2012 at 1:08 PM, Massimo Di Pierro < massimo.dipie...@gmail.com> wrote: > You cannot invalidate a single row if you are caching the all set of rows. > > Mind that if you do rows.update_records(...) and rows is cached, it should > update the cached row as well. > > > On Monday, 10 September 2012 08:16:07 UTC-5, Felipe Meirelles wrote: > >> But it will invalidate all the cache data. I want to invalidate just one >> row cache, is this possible? >> >> On Mon, Sep 10, 2012 at 10:14 AM, Massimo Di Pierro < >> massimo@gmail.com> wrote: >> >>> If you use cache.ram or cache.disk you can do >>> >>> cache.ram.clear() >>> cache.disk.clear() >>> >>> this will clear all ram. You can also pass a regex to clear to clear >>> only some keys. >>> >>> On Monday, 10 September 2012 07:49:27 UTC-5, Felipe Meirelles wrote: Only one more question, can I enforce the cache to invalidate (as when I know the record has changed) or update the select cache manulay? On Monday, September 10, 2012 9:44:18 AM UTC-3, Massimo Di Pierro wrote: > > 2.0.8 is known to work fine on GAE. > > On Monday, 10 September 2012 07:05:11 UTC-5, Felipe Meirelles wrote: >> >> Anyone tested the new 2.0.2 changes on GAE? Should this work fine? >> >> Can someone tell me how the internals work for this two features and >> how to use it? >> >> Thanks. >> > -- >>> >>> >>> >>> >> >> >> >> -- >> Att, >> Felipe Meirelles. >> >> -- > > > > -- Att, Felipe Meirelles. --
Re: [web2py] Relocated admin using router, problem with appadmin
On 10 Sep 2012, at 9:02 AM, Marek Mollin wrote: > So i have cut down the router to bare minimum, just to check this admin issue. > I now have: > > routers = dict( > BASE = dict( > domains = { > 'myapp.com' : 'myapp1', > 'test.myapp.com' : 'myapp2', > } > ), > ) > logging = 'debug' > > after tailing the uwsgi_log i get: > > in case of https://myapp.com/admin: > Error opening file for reading: Permission denied > and afterwards a few 404. > > while https://test.myapp.com/admin: > just a few 404. > > If I turn off the domains and just set default app, everything is fine. > Admin is accessible. That is, unfortunately, the expected behavior. I've asked the other developers to comment on a couple of proposed fixes. > > > > W dniu poniedziałek, 10 września 2012 15:15:40 UTC+2 użytkownik Jonathan > Lundell napisał: > On 10 Sep 2012, at 2:17 AM, Marek Mollin wrote: >> Apparently, >> I have to domains there is no way for me to access admin. >> I get gateway timeouts. > > I'll take a look at the code later today. > >> >> W dniu poniedziałek, 10 września 2012 01:27:02 UTC+2 użytkownik Marek Mollin >> napisał: >> So if I skip the admin.app.com line domain I will get: >> test.app.com/admin >> app.com/admin >> >> all working fine? >> >> W dniu niedziela, 9 września 2012 22:01:12 UTC+2 użytkownik Jonathan Lundell >> napisał: >> On 9 Sep 2012, at 12:42 PM, Marek Mollin wrote: >>> Hello, >>> I ran into small problem. >>> I have web2py 2.08 running nginx + postgres. >>> >>> I configured routes using parametric system. >>> In routes.py I defined domains and assigned admin to seperate domain. >>> By domain i mean actually subdomains... >>> >>> test.app.com -> testing environment using seperate db >>> app.com -> official thing >>> admin.app.com -> admin for both apps and any other that may comeby >>> >>> Problem is: >>> Now I cannot access appadmin. (I have no uwsgi_log... just gateway timed >>> out and have to restart server). >> >> There's a problem with having admin in a different domain from an associated >> app, in that the URLs that cross the domains aren't specified as absolute >> URLs (that is, they don't have a domain attached to them). >> >> It might be possible to fix that in the parametric router, but noticing a) >> that the app specified in a URL() call is different from the calling app, >> and b) that the app in question is associated with a domain and/or port. But >> at present I don't think it'll work. >> >> I'm not entirely certain of all this without reviewing the code. Another >> workaround would be to treat the domain as a hint, but allow the URL to >> override it by explicitly specifying the app. And maybe that happens, but >> there's a more subtle issue... >> >> Turning on router logging might help explain what's going on. >> >>> >>> My routes.py >>> >>> routers = dict( >>> BASE = dict( >>> domains = { >>> 'myapp.com' : 'myapp', >>> 'admin.myapp.com' : 'admin', >>> 'test.myapp.com' : 'testm', >>> >>> >>> }, >>> default_application = 'myapp', >>> applications = ['myapp','admin','testm'], >>> controllers = 'DEFAULT', >>> map_static = True >>> ), >>> myapp = dict( >>> functions = dict( >>> produkty = ['index'], >>> rozmiary = ['index'], >>> polityka = ['index'], >>> ), >>> ), >>> ) >>> >>> >>> >>> >>> -- >>> >>> >>> >> >> >> >> -- >> >> >> > > > > -- > > > --
[web2py] Re: help test codemirrorw
I have integrated codemirror with zencoding. I have removed amy, editarea and ace from trunk but I will ship them separately as a zip. Reports so far indicates codemirror is much more portable than anything else. Keep testing ;-) massimo On Monday, 10 September 2012 10:23:44 UTC-5, Andrew wrote: > > The vi keybindings are pretty limited. For example you can go to end of > file with shift-g but you can't specify a line to go to. yy works in the > codemirror example but not in web2py so I'm guessing that just needs some > tweaking. > > delete line and paste seems to work ok. > > cw seems to work fine. I haven't tested exhaustively because it's not > really critical for my use but it's a nice to have. I figure stuff like > this I can always tweak or help contribute to the upstream vim support in > codemirror if it really bothers me. > > On Monday, September 10, 2012 8:41:28 AM UTC-5, LightDot wrote: >> >> In regards to which editors to drop from the future releases, how about >> this: >> >> - next web2py release ships with all 4 included, CodeMirror is the default >> - everybody will try it, so any hidden bugs or incompatibilities should >> show quickly >> - after a while (before the next web2py release), community is asked if >> anyone uses anything else besides CodeMirror now. >> >> My guess is that most of the people don't change the default editor. >> Those who perhaps do will have a chance to make a case as to why web2py >> should keep one (or more) of the other editors. If no issues arise, I'd >> vote for keeping just CodeMirror. >> >> BTW, has anyone tested the emacs and vi key bindings with CodeMIrror? >> >> The main thing that still needs attention are breaks for the debugger. >> CodeMirror can display them besides the line numbers, but I'm not that >> familiar with the way current debugger works, so I didn't try to implement >> this yet. >> >> Regards, >> Ales >> >> >> On Sunday, September 9, 2012 8:52:34 PM UTC+2, Massimo Di Pierro wrote: >>> >>> If we move to codemirror (and we should) what do we get rid of >>> (editarea, amy, ace)? We cannot ship with 4 editors. >>> >>> On Sunday, 9 September 2012 13:48:44 UTC-5, Massimo Di Pierro wrote: Please, can you send them to me? On Sunday, 9 September 2012 11:32:53 UTC-5, LightDot wrote: > > I have added the following to web2py's CodeMirror implementation: > > - line highlight (line with the cursor is highlighted) > - autofocus (focus in the editor when page is opened) > - fullscreen toggle (F11 toggles editor to fill the entire window, ESC > or repeated F11 exits to default editor size). > > All this is basically taken from the existing CodeMirror demos and > from their docs. > > Is this something that could be useful to others? I know I'd miss all > three. > > Regards, > Ales > > > On Sunday, September 9, 2012 6:26:40 AM UTC+2, Massimo Di Pierro wrote: >> >> we are considering replacing the admin editor with codemirror since >> it should work with IE. >> >> Can you please help us try it? >> >> get web2py form github and edit admin/models/0.py and set the editor >> to 'codemirror'. >> >> let us know what browser you try and your findings. >> >> Massimo >> > --
Re: [web2py] Re: Lazy Tables and Cached Results on GAE
You cannot invalidate a single row if you are caching the all set of rows. Mind that if you do rows.update_records(...) and rows is cached, it should update the cached row as well. On Monday, 10 September 2012 08:16:07 UTC-5, Felipe Meirelles wrote: > > But it will invalidate all the cache data. I want to invalidate just one > row cache, is this possible? > > On Mon, Sep 10, 2012 at 10:14 AM, Massimo Di Pierro > > > wrote: > >> If you use cache.ram or cache.disk you can do >> >> cache.ram.clear() >> cache.disk.clear() >> >> this will clear all ram. You can also pass a regex to clear to clear only >> some keys. >> >> On Monday, 10 September 2012 07:49:27 UTC-5, Felipe Meirelles wrote: >>> >>> Only one more question, can I enforce the cache to invalidate (as when I >>> know the record has changed) or update the select cache manulay? >>> >>> On Monday, September 10, 2012 9:44:18 AM UTC-3, Massimo Di Pierro wrote: 2.0.8 is known to work fine on GAE. On Monday, 10 September 2012 07:05:11 UTC-5, Felipe Meirelles wrote: > > Anyone tested the new 2.0.2 changes on GAE? Should this work fine? > > Can someone tell me how the internals work for this two features and > how to use it? > > Thanks. > -- >> >> >> >> > > > > -- > Att, > Felipe Meirelles. > > --
Re: [web2py] Relocated admin using router, problem with appadmin
So i have cut down the router to bare minimum, just to check this admin issue. I now have: routers = dict( BASE = dict( domains = { 'myapp.com' : 'myapp1', 'test.myapp.com' : 'myapp2', } ), ) logging = 'debug' after tailing the uwsgi_log i get: in case of https://myapp.com/admin: Error opening file for reading: Permission denied and afterwards a few 404. while https://test.myapp.com/admin: just a few 404. If I turn off the domains and just set default app, everything is fine. Admin is accessible. W dniu poniedziałek, 10 września 2012 15:15:40 UTC+2 użytkownik Jonathan Lundell napisał: > > On 10 Sep 2012, at 2:17 AM, Marek Mollin > > wrote: > > Apparently, > I have to domains there is no way for me to access admin. > I get gateway timeouts. > > > I'll take a look at the code later today. > > > W dniu poniedziałek, 10 września 2012 01:27:02 UTC+2 użytkownik Marek > Mollin napisał: >> >> So if I skip the admin.app.com line domain I will get: >> test.app.com/admin >> app.com/admin >> >> all working fine? >> >> W dniu niedziela, 9 września 2012 22:01:12 UTC+2 użytkownik Jonathan >> Lundell napisał: >>> >>> On 9 Sep 2012, at 12:42 PM, Marek Mollin wrote: >>> >>> Hello, >>> I ran into small problem. >>> I have web2py 2.08 running nginx + postgres. >>> >>> I configured routes using parametric system. >>> In routes.py I defined domains and assigned admin to seperate domain. >>> By domain i mean actually subdomains... >>> >>> test.app.com -> testing environment using seperate db >>> app.com -> official thing >>> admin.app.com -> admin for both apps and any other that may comeby >>> >>> Problem is: >>> Now I cannot access appadmin. (I have no uwsgi_log... just gateway timed >>> out and have to restart server). >>> >>> >>> There's a problem with having admin in a different domain from an >>> associated app, in that the URLs that cross the domains aren't specified as >>> absolute URLs (that is, they don't have a domain attached to them). >>> >>> It might be possible to fix that in the parametric router, but noticing >>> a) that the app specified in a URL() call is different from the calling >>> app, and b) that the app in question is associated with a domain and/or >>> port. But at present I don't think it'll work. >>> >>> I'm not entirely certain of all this without reviewing the code. Another >>> workaround would be to treat the domain as a hint, but allow the URL to >>> override it by explicitly specifying the app. And maybe that happens, but >>> there's a more subtle issue... >>> >>> Turning on router logging might help explain what's going on. >>> >>> >>> My routes.py >>> >>> routers = dict( >>> BASE = dict( >>> domains = { >>> 'myapp.com' : 'myapp', >>> 'admin.myapp.com' : 'admin', >>> 'test.myapp.com' : 'testm', >>> >>> >>> }, >>> default_application = 'myapp', >>> applications = ['myapp','admin','testm'], >>> controllers = 'DEFAULT', >>> map_static = True >>> ), >>> myapp = dict( >>> functions = dict( >>> produkty = ['index'], >>> rozmiary = ['index'], >>> polityka = ['index'], >>> ), >>> ), >>> ) >>> >>> >>> >>> >>> -- >>> >>> >>> >>> >>> >>> >>> > -- > > > > > > > --
Re: [web2py] Re: DB Migration (sqlite->pgsql) Problems with 1.99.7 - 2.0.6 - 2.0.7 Versions
Update: It started working as soon as I installed psycopg2. This is pg8000 issue. I am using psql 8.4.11 --
[web2py] Re: help test codemirrorw
The vi keybindings are pretty limited. For example you can go to end of file with shift-g but you can't specify a line to go to. yy works in the codemirror example but not in web2py so I'm guessing that just needs some tweaking. delete line and paste seems to work ok. cw seems to work fine. I haven't tested exhaustively because it's not really critical for my use but it's a nice to have. I figure stuff like this I can always tweak or help contribute to the upstream vim support in codemirror if it really bothers me. On Monday, September 10, 2012 8:41:28 AM UTC-5, LightDot wrote: > > In regards to which editors to drop from the future releases, how about > this: > > - next web2py release ships with all 4 included, CodeMirror is the default > - everybody will try it, so any hidden bugs or incompatibilities should > show quickly > - after a while (before the next web2py release), community is asked if > anyone uses anything else besides CodeMirror now. > > My guess is that most of the people don't change the default editor. Those > who perhaps do will have a chance to make a case as to why web2py should > keep one (or more) of the other editors. If no issues arise, I'd vote for > keeping just CodeMirror. > > BTW, has anyone tested the emacs and vi key bindings with CodeMIrror? > > The main thing that still needs attention are breaks for the debugger. > CodeMirror can display them besides the line numbers, but I'm not that > familiar with the way current debugger works, so I didn't try to implement > this yet. > > Regards, > Ales > > > On Sunday, September 9, 2012 8:52:34 PM UTC+2, Massimo Di Pierro wrote: >> >> If we move to codemirror (and we should) what do we get rid of (editarea, >> amy, ace)? We cannot ship with 4 editors. >> >> On Sunday, 9 September 2012 13:48:44 UTC-5, Massimo Di Pierro wrote: >>> >>> Please, can you send them to me? >>> >>> On Sunday, 9 September 2012 11:32:53 UTC-5, LightDot wrote: I have added the following to web2py's CodeMirror implementation: - line highlight (line with the cursor is highlighted) - autofocus (focus in the editor when page is opened) - fullscreen toggle (F11 toggles editor to fill the entire window, ESC or repeated F11 exits to default editor size). All this is basically taken from the existing CodeMirror demos and from their docs. Is this something that could be useful to others? I know I'd miss all three. Regards, Ales On Sunday, September 9, 2012 6:26:40 AM UTC+2, Massimo Di Pierro wrote: > > we are considering replacing the admin editor with codemirror since it > should work with IE. > > Can you please help us try it? > > get web2py form github and edit admin/models/0.py and set the editor > to 'codemirror'. > > let us know what browser you try and your findings. > > Massimo > --
[web2py] Re: Sorting ajax return
bear in mind if you have belongs in query(rdbms optimizes ids when using belongs), you might have to sort manualy via python builtin sorted (which can sort all iterables) W dniu niedziela, 9 września 2012 17:55:26 UTC+2 użytkownik Anthony napisał: > > Do you have to use .as_dict()? Instead, you could use .as_list(), and > you'll get a list of dictionaries instead of a dictionary of dictionaries. > The list will retain the order of the original select (presumably you could > use "orderby" to have the database return the records in the order you > want). > > Anthony > > On Sunday, September 9, 2012 10:42:32 AM UTC-4, dundee wrote: >> >> >> Hi all, >> >> I have an ajax call to some values and I use the ...select().as_dict in >> my controller so that I can return a dict to process the results in my view. >> Now I realize that I need these values to be sorted. As a dict >> (..select().as_dict) is not ordered, how can this be accomplished? >> >> Once I needed something like this but I used the Collections module and >> the OrderedDict, but this is different. >> >> I need some opinions on the best approach for this. >> >> >> Thanks. >> >> >> Regards >> >> Kevin >> > --
[web2py] Re: web2py login in main view
yes def index(): form = auth.login(next=URL(request.env.http_referer)) return (form=form) // view default/index.html {{=form}} or read on custom forms and apply it W dniu poniedziałek, 10 września 2012 12:41:05 UTC+2 użytkownik Yebach napisał: > > Hello > > I would like to have login (username, password) fields in my main view and > not to be redirected to new page for login. But if you need to register > then to be redirected to new page > > any suggestions? > > Thank you > > > --
Re: [web2py] [ANN] Started development on web2admin
Github is having some database problem right now. But thanks for sharing this - I will try it later. On Mon, Sep 10, 2012 at 3:49 PM, rif wrote: > I started the development of a new django-like admin interface. > > You can find it here: https://github.com/rif/web2admin > > It is very basic but still usable because it uses SQLFORM.smartgrid. > > I am announcing it early because I need your feedback and feature requests > so that I can find out if grid will be able to support all the desired > features. > > For quick start you can create a w2a_root group and add your user to that > group. > > -rif > > -- > > > > --
[web2py] [ANN] Started development on web2admin
I started the development of a new django-like admin interface. You can find it here: https://github.com/rif/web2admin It is very basic but still usable because it uses SQLFORM.smartgrid. I am announcing it early because I need your feedback and feature requests so that I can find out if grid will be able to support all the desired features. For quick start you can create a w2a_root group and add your user to that group. -rif --
[web2py] Re: help test codemirrorw
In regards to which editors to drop from the future releases, how about this: - next web2py release ships with all 4 included, CodeMirror is the default - everybody will try it, so any hidden bugs or incompatibilities should show quickly - after a while (before the next web2py release), community is asked if anyone uses anything else besides CodeMirror now. My guess is that most of the people don't change the default editor. Those who perhaps do will have a chance to make a case as to why web2py should keep one (or more) of the other editors. If no issues arise, I'd vote for keeping just CodeMirror. BTW, has anyone tested the emacs and vi key bindings with CodeMIrror? The main thing that still needs attention are breaks for the debugger. CodeMirror can display them besides the line numbers, but I'm not that familiar with the way current debugger works, so I didn't try to implement this yet. Regards, Ales On Sunday, September 9, 2012 8:52:34 PM UTC+2, Massimo Di Pierro wrote: > > If we move to codemirror (and we should) what do we get rid of (editarea, > amy, ace)? We cannot ship with 4 editors. > > On Sunday, 9 September 2012 13:48:44 UTC-5, Massimo Di Pierro wrote: >> >> Please, can you send them to me? >> >> On Sunday, 9 September 2012 11:32:53 UTC-5, LightDot wrote: >>> >>> I have added the following to web2py's CodeMirror implementation: >>> >>> - line highlight (line with the cursor is highlighted) >>> - autofocus (focus in the editor when page is opened) >>> - fullscreen toggle (F11 toggles editor to fill the entire window, ESC >>> or repeated F11 exits to default editor size). >>> >>> All this is basically taken from the existing CodeMirror demos and from >>> their docs. >>> >>> Is this something that could be useful to others? I know I'd miss all >>> three. >>> >>> Regards, >>> Ales >>> >>> >>> On Sunday, September 9, 2012 6:26:40 AM UTC+2, Massimo Di Pierro wrote: we are considering replacing the admin editor with codemirror since it should work with IE. Can you please help us try it? get web2py form github and edit admin/models/0.py and set the editor to 'codemirror'. let us know what browser you try and your findings. Massimo >>> --
[web2py] Re: SQLForm.grid : is it possible to delete multiple rows at once ?
On Monday, March 26, 2012 4:38:57 PM UTC+5:30, Sanjeet Kumar wrote: > > can use the following :- > > form=SQLFORM.grid(db.auth_user, create=False, selectable = lambda ids: > del_emp(ids)) > > def del_emp(ids): > if not ids: > response.flash='Please Select the Check-box to Delete' > else: > for row in ids: > db(db.auth_user.id == row).delete() > pass > pass > return '' > > response.flash does not seem to work. But session.flash works. So I assume the form is indeed submitted. Is there a "web2py" way (I mean without java script) to prevent form submission if no records are selected ? -Mandar --
Re: [web2py] Re: Lazy Tables and Cached Results on GAE
But it will invalidate all the cache data. I want to invalidate just one row cache, is this possible? On Mon, Sep 10, 2012 at 10:14 AM, Massimo Di Pierro < massimo.dipie...@gmail.com> wrote: > If you use cache.ram or cache.disk you can do > > cache.ram.clear() > cache.disk.clear() > > this will clear all ram. You can also pass a regex to clear to clear only > some keys. > > On Monday, 10 September 2012 07:49:27 UTC-5, Felipe Meirelles wrote: >> >> Only one more question, can I enforce the cache to invalidate (as when I >> know the record has changed) or update the select cache manulay? >> >> On Monday, September 10, 2012 9:44:18 AM UTC-3, Massimo Di Pierro wrote: >>> >>> 2.0.8 is known to work fine on GAE. >>> >>> On Monday, 10 September 2012 07:05:11 UTC-5, Felipe Meirelles wrote: Anyone tested the new 2.0.2 changes on GAE? Should this work fine? Can someone tell me how the internals work for this two features and how to use it? Thanks. >>> -- > > > > -- Att, Felipe Meirelles. --
Re: [web2py] Relocated admin using router, problem with appadmin
On 10 Sep 2012, at 2:17 AM, Marek Mollin wrote: > Apparently, > I have to domains there is no way for me to access admin. > I get gateway timeouts. I'll take a look at the code later today. > > W dniu poniedziałek, 10 września 2012 01:27:02 UTC+2 użytkownik Marek Mollin > napisał: > So if I skip the admin.app.com line domain I will get: > test.app.com/admin > app.com/admin > > all working fine? > > W dniu niedziela, 9 września 2012 22:01:12 UTC+2 użytkownik Jonathan Lundell > napisał: > On 9 Sep 2012, at 12:42 PM, Marek Mollin wrote: >> Hello, >> I ran into small problem. >> I have web2py 2.08 running nginx + postgres. >> >> I configured routes using parametric system. >> In routes.py I defined domains and assigned admin to seperate domain. >> By domain i mean actually subdomains... >> >> test.app.com -> testing environment using seperate db >> app.com -> official thing >> admin.app.com -> admin for both apps and any other that may comeby >> >> Problem is: >> Now I cannot access appadmin. (I have no uwsgi_log... just gateway timed out >> and have to restart server). > > There's a problem with having admin in a different domain from an associated > app, in that the URLs that cross the domains aren't specified as absolute > URLs (that is, they don't have a domain attached to them). > > It might be possible to fix that in the parametric router, but noticing a) > that the app specified in a URL() call is different from the calling app, and > b) that the app in question is associated with a domain and/or port. But at > present I don't think it'll work. > > I'm not entirely certain of all this without reviewing the code. Another > workaround would be to treat the domain as a hint, but allow the URL to > override it by explicitly specifying the app. And maybe that happens, but > there's a more subtle issue... > > Turning on router logging might help explain what's going on. > >> >> My routes.py >> >> routers = dict( >> BASE = dict( >> domains = { >> 'myapp.com' : 'myapp', >> 'admin.myapp.com' : 'admin', >> 'test.myapp.com' : 'testm', >> >> >> }, >> default_application = 'myapp', >> applications = ['myapp','admin','testm'], >> controllers = 'DEFAULT', >> map_static = True >> ), >> myapp = dict( >> functions = dict( >> produkty = ['index'], >> rozmiary = ['index'], >> polityka = ['index'], >> ), >> ), >> ) >> >> >> >> >> -- >> >> >> > > > > -- > > > --
[web2py] Re: Lazy Tables and Cached Results on GAE
If you use cache.ram or cache.disk you can do cache.ram.clear() cache.disk.clear() this will clear all ram. You can also pass a regex to clear to clear only some keys. On Monday, 10 September 2012 07:49:27 UTC-5, Felipe Meirelles wrote: > > Only one more question, can I enforce the cache to invalidate (as when I > know the record has changed) or update the select cache manulay? > > On Monday, September 10, 2012 9:44:18 AM UTC-3, Massimo Di Pierro wrote: >> >> 2.0.8 is known to work fine on GAE. >> >> On Monday, 10 September 2012 07:05:11 UTC-5, Felipe Meirelles wrote: >>> >>> Anyone tested the new 2.0.2 changes on GAE? Should this work fine? >>> >>> Can someone tell me how the internals work for this two features and how >>> to use it? >>> >>> Thanks. >>> >> --
[web2py] Re: Lazy Tables and Cached Results on GAE
Only one more question, can I enforce the cache to invalidate (as when I know the record has changed) or update the select cache manulay? On Monday, September 10, 2012 9:44:18 AM UTC-3, Massimo Di Pierro wrote: > > 2.0.8 is known to work fine on GAE. > > On Monday, 10 September 2012 07:05:11 UTC-5, Felipe Meirelles wrote: >> >> Anyone tested the new 2.0.2 changes on GAE? Should this work fine? >> >> Can someone tell me how the internals work for this two features and how >> to use it? >> >> Thanks. >> > --
[web2py] Re: You don't have permission to access /admin/default/index on this server.
For security reasons you cannot access admin remotely using port 80. You either setup https, or a ssh tunnel, or access it from localhost. On Monday, 10 September 2012 04:17:20 UTC-5, Vladimir wrote: > > Hello! > I'd like to try web2py, but I can not open administrative pages. I'm > getting this error: > > Forbidden > > You don't have permission to access /admin/default/index on this server. > -- > Apache/2.2.16 (Debian) Server at localhost Port 80 > My operating system is Debian 6.04 with the last stable version of web2py. > At installation process I've choosed web2py to be installed as apache2 > module. Web2py is working - only admin interface is not acceptable. I've > controled the ownership of web directories (/home/www-data): the owner is > www-data (apache server). > Thanks for any help. > --
[web2py] Re: Lazy Tables and Cached Results on GAE
2.0.8 is known to work fine on GAE. On Monday, 10 September 2012 07:05:11 UTC-5, Felipe Meirelles wrote: > > Anyone tested the new 2.0.2 changes on GAE? Should this work fine? > > Can someone tell me how the internals work for this two features and how > to use it? > > Thanks. > --
[web2py] Re: web2py DAL one-to-one relation
Field('','reference other_table',ondelete='CASCADE') this is actually the default. Is this what you are asking? On Monday, 10 September 2012 05:45:28 UTC-5, martzi wrote: > > Hi, > I wonder if there a way to enforce a one to one relationship with Cascade > via web2py DAL API. ??? > --
[web2py] Re: dropbox python api
Please open a ticket on googlecode. On Monday, 10 September 2012 07:31:04 UTC-5, peter wrote: > > Massimo I am testing this > > def test_dropbox(): > from dropbox_account import DropboxAccount > dropbox=DropboxAccount(request,key="XXX",secret="XXX") > dropbox.login_form() > return dict() > > I tried the above > > I get > > TRACEBACK > > 1. > 2. > 3. > 4. > 5. > 6. > 7. > 8. > 9. > > Traceback (most recent call last): > File "C:\Users\Peter\web2pyn\gluon\main.py", line 528, in wsgibase > session._try_store_on_disk(request, response) > File "C:\Users\Peter\web2pyn\gluon\globals.py", line 594, in > _try_store_on_disk > cPickle.dump(dict(self), response.session_file) > File "C:\Python26\lib\copy_reg.py", line 77, in _reduce_ex > raise TypeError("a class that defines __slots__ without " > TypeError: a class that defines __slots__ without defining __getstate__ > cannot be pickled > > On tracing the code it executes > > def login_form(self): > token = self.sess.obtain_request_token() > current.session.dropbox_token = token > dropbox_url = self.sess.build_authorize_url(token,self.login_url) > and blows out on > redirect(dropbox_url) > > dropbox_url is contains the correct url > > Peter > > > On Monday, 9 April 2012 22:34:31 UTC+1, Massimo Di Pierro wrote: >> >> Perhaps this can be useful: >> >> https://github.com/web2py/web2py/blob/master/gluon/contrib/login_methods/dropbox_account.py#L90 >> >> has been there for a while but I am not sure anybody has tested it very >> well. >> >> massimo >> >> On Monday, 9 April 2012 09:14:56 UTC-5, Paul Gerrard wrote: >>> >>> Hi, >>> >>> I got distracted by other things and only just came back to this. The >>> problem I was having was in my code was the token was 'disabled or >>> invalid'. I'm sure this is resolved by using the callback in the redirect >>> back from the Dropbox site. I commented out the code that's not relevant >>> for me in your code and it works fine now. >>> >>> As for using cron - I expect you could skip the redirect and go from >>> line 191 directly to 204. Presumably you need a try/except around 204? >>> >>> Paul. >>> >>> On Thursday, 5 January 2012 17:28:41 UTC, Joseph Jude wrote: If anyone is interested, you can look into the code for dropbox connection here: http://goo.gl/QYT2y This is my default.py. Look at dropbox_connect and process_dropbox. Question: How can I automate this with cron? When I do it, it stops with the redirect. Thank you, Joseph >>> --
[web2py] Re: Getting auth.wiki pages to display without login
There was a bug. Fixed now. Please check it. On Sunday, 9 September 2012 22:50:13 UTC-5, Andrew W wrote: > > It still doesn't worked for me (when not logged in). I have not set > manage_permissions, which I note is False as a default. > I always get the login screen when I paste in a url for one of my wiki > pages. ? I'll keep trying, maybe I need to update the auth groups > ("everybody") ? > > > On Monday, September 10, 2012 2:04:43 PM UTC+12, Massimo Di Pierro wrote: >> >> plugin_wiki has such thing but not auth.wiki. In auth wiki all pages are >> public unless you do >> >> auth.wiki(manage_permissions=True) >> >> If you set manage_permissions=True all pages are private but the author >> can choose the names of the groups who can read or write it. You can use >> the "everybody" group to make it public. >> >> On Sunday, 9 September 2012 18:19:30 UTC-5, Andrew W wrote: >>> >>> I've looked for the magic is_public button, but I can't find it. >>> >>> >>> On Sunday, September 9, 2012 3:57:28 AM UTC+12, villas wrote: Just a thought, but doesn't the wiki page have an is_public field? If so, did you tick it? On Saturday, September 8, 2012 9:41:35 AM UTC+1, Andrew W wrote: > > Just Checking, were you logged in when you tried to open up the page ? > > Just to clarify, if I'm logged in it will take me directly to the page > - as expected. I wanted to test having pages available to users who > haven't logged in - which for this case would be most people - the > public. > I opened a new browser window, made sure I wasn't logged in to web2py, > and pasted in the url of my new page. I get the login screen. > > I've just tried it again at home, creating just a simple page (OK, I > did add an extra css file to the layout). > > Screen shot attached of page (when logged in), and screen when I paste > in the url. > > Apart from that, auth.wiki is looking great. I'm experimenting with > adding blocks with extra classes, allowing me to style them differently. > > Can I specify classes to other elements, or is it just blockquotes ? > > P.S. I'm getting a small S in the menu bar (app created from Welcome > with no changes to menu) - see screen shot > > Thanks > > > On Saturday, September 8, 2012 7:42:22 AM UTC+12, Massimo Di Pierro > wrote: >> >> Strange. It should work even without url=True. You should be able to >> paste any URL in markmin and it should work. >> >> MARKMIN(text, url=True) >> >> simply allows you to user the shortcuts >> @/app/controller/function/args and they will be converted in >> http:///app/controller/function/args where app, controller and >> function >> are optional. You can do @///index for example. >> >> On Friday, 7 September 2012 14:15:31 UTC-5, Andrew W wrote: >>> >>> No I didn't. Only just found out about URL=True. Di I pass as a >>> URL variable ? >> >> --
[web2py] Re: dropbox python api
Massimo I am testing this def test_dropbox(): from dropbox_account import DropboxAccount dropbox=DropboxAccount(request,key="XXX",secret="XXX") dropbox.login_form() return dict() I tried the above I get TRACEBACK 1. 2. 3. 4. 5. 6. 7. 8. 9. Traceback (most recent call last): File "C:\Users\Peter\web2pyn\gluon\main.py", line 528, in wsgibase session._try_store_on_disk(request, response) File "C:\Users\Peter\web2pyn\gluon\globals.py", line 594, in _try_store_on_disk cPickle.dump(dict(self), response.session_file) File "C:\Python26\lib\copy_reg.py", line 77, in _reduce_ex raise TypeError("a class that defines __slots__ without " TypeError: a class that defines __slots__ without defining __getstate__ cannot be pickled On tracing the code it executes def login_form(self): token = self.sess.obtain_request_token() current.session.dropbox_token = token dropbox_url = self.sess.build_authorize_url(token,self.login_url) and blows out on redirect(dropbox_url) dropbox_url is contains the correct url Peter On Monday, 9 April 2012 22:34:31 UTC+1, Massimo Di Pierro wrote: > > Perhaps this can be useful: > > https://github.com/web2py/web2py/blob/master/gluon/contrib/login_methods/dropbox_account.py#L90 > > has been there for a while but I am not sure anybody has tested it very > well. > > massimo > > On Monday, 9 April 2012 09:14:56 UTC-5, Paul Gerrard wrote: >> >> Hi, >> >> I got distracted by other things and only just came back to this. The >> problem I was having was in my code was the token was 'disabled or >> invalid'. I'm sure this is resolved by using the callback in the redirect >> back from the Dropbox site. I commented out the code that's not relevant >> for me in your code and it works fine now. >> >> As for using cron - I expect you could skip the redirect and go from line >> 191 directly to 204. Presumably you need a try/except around 204? >> >> Paul. >> >> On Thursday, 5 January 2012 17:28:41 UTC, Joseph Jude wrote: >>> >>> If anyone is interested, you can look into the code for dropbox >>> connection here: >>> >>> http://goo.gl/QYT2y >>> >>> This is my default.py. Look at dropbox_connect and process_dropbox. >>> >>> Question: How can I automate this with cron? When I do it, it stops with >>> the redirect. >>> >>> Thank you, >>> Joseph >>> >> --
Re: [web2py] Re: help test codemirrorw
I confirm that it resolves all the problems with IE 8. And it still works fine with current Chrome and Firefox on Windows 7. +1 for making codemirror the default admin editor! --
Re: [web2py] Relocated admin using router, problem with appadmin
To rephrase: I need a sample routes.py with router between two domains (subdomains) getting two seperate applications with admin access enabled. I urgently need help, thanks. W dniu poniedziałek, 10 września 2012 11:17:57 UTC+2 użytkownik Marek Mollin napisał: > > Apparently, > I have two domains and there is no way for me to access admin. > I get gateway timeouts. > > on logging I get permission denied > > W dniu poniedziałek, 10 września 2012 01:27:02 UTC+2 użytkownik Marek > Mollin napisał: >> >> So if I skip the admin.app.com line domain I will get: >> test.app.com/admin >> app.com/admin >> >> all working fine? >> >> W dniu niedziela, 9 września 2012 22:01:12 UTC+2 użytkownik Jonathan >> Lundell napisał: >>> >>> On 9 Sep 2012, at 12:42 PM, Marek Mollin wrote: >>> >>> Hello, >>> I ran into small problem. >>> I have web2py 2.08 running nginx + postgres. >>> >>> I configured routes using parametric system. >>> In routes.py I defined domains and assigned admin to seperate domain. >>> By domain i mean actually subdomains... >>> >>> test.app.com -> testing environment using seperate db >>> app.com -> official thing >>> admin.app.com -> admin for both apps and any other that may comeby >>> >>> Problem is: >>> Now I cannot access appadmin. (I have no uwsgi_log... just gateway timed >>> out and have to restart server). >>> >>> >>> There's a problem with having admin in a different domain from an >>> associated app, in that the URLs that cross the domains aren't specified as >>> absolute URLs (that is, they don't have a domain attached to them). >>> >>> It might be possible to fix that in the parametric router, but noticing >>> a) that the app specified in a URL() call is different from the calling >>> app, and b) that the app in question is associated with a domain and/or >>> port. But at present I don't think it'll work. >>> >>> I'm not entirely certain of all this without reviewing the code. Another >>> workaround would be to treat the domain as a hint, but allow the URL to >>> override it by explicitly specifying the app. And maybe that happens, but >>> there's a more subtle issue... >>> >>> Turning on router logging might help explain what's going on. >>> >>> >>> My routes.py >>> >>> routers = dict( >>> BASE = dict( >>> domains = { >>> 'myapp.com' : 'myapp', >>> 'admin.myapp.com' : 'admin', >>> 'test.myapp.com' : 'testm', >>> >>> >>> }, >>> default_application = 'myapp', >>> applications = ['myapp','admin','testm'], >>> controllers = 'DEFAULT', >>> map_static = True >>> ), >>> myapp = dict( >>> functions = dict( >>> produkty = ['index'], >>> rozmiary = ['index'], >>> polityka = ['index'], >>> ), >>> ), >>> ) >>> >>> >>> >>> >>> -- >>> >>> >>> >>> >>> >>> >>> --
Re: [web2py] You don't have permission to access /admin/default/index on this server.
You have to use *https://* Marin On Mon, Sep 10, 2012 at 11:17 AM, Vladimir wrote: > Hello! > I'd like to try web2py, but I can not open administrative pages. I'm > getting this error: > > Forbidden > > You don't have permission to access /admin/default/index on this server. > -- > Apache/2.2.16 (Debian) Server at localhost Port 80 > My operating system is Debian 6.04 with the last stable version of web2py. > At installation process I've choosed web2py to be installed as apache2 > module. Web2py is working - only admin interface is not acceptable. I've > controled the ownership of web directories (/home/www-data): the owner is > www-data (apache server). > Thanks for any help. > > -- > > > > --
[web2py] Lazy Tables and Cached Results on GAE
Anyone tested the new 2.0.2 changes on GAE? Should this work fine? Can someone tell me how the internals work for this two features and how to use it? Thanks. --
[web2py] You don't have permission to access /admin/default/index on this server.
Hello! I'd like to try web2py, but I can not open administrative pages. I'm getting this error: Forbidden You don't have permission to access /admin/default/index on this server. -- Apache/2.2.16 (Debian) Server at localhost Port 80 My operating system is Debian 6.04 with the last stable version of web2py. At installation process I've choosed web2py to be installed as apache2 module. Web2py is working - only admin interface is not acceptable. I've controled the ownership of web directories (/home/www-data): the owner is www-data (apache server). Thanks for any help. --
[web2py] web2py DAL one-to-one relation
Hi, I wonder if there a way to enforce a one to one relationship with Cascade via web2py DAL API. ??? --
Re: [web2py] LOAD Ajax
try LOAD() with extension=False 2012/9/10 Hassan Alnatour > Dear ALL , > > i am having problems when i use the LOAD() in the page.load if i add any > CSS with images like background:url(); and when i use the function > URL('page') the url is rendered as /project/controller/page.load , > > what can i do to fix this problem ? > > Best Regards, > > -- > > > > --
[web2py] LOAD Ajax
Dear ALL , i am having problems when i use the LOAD() in the page.load if i add any CSS with images like background:url(); and when i use the function URL('page') the url is rendered as /project/controller/page.load , what can i do to fix this problem ? Best Regards, --
[web2py] web2py login in main view
Hello I would like to have login (username, password) fields in my main view and not to be redirected to new page for login. But if you need to register then to be redirected to new page any suggestions? Thank you --
Re: [web2py] Relocated admin using router, problem with appadmin
Apparently, I have to domains there is no way for me to access admin. I get gateway timeouts. W dniu poniedziałek, 10 września 2012 01:27:02 UTC+2 użytkownik Marek Mollin napisał: > > So if I skip the admin.app.com line domain I will get: > test.app.com/admin > app.com/admin > > all working fine? > > W dniu niedziela, 9 września 2012 22:01:12 UTC+2 użytkownik Jonathan > Lundell napisał: >> >> On 9 Sep 2012, at 12:42 PM, Marek Mollin wrote: >> >> Hello, >> I ran into small problem. >> I have web2py 2.08 running nginx + postgres. >> >> I configured routes using parametric system. >> In routes.py I defined domains and assigned admin to seperate domain. >> By domain i mean actually subdomains... >> >> test.app.com -> testing environment using seperate db >> app.com -> official thing >> admin.app.com -> admin for both apps and any other that may comeby >> >> Problem is: >> Now I cannot access appadmin. (I have no uwsgi_log... just gateway timed >> out and have to restart server). >> >> >> There's a problem with having admin in a different domain from an >> associated app, in that the URLs that cross the domains aren't specified as >> absolute URLs (that is, they don't have a domain attached to them). >> >> It might be possible to fix that in the parametric router, but noticing >> a) that the app specified in a URL() call is different from the calling >> app, and b) that the app in question is associated with a domain and/or >> port. But at present I don't think it'll work. >> >> I'm not entirely certain of all this without reviewing the code. Another >> workaround would be to treat the domain as a hint, but allow the URL to >> override it by explicitly specifying the app. And maybe that happens, but >> there's a more subtle issue... >> >> Turning on router logging might help explain what's going on. >> >> >> My routes.py >> >> routers = dict( >> BASE = dict( >> domains = { >> 'myapp.com' : 'myapp', >> 'admin.myapp.com' : 'admin', >> 'test.myapp.com' : 'testm', >> >> >> }, >> default_application = 'myapp', >> applications = ['myapp','admin','testm'], >> controllers = 'DEFAULT', >> map_static = True >> ), >> myapp = dict( >> functions = dict( >> produkty = ['index'], >> rozmiary = ['index'], >> polityka = ['index'], >> ), >> ), >> ) >> >> >> >> >> -- >> >> >> >> >> >> >> --
[web2py] Re: dropbox python api
Joseph your code for dropbox is no longer there. Is there any chance of you putting it up again? Thanks Peter On Thursday, 5 January 2012 17:28:41 UTC, Joseph Jude wrote: > > If anyone is interested, you can look into the code for dropbox connection > here: > > http://goo.gl/QYT2y > > This is my default.py. Look at dropbox_connect and process_dropbox. > > Question: How can I automate this with cron? When I do it, it stops with > the redirect. > > Thank you, > Joseph > --
[web2py] extact migration files from an existing db
I'm working with postgres, and I play a lot with the databases. Problem is, I get into lots of situations when I cannot use fake migration, because the DB is not in the right state yet, but I cannot use real migration, as the db files are not set right. What I readlly want, is a way to make web2py, on these special events (I know it's probably not the right way to handle things on a regular basis), to rebuild the migration files from the DB schema. Is there a way to do that? Thanks in advance Yair --
[web2py] Re: Submitting a form with a link
I have found the following method: A(T('Forgot your password?'), _href='#', _onclick="document['%s'].submit()" % (SIGNIN_FORM_ID) The problem is that I can not specify another href (I *must* put '#', otherwise it does not work). And, since the form is submitted to the same function as if the normal "submit" button was pressed, I am not able to distinguish between both situations. - How can I submit the form to another url, by using an A element? - Or, in case that is not possible, how can I check which way the form has been submitted? Thanks, Daniel On Monday, September 10, 2012 10:03:12 AM UTC+2, Daniel Gonzalez wrote: > > Hi, > > I am preparing a customized log-in form. I want to add a link to recover > the password, which is implemented with the A(..) element. > In the controller function where I want to send an email, I need to access > the email given by the user. I do that with request.vars.email. > The problem is that, since the form was not submitted, the email is empty. > > How can I submit the form with an A() element? > Please note that I *do not* want to have an extra button with "Lost > Password" to submit the form. I really want it to be a link. > > Is this possible? > > Thanks, > Daniel > --
[web2py] Submitting a form with a link
Hi, I am preparing a customized log-in form. I want to add a link to recover the password, which is implemented with the A(..) element. In the controller function where I want to send an email, I need to access the email given by the user. I do that with request.vars.email. The problem is that, since the form was not submitted, the email is empty. How can I submit the form with an A() element? Please note that I *do not* want to have an extra button with "Lost Password" to submit the form. I really want it to be a link. Is this possible? Thanks, Daniel --
[web2py] Re: [OT] Ubuntu 12.10 will no longer ship with Python 2
Arch Linux has switched to Python 3 as default for some time now and it's not much of a problem. It all depends on how the Ubuntu packagers manage the change. I expect things like wicd to break when Arch made the change, but everything worked smoothly. For my scripts, I just make sure my python symlink to version 2 is always ahead in my path, so that #!/usr/bin/env python always gets v2. Although I should also be changing them to call python2 for scripts that cannot switch to 3 yet. --
[web2py] SOAP XML Return Objects
I wanted to return a xml similar to this : using a SOAP WebService. The example i'm seeing is just for primitive datatypes, I wanted to have a user defined object. Is this possible? Thanks. --