Re: [web2py] importing modules to test file using pytest

2012-12-05 Thread monotasker
environment. Best, Ian On Wednesday, December 5, 2012 4:02:51 PM UTC-5, viniciusban wrote: > > Hi monotasker. > > I'm starting to run something like that and I'm giving > gluon/contrib/webclient.py a try. > > I intend to prepare an environment to allow runni

[web2py] importing modules to test file using pytest

2012-12-05 Thread monotasker
I'm trying to use pytest (instead of unittest) to do unit testing for a web2py app. I've written a script (attached: runtest.py) to launch py.test, which then finds and executes my test files. I run this launcher script in a web2py environment like this: python ~/web/web2py/web2py.py -S pai

[web2py] Re: Inserting uploaded media files in markmin

2012-10-27 Thread monotasker
; > On Saturday, 27 October 2012 13:54:49 UTC-5, monotasker wrote: >> >> I'm finding it awkward to insert uploaded images into markmin-formatted >> text because the upload filenames aren't memorable. I see the point of the >> file renaming. But I think I nee

[web2py] Inserting uploaded media files in markmin

2012-10-27 Thread monotasker
I'm finding it awkward to insert uploaded images into markmin-formatted text because the upload filenames aren't memorable. I see the point of the file renaming. But I think I need some kind of widget that displays the images in my upload library and will automatically get and insert the filena

[web2py] Re: Speed of operations with Storage object vs plain dictionary

2012-10-04 Thread monotasker
at the usual webdev suspects -- number of file and image downloads, resolution of image files, server optimization, etc. Good to know. Ian On Thursday, October 4, 2012 3:52:24 PM UTC-4, Niphlod wrote: > > Not directed only to monotasker: aren't all you tired of reading > bench

[web2py] Re: How do you organize your applications to be unit-tested?

2012-10-04 Thread monotasker
One thing I'm trying out right now is (a) writing all of my business logic in module files; (b) breaking up that logic into small-ish classes that each seem to have with around 5-10 methods each; (c) injecting my dependencies as much as possible into the class in the __init__ method and then pa

[web2py] Speed of operations with Storage object vs plain dictionary

2012-10-04 Thread monotasker
Has anyone looked at the speed differences between operations performed with a Storage object and the equivalent object with a dictionary? I wonder how these would compare? bob = MyStorageObject.name bob = MyDictionary['name'] I suspect that the difference with one lookup would be trivial, but

Re: [web2py] Please stop embedding Bootstrap classes in your HTML!

2012-10-04 Thread monotasker
I'm not sure how this would work with the current web2py framework (which uses static css), but a css pre-processing system like LESS makes the application of framework classes to your custom html trivial. Twitter Bootstrap (like many of the other css frameworks out there) provides its styles i

[web2py] Re: Error importing csv during setup with testrunner.py

2012-10-04 Thread monotasker
Thanks very much. I just sent the files to you by email. Ian On Thursday, October 4, 2012 8:11:23 AM UTC-4, Massimo Di Pierro wrote: > > If you send me the file and the models I will try it. > > On Thursday, 4 October 2012 01:16:17 UTC-5, monotasker wrote: >> >> I'

[web2py] Error importing csv during setup with testrunner.py

2012-10-03 Thread monotasker
I'm trying to set up unit tests and run into this error during the creation of the test db (using testrunner.py). I've looked at the code of this method in gluon.dal, but I really don't know enough about csv importing to know how to debug the error. So any help would be much appreciated. Here i

[web2py] Re: Syntax for update_or_insert with multiple values to match

2012-10-01 Thread monotasker
t of key:value > > condition = {'name': auth.user_id, 'tag': tag} > > If the first argument of update_or_insert is not specified the following > named arguments (tlast_right=time_last_rightm,...) are used to build a > condition dict. > > On Sunday, 30 Sep

[web2py] Syntax for update_or_insert with multiple values to match

