[web2py] Re: How do you issue a command to the operating system in web2py?

2014-11-17 Thread Cliff Kachinske
Why do you want to do that? On Friday, November 14, 2014 4:01:25 PM UTC-5, BitHui wrote: > > I'm trying to run a shell command in Linux from web2py? Is that possible > and how would you accomplish that? Thanks in advance. > -- Resources: - http://web2py.com - http://web2py.com/book (Documenta

[web2py] Re: Query of two dates sql server

2014-11-17 Thread Cliff Kachinske
The online manual explains it here: http://web2py.com/books/default/chapter/29/07/forms-and-validators#Date-and-time-validators If I recall correctly, it may also be necessary to make an entry in your language dictionary. But try it first without such an entry. On Monday, November 17, 2014 5:49

[web2py] Re: second page to be accessed only from first page

2014-11-17 Thread Cliff Kachinske
I believe the book is correct. Are you sure the redirect doesn't work? request.function should be "second" if that was the requested function. The redirect occurs after the request is parsed. On Saturday, November 15, 2014 4:58:15 AM UTC-5, T.R.Rajkumar wrote: > > In book chapter 3 overview the

[web2py] Re: pagination issue redirecting to the current page

2014-11-17 Thread Cliff Kachinske
Put information about the current page in the request.args dictionary. You could use the session, but if your user opens a second browser window it becomes difficult to keep track of which session data corresponds to which browser tab. On Friday, November 14, 2014 8:37:25 PM UTC-5, Joe wrote: >

[web2py] Re: import app from one web2py server to another

2014-11-13 Thread Cliff Kachinske
Is there a modules/__init__.py ? On Monday, November 10, 2014 2:44:44 PM UTC-5, John Davis wrote: > > Hello > > I have an app written by someone which runs on our server. I have tried > to copy this app from one server to a new one which also runs web2py. I > use the admin site GUI for web2py

[web2py] Re: Odd field validation issue

2014-11-11 Thread Cliff Kachinske
hey sometimes > may seem redundant, it is important to maintain the distinction when > programming with the DAL." > > On Tuesday, November 11, 2014 10:36:41 AM UTC-5, Cliff Kachinske wrote: >> >> This field will not fail validation when submitted empty. Web2py 2.8.2 >

[web2py] Odd field validation issue