2012-09-30 Thread monotasker
In the manual section on update_or_insert() the examples only touch on a situation where one field/value is given as the matching condition. I'm wondering what syntax needs to be used if we want to match values on more than one field. Extrapolating from the manual example, can I do this? db.t

[web2py] Re: Routes.py causing a server error?

2012-09-27 Thread monotasker
Sorry, found the problem. I was just missing a comma in the list of tuples (sheepish grin). On Thursday, September 27, 2012 11:26:51 AM UTC-4, monotasker wrote: > > My site hosted on webfaction started returning a 500 internal server error > this morning and it looks like it's

[web2py] Routes.py causing a server error?

2012-09-27 Thread monotasker
My site hosted on webfaction started returning a 500 internal server error this morning and it looks like it's choking on my routing. What's strange is that it was all working (with no changes made) for quite a while prior to this. My server log shows this at the start of the problem: [Thu Sep

[web2py] Re: Very intro question on logging: where is the console output?

2012-09-20 Thread monotasker
Console means > "standard output + standard error", you see it only if you're running on > terminal (unix, mac) or Dos prompt (Windows). That's why usually > "production" apps log something directly to a file or to a database. > > On Thursday, Septemb

[web2py] Very intro question on logging: where is the console output?

2012-09-20 Thread monotasker
Ok, this reveals the depth of my ignorance. The logging.example.conf file is set up to output logs to "console." What is that? If I'm trying to log things running on a remote server, where do I access this "console"? Thanks. --

[web2py] Re: Reading data from session files in cron job

2012-09-14 Thread monotasker
Ok, so would I then just have python read the contents of the file and then unpickle the whole as a single string? Ian On Friday, September 14, 2012 2:52:33 PM UTC-4, Niphlod wrote: > > it's not hashed, it's pickled. > > On Friday, September 14, 2012 7:40:47 PM U

[web2py] Reading data from session files in cron job

2012-09-14 Thread monotasker
Following on an earlier question of mine, I'm trying to arrange for persistent data (per user) by writing session data to the db. The trick I'm stumbling over is how to make sure that the session data that is stored always represents the end of the most recent user session. It seems to me like

[web2py] What data should be private (for security) in a standard web2py installation?

2012-09-11 Thread monotasker
I'm using github for open-source development of some web2py apps and want to make sure I'm not exposing any data that would be a security risk. As far as I can tell, the sensitive pieces of data in a standard app would be: - email account information (by default in db.py) - any recaptcha keys (b

Re: [web2py] Help with python module import error

2012-09-10 Thread monotasker
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.

Re: [web2py] Help with python module import error

2012-09-10 Thread monotasker
lled/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

[web2py] Help with python module import error

2012-09-10 Thread monotasker
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

Re: [web2py] Re: How to persist session data for user across browsers

2012-09-03 Thread monotasker
Perfect. Thanks for providing the snippet. I haven't used the cache methods yet, and this saves me a lot of time. Ian On Sunday, September 2, 2012 2:28:14 AM UTC-4, rochacbruno wrote: > > I think you can use cache. > > user_data = cache.ram("user_data_%s" % auth.user_id, lambda : > dict(field=v

[web2py] Re: How to persist session data for user across browsers

2012-09-03 Thread monotasker
on? > > Anthony > > On Saturday, September 1, 2012 12:38:47 PM UTC-4, monotasker wrote: >> >> I'd like my app to preserve a "state" for each user for 24-hours, even if >> s/he >> - logs out and back in >> - switches browsers >> - switches IP

[web2py] How to persist session data for user across browsers

2012-09-01 Thread monotasker
I'd like my app to preserve a "state" for each user for 24-hours, even if s/he - logs out and back in - switches browsers - switches IP (i.e., uses a different device) What would be the best way to do this? I'm already using the session object to preserve state in the app. So I was thinking th

Re: [web2py] Re: How to install web2py on webfaction

2012-07-04 Thread monotasker
Do you know how to set the admin password? I tried entering my webfaction dashboard password but it didn't work. Ian On Wednesday, July 4, 2012 11:42:24 AM UTC-4, kokoyo wrote: > > hi, i have been using webfaction, you can do these step to get w2py admin: > on the left menu: Domains/Website >

[web2py] Re: Still no nested lists in Markmin? Workaround?

2012-07-04 Thread monotasker
UTC-4, Massimo Di Pierro wrote: > > Looks like there is a patch pending about this. > On Wednesday, 4 July 2012 09:58:47 UTC-5, monotasker wrote:I will review > it asap. > > Am I right that the Markmin syntax still doesn't implement nested lists? >> Has anyone foun

[web2py] Still no nested lists in Markmin? Workaround?

2012-07-04 Thread monotasker
Am I right that the Markmin syntax still doesn't implement nested lists? Has anyone found an easy workaround for this? I'm building a presentation (slideshow) component and would like to use Markmin, but I need more depth than a flat list. Thanks.

[web2py] Re: Can you bind a jquery function to web2py component refresh?

2012-06-28 Thread monotasker
get='mycomponent')}} > > jQuery(function() { > jQuery('#mycomponent').ajaxSuccess(function(e, xhr, settings) { > if (settings.url == '/default/mycomponent.load') { > jQuery(this).doSomething(); > }; > }); > }); > > >

[web2py] Can you bind a jquery function to web2py component refresh?

2012-06-28 Thread monotasker
I'd like to be able to bind a jquery function to a div that is the container for a web2py component, so that when the component content is updated by the controller the jquery function is triggered. But I'm not sure whether there is a stock event that would cover the component refresh (I don't

[web2py] Re: Removing a row from a list

2012-06-01 Thread monotasker
ΟΚ, that's very helpful. Thanks once again. On Friday, June 1, 2012 1:14:08 PM UTC-4, Anthony wrote: > > X >> > > That would have to be _onclick, not _href, and you'd want to add something > like "; return false" at the end to prevent the usual link behavior. > Anyway, I suggested an alternative

[web2py] Re: Removing a row from a list

2012-06-01 Thread monotasker
Thanks, Anthony, and sorry for spreading misinformation. I just re-read the book section and found where I'd been confused. So it looks like Johann simply needs something like this for each row in his view: X Then to refresh the component after the controller runs, he would just return "web2py

[web2py] Re: Removing a row from a list

2012-06-01 Thread monotasker
The :eval method of the ajax() function requires that there is a form field holding the value to be sent by ajax. So in your view you could just include in INPUT() helper somewhere on the page and hide it via css. Then when the "remove row" link is clicked, your could use js to: - set the input

[web2py] Regex problem in custom validator

2012-06-01 Thread monotasker
I have a db field that holds a regular expression (one unique regex for each row in the table). Another row in the table (db.steps.readable_response) lists sample strings that should satisfy the regex. I'm trying to create a custom validator that tests the regular expression against the sample

[web2py] cookbook component upload recipe

2012-05-11 Thread monotasker
I'm trying to use the recipe on p. 142 of the web2py cookbook (Uploading files using a LOADed component) and I'm wondering if there's an error in the replacement web2py_trap_form function. Line 4 of the replacement provides an 'if' condition with no statements following (no { } at all). Is this

[web2py] Re: Javascript file in static folder not refreshed

2012-05-08 Thread monotasker
Yes, that was it. Thanks. Ian On Tuesday, May 8, 2012 1:34:30 PM UTC-4, Anthony wrote: > > It's probably being cached by the browser, so you may need to clear the > browser cache (simply refreshing the page won't do it). > > Anthony > > On Tuesday, May 8, 2012 1:1

[web2py] Javascript file in static folder not refreshed

2012-05-08 Thread monotasker
I'm working on a js file that resides in appname/static/js/ but for some reason it seems to be cached. When I refresh the browser (even if I restart the local web2py server) the page continues to load an old version. I develop largely with custom modules, and those files are refreshing just fin

[web2py] Re: web2py syntax for vim