2014-11-11 Thread Cliff Kachinske
This field will not fail validation when submitted empty. Web2py 2.8.2 with lazy tables and archiving. REQUIRE_MSG = SPAN('Required', _style="color:orange;") Field( 'problem_title', length=512, required=True, comment=REQUIRE_MSG,

[web2py] Re: Coding gotcha: views process commented-out html, can raise exceptions

2014-11-07 Thread Cliff Kachinske
browsers), so it would not > be desirable for the template code inside HTML comments to be ignored. > > Anthony > > On Friday, November 7, 2014 9:03:34 AM UTC-5, Cliff Kachinske wrote: >> >> Code like the following will raise an exception in a view. >> >> {{

[web2py] Re: In views: using globals().get('somevalue') vs response.somevalue in views

2014-11-07 Thread Cliff Kachinske
I would set response.foo in the controller. By attaching foo to the response object I don't have to put it in the return dictionary. Saves code on the controller side, too. On Friday, November 7, 2014 9:01:08 AM UTC-5, Leonel Câmara wrote: > > Nothing wrong with it. To me the globals way advanta

[web2py] Coding gotcha: views process commented-out html, can raise exceptions

2014-11-07 Thread Cliff Kachinske
Code like the following will raise an exception in a view. {{ foo='bar' # fubar='nothing' }} Even though the html is commented out, Web2py will process it and try to find an object named fubar. Since it's not defined in the view, you get an exception. I mention this because (a) it's puzzlin

[web2py] In views: using globals().get('somevalue') vs response.somevalue in views

2014-11-07 Thread Cliff Kachinske
In views we might use code something like this {{bar = globals().get('foo')}} {{if bar:}} Got bar! {{pass}} Why not just use the response instead? {{if response.foo:}} Got foo! {{pass}} Seems like it would be less code, one less function call. Anything wrong with it? -- Resources: - http:

[web2py] Re: postgreSQL: restoring pg_dump using executesql

2014-10-08 Thread Cliff Kachinske
Do this instead: psql -U - h localhost -d < your_dumpfile.sql psql will ask you for a password. Use your web2py user's password. Create the database first, but don't create any tables or anything else. On Wednesday, October 8, 2014 12:18:50 PM UTC-4, Manuele wrote: > > Hi! > Is there a way

[web2py] Re: foreign key constraint failed

2014-09-26 Thread Cliff Kachinske
This post on StackOverflow may help http://stackoverflow.com/questions/9636053/is-there-a-way-to-get-the-constraints-of-a-table-in-sqlite There is a code snippet you might try. On Monday, September 22, 2014 5:01:11 PM UTC-4, Anna Kostikova wrote: > > Hi everyone, > > I am having an issue when ed

[web2py] Re: Javascript in web2py view

2014-09-26 Thread Cliff Kachinske
First thing, read up on the ajax functionality in Web2py. It's way simpler than jQuery ajax and will work just fine for what you want to do.l Consider using the ":eval" target in Web2py ajax. It will allow you to send JavaScript snippets back to the server. That way you can do things like this

Re: [web2py] Re: Deploy Web2py on Windows Server 2008 VPS on godaddy

2014-09-26 Thread Cliff Kachinske
Sorry, no can help. On Friday, September 26, 2014 6:12:06 AM UTC-4, Viren Patel wrote: > > Hi Cliff, > > Actually i have already done investment in Server with godaddy for a year > > Let me know if you have done web2py with Windows > > Regards, > Viren > > On Th

[web2py] Re: Deploy Web2py on Windows Server 2008 VPS on godaddy

2014-09-25 Thread Cliff Kachinske
Viren, There are better hosting solutions available. Pythonanywhere, for example, supports Webg2py out of the box. On Thursday, September 25, 2014 10:41:21 AM UTC-4, Viren Patel wrote: > > Hi all, > > i have bought the Windows server 2008 to deploy my Web2py application > > Wanted to know follow

Re: [web2py] Re: ssl certificate?

2014-09-16 Thread Cliff Kachinske
+1 on Namecheap On Monday, September 15, 2014 10:16:12 AM UTC-4, Anthony wrote: > > For non-free certificates, various Comodo, GeoTrust or Thawte resellers >> have certificates in the 5 to 30 USD per year range (email / domain >> verification). If you need business entity verification, prices ar

[web2py] Re: map weirdness

2014-09-10 Thread Cliff Kachinske
> > Anthony > > On Wednesday, September 10, 2014 10:10:47 AM UTC-4, Cliff Kachinske wrote: >> >> Python does as below. SELECT does otherwise. I was curious as to why. >> >> >> In [1]: foo = ['bar', 'baz', 'bazzle'] >&g

[web2py] Re: map weirdness

2014-09-10 Thread Cliff Kachinske
Python does as below. SELECT does otherwise. I was curious as to why. In [1]: foo = ['bar', 'baz', 'bazzle'] In [2]: def func(str): ...: return 'fu{}'.format(str) ...: In [3]: map (func, foo) Out[3]: ['fubar', 'fubaz', 'fubazzle'] In [4]: def printem(lis): ...: for l in li

[web2py] map weirdness

2014-09-10 Thread Cliff Kachinske
Does anyone have a clue why this code def make_option(row): return OPTION(row[1], _value=row[0]) q = ''' SELECT id, name FROM products WHERE is_active = 'T' AND tenant_link = {} AND is

[web2py] Re: Strange but useful THEAD trick!

2014-09-10 Thread Cliff Kachinske
Are you sure that's a feature and not a bug? On Wednesday, September 10, 2014 3:32:24 AM UTC-4, Joe Barnhart wrote: > > I often use the web2py helpers to build my tables on the fly. I've always > thought it was strange that my THEAD() helper seemed to prefer wrapping its > components inside a T

[web2py] Re: Customize SQLFORM.grid

2014-09-10 Thread Cliff Kachinske
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#format--Record-representation Not entirely sure if the record representation technique will work, but maybe you could use the lambda to call a named function that renders the divs for each thumbnail. I think the css wi

Re: [web2py] a proposal for form improvement

2014-09-05 Thread Cliff Kachinske
SQLFORM is still gonna be there, just deprecated. Which I believe means bug fixes only at this point. As long as there are gluon.html and gluon.sqlhtml you can continue as accustomed. On Friday, September 5, 2014 1:06:17 PM UTC-4, viniciusban wrote: > > I don't agree with killing a way to sen

[web2py] smartgrid form submit button behaviour

2014-09-02 Thread Cliff Kachinske
Why not use a drop down field? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups

[web2py] Re: two forms submitted into the same cotroller

2014-09-02 Thread Cliff Kachinske
Here is what I do. Your page should have one form only. Make 2 divs. Top div has your fixed fields including the one that triggers the variable content. Use jquery to catch the change event for the field. When the field changes send an Ajax request to the server. Let the server build the v

[web2py] Re: Philosophical help with REST

2014-09-02 Thread Cliff Kachinske
Your table primary key doesn't have to be an integer. Maybe you could abbreviate the club names and slugify them using IS_SLUG. Of course you then will have to jump through some legacy table hoops with the DAL. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http:/

[web2py] Re: (Very) Slow raw SQL queries

2014-08-25 Thread Cliff Kachinske
Why is '\n', the newline character, sprinkled throughout your query? See what happens if you get rid of them. On Monday, August 25, 2014 4:54:53 AM UTC-4, Mehmet A. wrote: > > Hi, > db.executesql() takes 30 seconds to return a result while page-loading, > despite the fact that same query takes 0

[web2py] Re: one-to-many relations and form for crerate records

2014-08-20 Thread Cliff Kachinske
Here is what I would do. On the client have a var contact_count = 0 All of your starting contact fields will have a suffix "__0" When the user clicks the add contact button, use Javascript to increment the contact_count and write another set of contact fields. This time set the suffix to "__1"

Re: [web2py] Slow first time access on production with Ubuntu/NGINX/UWSGI

2014-08-20 Thread Cliff Kachinske
The install script in the book may not be correct for your version of Web2py. A good first step might be to check the script's config settings against the ones from the book. On Wednesday, August 20, 2014 4:49:28 PM UTC-4, Jim S wrote: > > I did this and after waiting 45 minutes and re-testing,

[web2py] Re: Strange ajax problem

2014-08-15 Thread Cliff Kachinske
Michael, one final thought. To get a better handle on what's going on, in Chrome or Firefox press F12 to bring up the developer tools. Click the Network tab and play around with submitting your forms. You can look at the entire conversation. On Friday, August 15, 2014 8:55:41 AM UTC-4, Michae

[web2py] Re: Strange ajax problem

2014-08-14 Thread Cliff Kachinske
> > > "modal"> >× "sr-only">Close > >Enter Notes > id='form-feedback'> > > >

[web2py] Re: float usage; 2 decimals

2014-08-14 Thread Cliff Kachinske
What database? Web2py has a decimal datatype which, in my use cases, mimics the Python decimal datatype. I use Postgresql and the adapter turns Python decimal into Postgres numeric. Both of these types act like real world decimal numbers. In other words, .2 + .1 comes out to .3. Of course a di

[web2py] Re: CSS issue with embedded form

2014-08-14 Thread Cliff Kachinske
That's kind of an inappropriate use of the h2 tag for starters. Why not put it inside a tag set and style fake-h2 however you like. On Wednesday, August 13, 2014 11:30:27 PM UTC-4, Joe wrote: > > I am just learning web2py and I love it!!! > > I am experimenting with it so I can learn it. > > TH

[web2py] Re: Strange ajax problem

2014-08-13 Thread Cliff Kachinske
the event and why > it doesn't think the response is succesful which I assume is why the button > is not re-enabled. > > On Wednesday, August 13, 2014 5:18:42 PM UTC-4, Cliff Kachinske wrote: >> >> get rid of the target in your ajax call and use ':eval' instea

[web2py] Re: Hypermedia API and Collection+JSON in web2py

2014-08-13 Thread Cliff Kachinske
Massimo, The new recipe you propose is "bottle+dal+validators+auth+collection" Could it be "bottle++validators+auth+collection? I have found myself needing to execute complex SQL queries. In this situation, in my opinion, psycopg2 would serve me just as well as dal. On Sunday, June 22, 2014

[web2py] Re: Strange ajax problem

2014-08-13 Thread Cliff Kachinske
get rid of the target in your ajax call and use ':eval' instead. Then reset the button in your response. On Sunday, May 4, 2014 9:33:05 AM UTC-4, John Drake wrote: > > I've created a simple ajax form to update a "post" database. For some > strange reason when I post a new message, the button gr

[web2py] Re: What is the right way to serve static files through a CDN ?

2014-08-13 Thread Cliff Kachinske
If, like me, you use the same static files on every page, just hard code them into layout.html. I realize this may make upgrading more, um, interesting, but it's much simpler than pattern-based routing. On Wednesday, August 13, 2014 11:23:52 AM UTC-4, Louis Amon wrote: > > I am using a CDN and

[web2py] Re: add static files to header from a module

2014-08-13 Thread Cliff Kachinske
Put the appending code in the controller. On Wednesday, August 13, 2014 7:14:46 AM UTC-4, pa...@cancamusa.net wrote: > > > Dear all: > In the process of moving functionality from models to modules, I'm trying > to add some filesto the header. When the file was in models, I did: > > respon

[web2py] Re: multiple SQLFORM.grid on tabs

2014-08-11 Thread Cliff Kachinske
I would just use ajax or LOAD. If you really want to use grid, something like this might work. In the view: {{=form_0}} {{=form_1}} {{=form_...}} In the controller: def some_func(): form_0 = SQLFORM.grid(whatever) form_1 = SQLFORM.grid(whatever_else) form_... = SQLFORM.gr

[web2py] Re: Security advice for updating records

2014-08-10 Thread Cliff Kachinske
On the client side who cares? On Sunday, August 10, 2014 5:38:31 PM UTC-4, desta wrote: > > Thank you. But still the user is able to tamper data on client side right? > > On Sunday, August 10, 2014 11:00:47 PM UTC+3, Cliff Kachinske wrote: >> >> Each user has a unique gr

[web2py] Re: Security advice for updating records

2014-08-10 Thread Cliff Kachinske
Each user has a unique group with only one member: him. So in your controller, something like def my_great_function(): # Not sure if Web2py session supports get, session.get(auth.user.id, 'nobody') would be more # concise than the next 4 lines of code. if 'auth' in session: # def

[web2py] Re: Web2py vs ruby on rails for a startup?

2014-08-10 Thread Cliff Kachinske
My opinions: Size of community is not as important as willingness to provide good, timely help. The Web2py community is second to none in these respects. The Web2py learning curve is such that ... well, if you hire a good Python dev you will soon have a good Web2py dev. I have not found this

[web2py] Re: IDE for using web2py on windows

2014-08-10 Thread Cliff Kachinske
Another vote for Pycharm. My approach is a little different from Massimo's, though. I import each class that I use in a function. It can be a lot of boilerplate, but it gives me full use of Pycharm's error detection capability. With the Pycharm project set up in the Web2py folder, I do somethi

[web2py] Re: Web2py With Pycharm project on remote Server

2014-08-09 Thread Cliff Kachinske
I agree with Massimo. Unless your situation forbids it, the simplest thing would be to code on your local workstation and push code to the server with git or whatever version control system is in use. If there's no version control system on the server you can even use rsync. But you should use

[web2py] Re: Powered by Web2py: www.sklad05.si

2014-08-09 Thread Cliff Kachinske
Very nice. I like the way the pages adapt to changing viewport sizes. Good decision on shrinking the pictures across the top, I think. If you don't mind my asking, what CSS/javascript magic are you using? Or is it all htm5? On Saturday, August 9, 2014 11:16:24 AM UTC-4, Najtsirk wrote: > > Hi,

[web2py] Re: menu creation error

2014-08-08 Thread Cliff Kachinske
What are the respective file names? Web2py runs the model files in alphabetical order. On Friday, August 8, 2014 3:10:09 PM UTC-4, ocascante wrote: > > > Hello, > > I am trying to create a menu following a web2py video in youtube: > http://www.youtube.com/watch?v=_4to_44DcJU > > This is my db: >

Re: [web2py] Nginx and uwsgi Internal Server Error

2014-08-08 Thread Cliff Kachinske
Richard, I used the ubuntu install script on a VPS at Digital Ocean. No problem. On Friday, August 8, 2014 9:53:22 AM UTC-4, Richard wrote: > > Yes Jim, it great if you come up with a ubuntu 14.04 tested script and you > share with us. > > Regards > > Richard > > > On Thu, Aug 7, 2014 at 3:07 PM

[web2py] Re: How do you display created_by and modified_by names and not id's when using lazy tables?

2014-08-06 Thread Cliff Kachinske
Put the represent in the controller. On Wednesday, August 6, 2014 1:36:51 PM UTC-4, Michael Beller wrote: > > When I set lazy_tables=True in the DAL, all my signatures fields show the > user_id and not the user name. > > I also set db.auth_user._format = '%(last_name)s' which I thought would > f

[web2py] Re: ajax posts text input twice when name and id are identical

2014-08-06 Thread Cliff Kachinske
ow the relevant HTML? What does the post data look like? > > On Wednesday, August 6, 2014 5:48:33 PM UTC+2, Cliff Kachinske wrote: >> >> This is not supposed to happen and I don't know why it did. >> >> The js looks like this: >> $(&#

[web2py] Re: How to add CSS class to SQLFORM.grid??

2014-08-06 Thread Cliff Kachinske
I would go the other way and override the attributes of the existing classes with my own css. Just make sure your css loads last. On Tuesday, August 5, 2014 5:17:42 PM UTC-4, greenpoise wrote: > > How can I make use of my own td classes for SQLFORM.grid?? > > Thanks > -- Resources: - http://

[web2py] ajax posts text input twice when name and id are identical

2014-08-06 Thread Cliff Kachinske
This is not supposed to happen and I don't know why it did. The js looks like this: $('#products_on_order').on('click', '.edit_bound_container', function(e){ //alert(this.id); var container_id = this.id.split('__')[1] var count_field = 'bound_container_count_edit__' + con

[web2py] Re: web2py vs others. Status of 2014

2014-08-06 Thread Cliff Kachinske
Modernizr? Do you think that tall corn interferes with the purchase of new equipment? Whiskey Tango Foxtrot? On Tuesday, August 5, 2014 3:35:50 AM UTC-4, Joe Barnhart wrote: > > I look forward to Massimo's improvements. > > One of the continuing thorns in my side is that a significant number of

[web2py] Re: SQLFORM doesn't have SELECT element values

2014-07-22 Thread Cliff Kachinske
The Chrome developer tools should show the dragged-to select being populated as you drag things across. If things aren't moving look in the "console" tab for errors. Also you can insert alert statements into the javascript to see if the events are firing. On Tuesday, July 22, 2014 5:01:55 PM

[web2py] Re: form.process(onvalidate=some_function) blocks custom validator?

2014-07-17 Thread Cliff Kachinske
I've worked around it, so not a concern at this very moment. If I ever get out of crunch time I"ll look into it. Cliff Kachinske On Thursday, July 17, 2014 11:59:57 AM UTC-4, Anthony wrote: > > Here's the framework code: > > status = self._traverse(status, h

[web2py] Re: form.process(onvalidate=some_function) blocks custom validator?

2014-07-17 Thread Cliff Kachinske
It appears not to. If I put a print statement in there it never executes. If I tell it to return the value and some arbitrary string it doesn't happen. On Thursday, July 17, 2014 6:56:41 AM UTC-4, Leonel Câmara wrote: > > Do you mean onvalidation? It's supposed to run your validators first. > >

[web2py] Pinging Massimo: why Bottle as opposed to Flask?

2014-07-17 Thread Cliff Kachinske
Massimo, In the Reddit thread you mentioned experimenting with Bottle + Dal. Why Bottle? Thanks, Cliff Kachinske -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report

[web2py] form.process(onvalidate=some_function) blocks custom validator?

2014-07-17 Thread Cliff Kachinske
I use a custom validator for list:string fields. If I use onvalidate with form.process, the validator is not called. It's easy to work around this situation, but it took some time to figure out what was going on. It might be beneficial to document this behavior. -- Resources: - http://web2

[web2py] Re: Updating database outside web2py

2014-07-07 Thread Cliff Kachinske
I would use the native Python adapter for what you want to do. There is less code to load and execute, thus less memory, less time and fewer opportunities for error. The only possible drawback is you will need to write some SQL. On Thursday, July 3, 2014 12:53:34 AM UTC-4, Mayank Kumar wrote: >

[web2py] Re: {{=XML(row.contents, sanitize=True)}} and

2014-07-02 Thread Cliff Kachinske
You can tune the tags and attributes that XML will allow. XML has a parameter called "permitted_tags." It is a list of tags that XML will not escape. You could, at the top of your controller, create your own list of permitted tags. Then call XML like this: XML(row.contents, sanitize=True, pe

[web2py] Re: Silent dal failure with missing field def. Maybe a bug?

2014-07-02 Thread Cliff Kachinske
ou want to catch such errors, use the > more explicit .update() method. > > Anthony > > On Tuesday, July 1, 2014 5:39:36 PM UTC-4, Cliff Kachinske wrote: >> >> I would have thought DAL would raise an exception here, but the failure >> was silent. >> >&

[web2py] Silent dal failure with missing field def. Maybe a bug?

2014-07-01 Thread Cliff Kachinske
I would have thought DAL would raise an exception here, but the failure was silent. The postgres table contains these fields: quantity_used | numeric(12,3) | container_count | integer | container_id | integer | restock

[web2py] Re: list:strings not working as described or am I missing something?

2014-06-27 Thread Cliff Kachinske
ithout seeing any code, but clearly the database insert is > not getting a list. > > On Friday, June 27, 2014 12:12:00 PM UTC-4, Cliff Kachinske wrote: >> >> >> <https://lh4.googleusercontent.com/-7k58hj9gv7M/U62UdX1NG4I/AHA/9l6vaRZIxy0/s1600/Screens

[web2py] list:strings not working as described or am I missing something?

2014-06-27 Thread Cliff Kachinske
Web2py 2.8.2, if that matters. The manual at web2py.com says, "On relational databases they [list:string fields] are mapped into text fields which contain the

[web2py] Re: Can't seem to verify password field...

2014-06-26 Thread Cliff Kachinske
Check the data types of element 0 in the tuples. On Thursday, June 26, 2014 3:37:22 AM UTC-4, Encompass solutions wrote: > > I can't seem to get my key to verify: > > This is how I verify it: > > success = db.melodigram.deletion_key.validate(request.args(1)) == > (db(db.melodigram.unique_id == re

[web2py] Re: Need to have "def 4()" and "def dir()" to 301 redirect. Is it possible?

2014-06-25 Thread Cliff Kachinske
You probably need to use the URL rewrite facility. Read here for information about it: http://web2py.com/books/default/chapter/29/04/the-core#URL-rewrite Once your request gets to the web2py router, it will be parsed as follows: www.mydomain.comargs(0)/..args(n)?vars So in the case of www.

[web2py] Re: web2py and self-submission/postbacks - a newcomer asks

2014-06-25 Thread Cliff Kachinske
Graham, I have done form submission both ways. I much prefer self-submission. Much less code to write, so fewer opportunities for error. On Thursday, June 19, 2014 9:30:15 AM UTC-4, Graham Ranson wrote: > > I'm new to python and web2py...I have a small, but non-trivial, web > application and wa

[web2py] Re: Uniqueness in Multi-tenants

2014-06-25 Thread Cliff Kachinske
You could build a custom validator around something like this: new_value.strip() # Leading/trailing white space can fool humans if not db( (db[target_table][target_field==new_value) & (db[target_table].tenant_id==tenant_id) ).isempty(): return new_value, error_message return new_value,

[web2py] Re: Hypermedia API and Collection+JSON in web2py

2014-06-25 Thread Cliff Kachinske
Massimo, I like the way your thoughts are headed. doesn't the many2many issue goes away if one uses, for example, MongoDB? On Sunday, June 22, 2014 4:45:06 PM UTC-4, Massimo Di Pierro wrote: > > I added Hypermedia API support to web2py using Collection+JSON. > Experimental. > Collection+JSON is

[web2py] Re: Why does this happen: DAL returns a tuple & is it supposed to?

2014-06-16 Thread Cliff Kachinske
Leonel, Ah, so it is. Thank you. On Monday, June 16, 2014 10:31:53 AM UTC-4, Leonel Câmara wrote: > > That's just a consequence of python's DB-API (see > http://legacy.python.org/dev/peps/pep-0249/ ) the result is indeed > supposed to be a list of tuples. > > However, web2py's DAL executesql d

[web2py] Why does this happen: DAL returns a tuple & is it supposed to?

2014-06-16 Thread Cliff Kachinske
Why is DAL returning a tuple here? >>> from dal import DAL >>> db = DAL('postgres://web2pyuser:password@localhost:5432/webtest', fake_migrate_all=True) >>> q = '''select coalesce(sum(amount), 0) from product_journal''' >>> db.executesql(q) [(Decimal('250.000'),)] # Why is the returned value a tup

Re: [web2py] going crazy with pyfpdf

2014-05-21 Thread Cliff Kachinske
I've seen this. My leaky memory says pyfpdf doesn't like percentages. Try absolute units and I think it will work. On Wednesday, May 21, 2014 1:04:58 PM UTC-4, Carlos Cesar Caballero Díaz wrote: > > Thanks Mariano and Carlos, there is a simple code: > > controller default.py: > > def pdf_test

[web2py] Help with the eb2py calendar?

2014-05-21 Thread Cliff Kachinske
ajax on its click event, but I think it would be slicker to fire the ajax when the calendar changes. Any thoughts? Thank you, Cliff Kachinske -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p

[web2py] Re: SQLFORM.grid Export and represent

2014-04-16 Thread Cliff Kachinske
There must be something in the request that indicates you want csv or tsv. If it's in the request.args, for example, something like this would work: if 'csv' not in request.args and 'tsv' not in request.args: db.inventory.cpu_status.represent = lambda cpu_status, row: SPAN( ... On Wed

[web2py] routes.py invalid request

2014-04-16 Thread Cliff Kachinske
Using pattern-based routing, I get Invalid Request messages. Usually the routes work OK after restarting nginx. But after closing and restarting Chrome the problem recurs. The failing url is www.dotzle.com/apps This is the routes.py file. I used the nginx setup script. The only change I made

[web2py] Re: great news: Sphinx Documentation

2014-04-14 Thread Cliff Kachinske
Thank you Niphlod. You have done Yet Another Good Thing. On Sunday, April 13, 2014 11:43:26 AM UTC-4, Massimo Di Pierro wrote: > > Great news! We are finally moving to Sphinx. > > http://web2py.readthedocs.org/en/latest/ > > Kudos to Simone (niphlod) who single handedly ported all the docstrings

[web2py] Re: How do I "SELECT * FROM table WHERE field IN (1,2,3,4,7)

2014-04-06 Thread Cliff Kachinske
Kurt, I think the key is to realize that the WHERE clause comes first in DAL dialect, and the fields to be selected come after. On Saturday, April 5, 2014 11:49:28 PM UTC-4, Kurt Jensen wrote: > > How do I do : > > "SELECT * FROM table WHERE field IN (1,2,3,4,7) AND field2='3'"" > > AND / OR > >

[web2py] Re: Question about Web2py inner workings

2014-04-06 Thread Cliff Kachinske
Anthony, thank you. On Sunday, April 6, 2014 8:26:33 PM UTC-4, Anthony wrote: > > # Here is the change >> if found_it: >> print 'Now I\'m going to change it to "pwned."' >> i_am_global = new_val >> > > Above you assign a value to i_am_global. Because you have not explicitly

[web2py] Re: Question about Web2py inner workings

2014-04-06 Thread Cliff Kachinske
creen.print_the_global() print '\n' print 'How about if we change it and print it in the same method?' printer_to_screen.change_and_print_the_global('fubar') print '\n' print "Let's see if the change stuck" printer_to_screen.p

[web2py] Question about Web2py inner workings

2014-04-04 Thread Cliff Kachinske
If I write a python module like this: # born_to_fail.py foo = 'bar' def main(): print foo if __name__=='__main__': main() Python will raise an exception about an unbound local variable. But in Web2py, I do this all the time without getting an exception: #my_controller.py ISEDITOR = auth.ha

Re: [web2py][Javascript] Massimo here searching for some javascript devs ready to port web2py in JS

2014-04-02 Thread Cliff Kachinske
Ha. On Tuesday, April 1, 2014 1:44:01 PM UTC-4, Richard wrote: > > Hello, > > I want to get rid of python entirely. As you probably know, I don't see > great future in Python 3000 and since we can't fighting the Javascript > dominance in webapp development world, I resign... I want to port web2p

[web2py] Re: Database access without DAL but with connection pool

2014-03-20 Thread Cliff Kachinske
Derek, the conventional wisdom is connecting to a db is expensive. I'm willing to be convinced, but I need some data. Can you point me to some? Because if your statement is true, we could eliminate some pretty hairy code in the DAL to support pooling. On Wednesday, March 19, 2014 7:44:10 PM UTC

Re: [web2py] Re: Python Performance Issue

2014-03-17 Thread Cliff Kachinske
Apparently the number of cores is adjustable. Try this link. http://download.parallels.com/desktop/v5/docs/en/Parallels_Desktop_Users_Guide/23076.htm On Monday, March 17, 2014 10:02:13 AM UTC-4, horridohobbyist wrote: > > Parallels VM running on a 2.5GHz dual-core Mac mini. I really don't know >

[web2py] Re: Problem with upgrade to 2.9.4 with SQLTABLE

2014-03-10 Thread Cliff Kachinske
drayco, correct me if I'm wrong but it looks like you didn't make the change Niphlod suggested. The error trace shows you still use db.pagos.id.count() rather than the suggested syntax. On Monday, March 10, 2014 1:22:04 PM UTC-4, drayco wrote: > > With the change, this is the result > > File

[web2py] Re: Help with SQL Query without using executesql preferably :)

2014-03-10 Thread Cliff Kachinske
The DAL chapter of the online Web2py manual explains how to fetch the max value, same as a SQL GROUP BY. On Monday, March 10, 2014 3:54:59 PM UTC-4, brahama von wrote: > > This is the result i get from a simple select like this: > > legacy_db(legacy_db.cursodado.gp_pro_id==course).select() > > cu

[web2py] Re: web2py conference

2014-03-09 Thread Cliff Kachinske
I could not come, but that is wonderful. Congratulations. On Sunday, March 9, 2014 9:14:02 PM UTC-4, Massimo Di Pierro wrote: > > I am happy to report that the 1st web2py conference is already full after > only 5 days since publishing about it: > > http://www.experts4solutions.com/web2py_co

[web2py] Re: multiple response.menu

2014-03-09 Thread Cliff Kachinske
To expand a little on Massimo's explanation. Find the reference to Cooperating Applications in the online manual. Once you have figured out which app will be the master app, you can put all the model files in the master apps models directory, then softlink the files you need in other directorie

[web2py] Re: Force all requests to https - a pointer please

2014-02-27 Thread Cliff Kachinske
request.application)) >> >> >> On Friday, February 28, 2014 11:46:20 AM UTC+13, Cliff Kachinske wrote: >>> >>> I know I have read it somewhere, but I can't find it. >>> >>> Where can I find out how to force all requests to https? >>>

[web2py] Force all requests to https - a pointer please

2014-02-27 Thread Cliff Kachinske
I know I have read it somewhere, but I can't find it. Where can I find out how to force all requests to https? Thank you,m Cliff Kachinske -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.

[web2py] Re: impossible to convert decimal

2014-02-13 Thread Cliff Kachinske
It looks like you have an empty value in the table row where you experience the error. On Thursday, February 13, 2014 6:49:44 AM UTC-5, Robin Manoli wrote: > > Hey, > I have a decimal in db, for which I tried numerous ways to round to two > decimal points, and also to calculate with other number

[web2py] Re: SQLite, SmartGrid, 2.8.2: foreign key constraint failed

2014-02-13 Thread Cliff Kachinske
Can you post the entire field definition for the foreign key field? On Thursday, February 13, 2014 12:39:26 PM UTC-5, Mirek Zvolský wrote: > > I have similar troubles as here: > > https://groups.google.com/forum/?fromgroups#!searchin/web2py/smartgrid$20foreign$20key$20constraint$20failed%7Csort:re

Re: [web2py] web2py on BeagleBone Black: optimizing ajax

2014-02-13 Thread Cliff Kachinske
Michael, I'm curious about this. Do you turn migrate off globally, or on a table by table basis? On Thursday, February 13, 2014 2:38:46 PM UTC-5, Michael Ellis wrote: > > >> >> On Wednesday, February 12, 2014 5:17:02 PM UTC-5, Michele Comitini wrote: >>> >>> run the profiler on the board: >>> >>>

[web2py] Re: How can I show response.flash messages with different styles?

2014-02-12 Thread Cliff Kachinske
response.flash = SPAN('flash message goes here', _class='whatever') On Wednesday, February 12, 2014 8:54:46 PM UTC-5, User wrote: > > I am using bootstrap 2.3.2 and I would like to use Bootstrap css alert > classes to style response.flash. These include: > alert > alert-error > alert-success > a

Re: [web2py] Re: IS_IN_DB validator dropdown formatting

2014-02-11 Thread Cliff Kachinske
Have you tried simplejson.dump()? On Tuesday, February 11, 2014 12:52:28 PM UTC-5, Jim S wrote: > > Thanks Anthony. Trying this but running into a problem generating the > json to use for the data. Keep getting a javascript error: > > SyntaxError: invalid property id > > data: [{"text": "Skygs

[web2py] Re: ImportError - no module named...

2014-02-11 Thread Cliff Kachinske
The __init__.py file tells Python that the directory is a package. You can also put code in __init__.py. The code will execute when you import the package. Leave it in there. You need it. On Tuesday, February 11, 2014 6:33:41 PM UTC-5, Chris Hepworth wrote: > > > https://groups.google.com/forum

[web2py] Re: Inject HTML in SQLFORM.factory field from client side(js or jQuery)

2014-02-10 Thread Cliff Kachinske
On Monday, February 10, 2014 11:42:34 AM UTC-5, Andrey K wrote: > > Dear web2py users, > I would like to add dynamically fields to SQLFORM.factory defined in the > model in client side by jQuery and then get the added fields values back to > db (by "if form.accepted") via the standard form sub

[web2py] Re: Multiple SOLIDFORMs from table rows

2014-02-10 Thread Cliff Kachinske
Have you tried it without the showid arg? On Monday, February 10, 2014 3:12:36 AM UTC-5, Mike Constabel wrote: > > Hi, > > I try to generate multiple SOLIDFORMS from table rows. > > Simple example in pseudo code: > > x = db(y.z).select() > for d in x: > form=CAT(form, SOLIDFORM(d)) > retur

[web2py] Re: Best practice for a development environment together with a live environment

2014-02-10 Thread Cliff Kachinske
I have used rsync to update models, controllers, views, modules and so on. For database updates I create a separate script and test, test, test it. I don't use the DAL. Sometimes I write SQL, sometimes python using the database driver. Going forward it will probably just be SQL. On a production

[web2py] Re: adding table column/field pro grammatically to existing table under controler

2014-02-07 Thread Cliff Kachinske
Andrey, Not to be negative, but why do you want to do this? On Friday, February 7, 2014 8:07:10 AM UTC-5, Andrey K wrote: > > Thanks Anthony for your concise answer! > I have tried it in the app code - it did not work, giving me no error. I > have tried your code in the terminal and it looks th

[web2py] Re: sqlite <---> postgresql

2014-02-06 Thread Cliff Kachinske
And maybe there's no need to switch. SQLite is not a toy. http://www.sqlite.org/whentouse.html On Wednesday, February 5, 2014 3:02:50 PM UTC-5, Gour wrote: > > Hello, > > Do you consider it's safe to work with web2py on localhost machine and > use sqlite3 database as storage (which greatly simp

[web2py] Re: sqlite <---> postgresql

2014-02-06 Thread Cliff Kachinske
Gour, Maybe I'm missing something, but why would you develop on one back end if your production target is another? If you switch back ends you will need to go through a complete regression test before you deploy. Postgres is not that hard to set up and use. MariaDB/MySQL is equally easy. On

  1   2   3   4   5   >