2012-04-30 Thread monotasker
Thanks very much for doing this. Have you considered putting it in a github repo so that it's a bit easier to use and fork? Ian On Sunday, May 15, 2011 5:44:42 PM UTC-4, pancurster wrote: > > Hi, > I was looking today for vim syntax for web2py templates but I didn't > find it. So I make my own

[web2py] syncing plugins across apps and with github -- again

2012-04-07 Thread monotasker
I want to float a proposal for plugin infrastructure that I'd love to see made part of the web2py core. It takes a bit of explanation, so bear with the long post. I'm starting to find that the syncing issue is a major one with the (otherwise great) plugin infrastructure. I have a growing series

[web2py] Re: Error running testRunner.py

2012-04-05 Thread monotasker
stalled via repository. Ian On Thursday, April 5, 2012 6:53:36 PM UTC-4, monotasker wrote: > > I'm trying to set up unit testing using testRunner.py as laid out here: > http://www.web2pyslices.com/slice/show/1465/unittesting-doctesting-and-userinterface-testing > > . Wh

[web2py] Error running testRunner.py

2012-04-05 Thread monotasker
I'm trying to set up unit testing using testRunner.py as laid out here: http://www.web2pyslices.com/slice/show/1465/unittesting-doctesting-and-userinterface-testing . When I run the tests I'm getting this error: AttributeError: 'thread._local' object has no attribute 'app' This is fixed if I

[web2py] Re: current state of unit testing tools?

2012-04-03 Thread monotasker
No, I hadn't seen that. Thanks Anthony. Ian On Tuesday, April 3, 2012 4:56:54 PM UTC-4, Anthony wrote: > > I'm coming at things backwards (as usual) and just now looking at writing >> unit tests for a couple of apps I'm working on. The most recent forum >> discussion of unit testing in general

[web2py] current state of unit testing tools?

2012-04-03 Thread monotasker
I'm coming at things backwards (as usual) and just now looking at writing unit tests for a couple of apps I'm working on. The most recent forum discussion of unit testing in general seems to be about a year old and references an appliance in web2py_utils as the most complete solution to that po

[web2py] Re: just deployed web2py on flux flex. I have errors on database. How can I delete DBs and migrate them?

2012-04-03 Thread monotasker
I ran into analogous problems with sqlite on fluxflex. If you have a working local version of the app, would it be simplest to just re-initialize the fluxflex repo (and mysql db) and then push a fresh version of the app to the fluxflex repo? I have found that, in general, it doesn't work very w

[web2py] Re: A map of web2py data objects?

2012-03-31 Thread monotasker
et, RadioWidget, and CheckboxesWidget classes to > generate options for SQLFORM fields. That's probably why it's not > documented in the book. > > Anthony > > On Saturday, March 31, 2012 12:25:50 PM UTC-4, monotasker wrote: >> >> Maybe it's just me,

[web2py] Re: A map of web2py data objects?

2012-03-31 Thread monotasker
Just found another very handy one: field.requires[0].ktable (provides the linked table name for a db reference field) On Saturday, March 31, 2012 12:25:50 PM UTC-4, monotasker wrote: > > Maybe it's just me, but one of the things I find most confusing as I work > with web2py is fig

[web2py] Re: Python Negative Popularity

2012-03-31 Thread monotasker
Yes, and my frustration with the push toward node.js is that it seems to come in part from the "I learned js for webdev and I don't want to bother learning another language" impulse. I also think that's part of the motivation behind pushing everything client-side (i.e. into the browser). But I

[web2py] Re: Python Negative Popularity

2012-03-31 Thread monotasker
Yes, stats like this can be deceiving when automated queries are used. One of my web2py projects on github is categorized as "C" rather than python or javascript! I can only assume this is because I have the lxml library in there (?) But I've never written a line of C in my life, and it certainl

[web2py] A map of web2py data objects?

2012-03-31 Thread monotasker
Maybe it's just me, but one of the things I find most confusing as I work with web2py is figuring out what properties and methods each object has. For example, I just learned that field.requires can have an options() method that outputs a list of tuples for the options available in a reference

[web2py] Re: Python Negative Popularity

2012-03-29 Thread monotasker
I'm not convinced that the stats you cite about Python are statistically meaningful over a one-year period (2.45% decline?). But it seems to me that on the web the key issue is browser integration. JavaScript is the default language of the web because browsers all interpret it internally. PHP,

[web2py] Re: can web2py have a place in an 'html5 app' environment?

2012-03-24 Thread monotasker
OK. That makes sense. A bit frustrating, though, that the Mozilla apps are limited to js. I guess that's why I keep developing for the web--it's still the only truly cross-platform environment with any kind of muscle in the back end. On Saturday, March 24, 2012 3:49:36 PM UTC-4, Anthony wrote:

[web2py] Re: can web2py have a place in an 'html5 app' environment?

2012-03-24 Thread monotasker
Yes, I think web2py can already produce a self-contained local app running from the rocket server. At least I think there was a recipe for that in the last edition of the book (I haven't looked in a while). The issue of web2py being 'thick' for the purpose is very much what I was wondering abou

[web2py] Re: can web2py have a place in an 'html5 app' environment?

2012-03-24 Thread monotasker
As I suggested to Derek, I think I've caused some confusion by not being clearer in my original question. I'm not thinking about client-only web-apps. I'm thinking about locally installed apps that use an html5 front-end. This is what win8 is promoting, and that's also the thrust of Mozilla's a

[web2py] Re: can web2py have a place in an 'html5 app' environment?

2012-03-24 Thread monotasker
> are looking for. The way I see it, I would not want Web2Py turning into > another Pyjamas. Pyjamas has it's place, Web2Py has it's own place, and > remember one of the keys to Web2Py is DRY. > > On Friday, March 23, 2012 3:34:27 PM UTC-7, monotasker wrote: >> &

[web2py] Re: can web2py have a place in an 'html5 app' environment?

2012-03-24 Thread monotasker
would not want Web2Py turning into > another Pyjamas. Pyjamas has it's place, Web2Py has it's own place, and > remember one of the keys to Web2Py is DRY. > > On Friday, March 23, 2012 3:34:27 PM UTC-7, monotasker wrote: >> >> Right. For something as simple a

[web2py] Re: can web2py have a place in an 'html5 app' environment?

2012-03-23 Thread monotasker
ript templates. > > The only advantage you'd get with an app like this is you can use it while > you are disconnected from the network. > > But what would be better is to rewrite it so it will retrieve the rss > feeds directly. Then you don't need the web2py piece at

[web2py] can web2py have a place in an 'html5 app' environment?

2012-03-23 Thread monotasker
I've been struck by the huge push lately for 'html5 apps' as a (partly) cross-platform approach to mobile and desktop development. Now win8 is integrating html5+js heafily into the desktop and the Mozilla app project is pushing in a similar direction. In many ways I think it makes sense (I find

[web2py] Re: missing FROM-clause entry

2012-03-23 Thread monotasker
I may be off target but I just recently noticed the .as_dict() method for rows objects. This converts the rows object to a regular dict (instead of a gluon storage object) which can be stored in session or cache (i.e., it's picklable). If you need the query (not the resulting rows object) to be

[web2py] Re: Getting started in Web2py

2012-03-23 Thread monotasker
I think I understand a bit what you mean about not feeling like you understand the "guts" of web2py at first. The book wants to walk you through app-building before introducing you to much of the core, even conceptually. I think this is actually a good pedagogical move for lots of people, but f

[web2py] Re: [article] Best Practices for web/mobile apps

2012-03-20 Thread monotasker
This makes frameworks like Twitter Bootstrap even more attractive if they get us part of the way there. On Tuesday, March 20, 2012 8:14:26 AM UTC-4, rochacbruno wrote: > > > Useful information, worth reading it! > > http://www.w3.org/TR/mwabp/ > > > > -- > > Bruno Rocha > [http://rochacbruno.com

Re: [web2py] a .contains() query with virtual field

2012-03-15 Thread monotasker
find() to fiter that rows. > > On Thu, Mar 15, 2012 at 5:55 PM, monotasker wrote: > >> I had a nice query set up and working that looked for any match between >> items in a list and records in a list-reference field: >> >> catXtags = [2,4,6,7,9] >> curr_lo

[web2py] a .contains() query with virtual field

2012-03-15 Thread monotasker
I had a nice query set up and working that looked for any match between items in a list and records in a list-reference field: catXtags = [2,4,6,7,9] curr_loc.id = 6 db((db.paths.tags.contains(catXtags)) & (db.paths.locations.contains(curr_loc.id)) I changed db.paths.tags to be a virtual f

[web2py] Re: custom css

2012-03-12 Thread monotasker
ght_sidebar_enabled: right_sidebar_style = 'style="display: > block;"' > else: right_sidebar_style = 'style="display: none;"' > style_content = 'style="width: %s"' % width_content > }} > > > <scrip

[web2py] Re: custom css

2012-03-12 Thread monotasker
Can you post the parts of your css code that aren't working? Ian On Sunday, March 11, 2012 7:39:42 AM UTC-4, frasse wrote: > > Hi > > I like to use my custom css and add it to my application base.css mess > my application. I have remove base.css and move classes .flash > and .error to my cust

Re: [web2py] add classes to individual menu items

2012-03-12 Thread monotasker
That does it. Great! Was this in the book somewhere? Ian On Monday, March 12, 2012 2:08:18 PM UTC-4, Martin.Mulone wrote: > > I think you can do: > > (T('my item'), True, A('My item', _href=URL('default', 'index'), _class = > 'my_it

[web2py] add classes to individual menu items

2012-03-12 Thread monotasker
I want each of my app menu items to have a distinct class to ease theming (I'm using background images to provide icons in place of text). It looks like the MENU helper doesn't allow _class arguments in the items in response.menu. So I can just modify the MENU helper, but am I missing some way

Re: [web2py] Ways to check auth conditions (aside from decorating a whole function)

2012-03-12 Thread monotasker
you read it > carefully. > > http://web2py.com/books/default/chapter/29/9#Authorization-and-CRUD > > Your is_member = > > auth.has_membership(group_id, user_id, role) > > * > * > > * > * > > Does it help? > > Richard > > On Mon, Mar

[web2py] Ways to check auth conditions (aside from decorating a whole function)

2012-03-12 Thread monotasker
In digging through the discussions here I've come across two auth methods that allow for checking a user's authorization: auth.is_logged_in() and auth.has_permission() These are really useful, but aren't documented in the web2py book (They're used a couple of times in other recipes, but the

[web2py] Re: problems refreshing component from link in svg image

2012-02-29 Thread monotasker
gt; window.parent.web2py_component("/paideia/exploring/index.load","page") > > Anthony > > On Wednesday, February 22, 2012 5:18:15 PM UTC-5, monotasker wrote: >> >> I'm using an svg image as a navigation map, with areas that can be >>

[web2py] problems refreshing component from link in svg image

2012-02-22 Thread monotasker
I'm using an svg image as a navigation map, with areas that can be clicked. I've got the interactivity working via an external javascript, but when I try to call web2py_component() I get an error telling me that web2py_component is not defined. I assumed that I could call it since this script i

[web2py] Re: How can I get the formatted value of each row in a db query?

2012-02-14 Thread monotasker
Thank you sooo much! I never would have figured that out. I really appreciate your help. Ian

[web2py] Re: How can I get the formatted value of each row in a db query?

2012-02-14 Thread monotasker
OK, I'm trying to create a generic controller function that will list the rows in a table, representing each row using a flexible format that can be user-defined (this is all for a plugin to provide a list-and-edit-records widget). My testing model includes this table definition: db.define_tab

Re: [web2py] Can't figure out how to process query in a module

2012-02-14 Thread monotasker
Is the problem with passing db to the module function? I got tripped up until I realized that "current" objects needed to be retrieved *within the function* (i.e., after "def myindex()"). Here you seem to be passing the "current" objects as arguments to the function. I don't know whether that w

[web2py] How can I get the formatted value of each row in a db query?

2012-02-14 Thread monotasker
I haven't been able to figure this out: I want to use the "format" representation defined in my db model to represent the rows in a list of query results. In other words, I'd like to be able to do something like this: rowlist = [] q = db(db.mytable.id > 0).select() for r in q: rowlist.appen

[web2py] How to keep plugins up-to-date across apps

2012-02-13 Thread monotasker
I'm using a lot of custom plugins to allow re-use of code across several of my web2py apps. But since the plugins are in a state of constant updating, it's getting to be a pain to keep them all in sync. I use git for version control (one repo for each app) and for deployment (on Fluxflex). I've

[web2py] Re: Is the undocumented ListWidget in sqlhtml safe?

2012-02-03 Thread monotasker
Great. Thanks again. I really appreciate your help.

[web2py] Re: Form in component submits (blank) when component first loads

2012-02-03 Thread monotasker
Ah. Now I understand. Thanks a lot for explaining. Sometimes it's the basic structural things I miss!

[web2py] Re: Is the undocumented ListWidget in sqlhtml safe?

2012-02-03 Thread monotasker
That's good news. I'm a bit confused, though, since it doesn't seem to be the default widget for list:reference fields, which are presented by default in a multiple select widget (or does list:reference not fall under list:?). Also, the list widget isn't included in the list of available widget

[web2py] Is the undocumented ListWidget in sqlhtml safe?

2012-02-03 Thread monotasker
I'm continuing to work in fits and starts on my ajaxselect plugin (I'll post an update and bugfix soon, hopefully with a proper demo). In the process, I came across the ListWidget method in sqlhtml. It's quite a nice way to implement multi-reference field. But it's not documented in the 4th edi

[web2py] Re: Form in component submits (blank) when component first loads

2012-02-03 Thread monotasker
I suppose I could! But I'd like to understand the underlying issue -- why the form seems to submit blank when the component loads (hence the else condition firing).

[web2py] Re: Form in component submits (blank) when component first loads

2012-02-01 Thread monotasker
I include a comments plugin in my main view: {{=plugin_comments()}} That plugin calls this controller: #checks to see whether hidden 'honeypot' field has any text in it (presumably placed there by a bot) def checkfilter(form): form.vars.filter = request.vars.filter if form.vars.filter =

[web2py] Form in component submits (blank) when component first loads

2012-02-01 Thread monotasker
In a few different places I'm finding that a SQLFORM form loaded in a component is submitted automatically when the component first loads. It doesn't pass the if form.process() test, and it doesn't throw errors, so I get whatever the "else" condition is in the form submission process. Does anyo

[web2py] Re: Error thrown using sample code from SQLFORM chapter of web2py book

2012-02-01 Thread monotasker
OK, in that case maybe the book example should be changed since the code doesn't quite work as given on p. 331.

[web2py] Error thrown using sample code from SQLFORM chapter of web2py book

2012-01-31 Thread monotasker
I'm trying to add a hidden form to a SQLFORM using the sample code on p. 331 of the 4th edition book (pdf): form.vars.a = request.vars.a form = SQLFORM(..., hidden=dict(a='b')) When I submit the form, though, I get an error because I'm calling the variable 'form' before assignment. If I reverse

[web2py] Re: Any advice on spam control for a comment system?

2012-01-31 Thread monotasker
Thanks. I think I'll try the honeypot (hidden field) approach and see how successful it is.

[web2py] Re: Any advice on spam control for a comment system?

2012-01-31 Thread monotasker
Thanks Benjamin. That sounds quite simple.

[web2py] Any advice on spam control for a comment system?

2012-01-28 Thread monotasker
I'm about to deploy a simple blog platform for myself and have implemented comments using something very much like Massimo's example in the components chapter of the web2py book. What I'm wondering about, though, is spam control. At the moment I think I'm just going to activate recaptcha for the

Re: [web2py] PyCharm for web2py development -- interest in a third-party plugin?

2012-01-21 Thread monotasker
Well, I heard back about plugin development and it turns out that plugins can only be written in Java. That rules me out. I'm still trying to get my mind around Python. But the plugin API is available at http://confluence.jetbrains.net/display/IDEADEV/PluginDevelopment if you or anyone else wan

[web2py] Re: PyCharm for web2py development -- interest in a third-party plugin?

2012-01-21 Thread monotasker
Yeah, I'm not sure either. And I'm not sure it matters as much as having good interactions going forward.

[web2py] Re: error importing custom modules into controller

2012-01-20 Thread monotasker
In case anyone else runs into a similar problem, it turns out that I was handling DAL and Crud improperly in the modules I was trying to import. For db, I added this in db.py right after the initial definition of db: current.db = db Then in my model, in any function that used db, I could just r

[web2py] error importing custom modules into controller

2012-01-19 Thread monotasker
I'm moving a whole bunch of (perfectly functional) business logic from model files to custom modules. But when I try to import the modules in my controllers custom_import is throwing an error. Here's the traceback: File "/home/ian/web2py/gluon/restricted.py", line 204, in restricted exec c

Re: [web2py] PyCharm for web2py development -- interest in a third-party plugin?

2012-01-18 Thread monotasker
Well, I'd really like to use pydev, but I just find that it's too resource intensive. I do a lot of work on a souped up netbook and eclipse *really* churns. PyCharm is a Java application too, but it positively sings beside eclipse. I'm generally really committed to open source (I eat sleep and

Re: [web2py] PyCharm for web2py development -- interest in a third-party plugin?

2012-01-18 Thread monotasker
Sorry for the delayed response. I'm going to have to ask them about docs. I haven't found them in the obvious places.

[web2py] PyCharm for web2py development -- interest in a third-party plugin?

2012-01-13 Thread monotasker
I had an email exchange over the last couple of days with a developer at Jetbrains who works on PyCharm. The bad news is they've chosen not to work on web2py integration any time soon. The even worse news (from my perspective) is that they seem to have a very negative impression of the web2py c

[web2py] Re: How to get name of linking field from two table names

2012-01-11 Thread monotasker
Great! Thanks!

[web2py] How to get name of linking field from two table names

2012-01-11 Thread monotasker
I have a function in which I have two table names 'db.A' and 'db.B'. There is a field in db.A that links to the id field of db.B. But I don't know what that linking field is called in db.A. Is there a way to find this out programmatically? (This is the last nut to crack before I can release the

Re: [web2py] New select widget plugin available for testing

2012-01-09 Thread monotasker
Thanks, Bruno. I've been writing this for an app that isn't finished yet, but I'll try to at least get some screenshots up soon. And thanks, by the way, for all your coaching as I've been learning web2py. I need to add a "thanks" section to the README.

[web2py] Re: New select widget plugin available for testing

2012-01-09 Thread monotasker
I forgot to add that the one dependency of this plugin is jquery-ui (for the dialog). I'd be interested to know what people think of this. Should I write a little dialog script of my own so that there are no external dependencies, or should I avoid reinventing the wheel and use jquery-ui?

[web2py] New select widget plugin available for testing

2012-01-09 Thread monotasker
le as selectable options. You can download or clone the file from the github repository: https://github.com/monotasker/plugin_ajaxselect In one sense this is a duplication of the "select_or_add" module that has been available on web2py slices. Under the hood, though, they are quite different

[web2py] Re: Problem with form submission in nested components

2011-12-18 Thread monotasker
OK, I found the problem. I wasn't actually returning the OptionsWidget.widget object during form creation. I was returning a LOAD helper which then inserted the OptionsWidget.widget object at a second stage. It looks like the accepts() method looks at the *widgets returned during form building*

  1   2   >