[web2py] Using SQLFORM.grid to create a parent-child form

2015-03-15 Thread chris_g
I have two tables with a 1-to-many relationship that I would like to represent in a parent-child form. SQLFORM.grid plays quite nicely with the children data, but what I'd like to do is include a row at the top of the form that includes parent data. This is really only a need to add some editable

[web2py] Re: web2py spreadsheet.py - does it use cache.ram correctly?

2015-02-18 Thread chris_g
ject. Notice > there is a problem. This only works when you have a single process sharing > cache.ram. > > On Sunday, 15 February 2015 21:08:11 UTC-6, Massimo Di Pierro wrote: >> >> That line is clearly wrong! >> >> On Sunday, 15 February 2015 19:06:31 UTC-

[web2py] web2py spreadsheet.py - does it use cache.ram correctly?

2015-02-15 Thread chris_g
I am taking a look at the spreadsheet controller in /examples/spreadsheet in web2py Version 2.9.12 (on CentOS 6.6) . The callback function is throwing this error. Traceback (most recent call last): File "/var/www/web2py/gluon/restricted.py", line 224, in restricted exec ccode in environm

[web2py] New Application Wizard - Layout Themes and Plugins

2015-02-09 Thread chris_g
I have noticed that the "New Application Wizard" ( /admin/wizard/step1 ) does not contain any Layout Themes or Plugins. See attachment. According to this post ( https://groups.google.com/d/msg/web2py/frUArP3gp6w/PCx2Z-3gxIkJ ) from 2011, these selections are populated by these AJAX calls: http

Re: [web2py] Use IS_MATCH for optional form entry

2014-04-07 Thread chris_g
Thank you Johann, that worked for me. On Monday, April 7, 2014 4:52:34 PM UTC+10, Johann Spies wrote: > > On 7 April 2014 08:21, chris_g > wrote: > > >> How do I use IS_MATCH for field validation if the field only contains >> data? >> >> This works for

[web2py] Use IS_MATCH for optional form entry

2014-04-06 Thread chris_g
How do I use IS_MATCH for field validation if the field only contains data? This works for me: IS_MATCH('^\d{10}', extract=True, error_message='Telephone number should have 10 digits.') so long as a 10 digit number is required. But what if I a want to make it acceptable to enter a 10 digit num

[web2py] Customisable error messages for a form determined by device type.

2014-03-18 Thread chris_g
I am happily using the web2py FORM and custom validator's for form validation using JSON messaging. The problem I have is a customer wants verbose messages for webpages, but succinct messages for everything else. For eg, On the webpage "You must enter an email address", "A password is required",

[web2py] MySQL insert on table with_alias causing error

2013-04-10 Thread chris_g
I am running web2py.2.0.9 and I get an error on doing INSERTS with MySQL if I define a table with an Alias. Apparently the DAL will attempt to do this SQL: INSERT INTO tbl_favourite_header AS favourite_header(CreationDate,Description,ChangeDate,MemberID) VALUES ('2013-03-01 12:12:10', 'my favo

Re: [web2py] Re: Integrating iPhone device tokens into web2py auth

2013-02-13 Thread chris_g
Thanks for all the interesting responses. Here is Apple's description of the Push notificaiton process: http://developer.apple.com/library/mac/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/ApplePushService/ApplePushService.html There appears to be a similar framework for

[web2py] Integrating iPhone device tokens into web2py auth

2013-02-07 Thread chris_g
I'm looking into supporting Apple push notifications in an iPhone app that connects to a web2py server. In order to know which devices to push details to, web2py's auth module would presumably need to maintain "Device Tokens". I'm curious if anyone has implemented a solution that takes care of th

[web2py] Re: xhtml2pdf / pisa in a web2py view

2012-11-11 Thread chris_g
pisa.CreatePDF(html, dest = doc) return doc.getvalue() return results On Sunday, November 11, 2012 8:53:21 PM UTC+11, Paolo Caruccio wrote: > > did you try appreport (a web2py plugin) > https://github.com/lucasdavila/web2py-appreport ? > > > Il giorno domenica 11 no

[web2py] Re: xhtml2pdf / pisa in a web2py view

2012-11-10 Thread chris_g
I believe I need to use a file reference to the html like this: pdf = pisa.CreatePDF( StringIO.StringIO(html) , result) But I am still getting an empty string. --

[web2py] xhtml2pdf / pisa in a web2py view

2012-11-10 Thread chris_g
Has anyone had any luck running Pisa in a web2py view? I've only had success with using it at the command line: pisa example.html --> pisa.pdf I've tried putting the following in a view, but I am getting an empty string returned. {{ import logging import os import StringIO import xhtml2pd

[web2py] Passing pyodbc timeout argument for a specific request.

2012-10-17 Thread chris_g
I'm using SQL Server with pyodbc on Linux. ( Web2py 1.99.7 ) I have been trying to force a database timeout in certain methods in my controller. I added the following conditional to models/db.py db_connection_string='mssql://dbuser:pwd@dbserver/DB?DRIVER=FreeTDS' if request.function ==

[web2py] Re: Escaping placeholders for db.executesql in MySQL.

2012-10-10 Thread chris_g
Thanks Massimo. That worked for me. --

[web2py] Re: Escaping placeholders for db.executesql in MySQL.

2012-10-10 Thread chris_g
I opened the ticket as you suggested and you've confirmed that in executesql the values in the placeholders argument are passed directly to the driver without escaping. I've tried doing the same call with the MSSQL adaptor using the pyodbc driver. db.executesql("insert into test1 (t1) VALUES (?)

[web2py] Escaping placeholders for db.executesql in MySQL.

2012-10-09 Thread chris_g
Here's an example of a problem that I have with a MySQL database and escaping of executesql placeholders. I am using web2py 1.99.7 on Ubuntu with Python2.5 testDAL works, but testDB throws this error: (1064, u"You have an error in your SQL syntax; check the manual that corresponds to your MySQ

[web2py] Mixing Internationalisation and Business Idiom

2012-02-12 Thread chris_g
I have a conceptual issue about how I design some aspects of an application. I need to make my app customisable with respect to business idiom and in the longer term, I would like my app to embrace internationalisation. I'm curious to know if anyone has ever tackled the issue of business idiom in

[web2py] Re: Web2py won't connect to MSSQL

2011-10-27 Thread chris_g
I recently had a similar problem where I could import pyodbc at the python shell, but I was getting a DLL error when I tried to import pyodbc under mod_wsgi. I suggest that you put "import pyodbc" inside your wsgihandler.py (or at the top of db.py) and see what errors are being produced. I had rece

[web2py] Re: From html view to pdf.

2011-10-24 Thread chris_g
Annet, When I explored this a few years ago, I ended up going with an XML solution called RML (report markup language). This was developed by the makers of reportlab, but there are also free implemntations of RML available (such as the z3c implementation.) Once I had installed rml2pdf developed XM

[web2py] Using SQLCustomType to implement bigint in MySQL

2011-10-12 Thread chris_g
I am trying to define a custom type on a MySQL db and I get the error below. My motivation is to store data in Bigint rather than Integer. bigint = SQLCustomType( type = 'integer', native = 'bigint', ) db.define_table('s1', Field('target_id', bigint) ) db.s1.inser

[web2py] DAL connection to SQL Server 2005 hanging with Linux

2011-10-03 Thread chris_g
I have setup web2py version 1.98.2 on Ubuntu Lucid Lynx. My dal is connecting to SQL Server 2005 using a connection string like this. db_connection_string = r'mssql://dbuser:pword92.168.1.1/mydb? DRIVER=FreeTDS' After my application has been running for some hours or days, there seems to some

[web2py] Change in Row structure for queries on tables with_alias.

2011-09-15 Thread chris_g
I've just deployed 1.98.2 and noticed that some of the with_alias behaviour has changed. With 1.89.1, if I defined my tables like this: db.define_table( 'tbl_site', Field('Code', 'integer'), Field('Name', 'string'), Field('Active', 'integer') ).with_alias('s

[web2py] Re: Using primarykey on the auth tables.

2010-04-14 Thread chris_g
Denes, I also went down this path and this is what I got. When the Auth class references self.user.id it appears to be expecting that the user table will have a field called 'id'. From glancing at the code it appears that self.user.id is expected to be a key in a Storage , so in effect the name of

[web2py] Using primarykey on the auth tables.

2010-04-14 Thread chris_g
I have a client requirement for tables in my database to be prefixed with 'tbl_' and to have an ID field caled recid. For legacy purposes, auth_user is implemented as a VIEW on an existing table. For this reason, my use of the Auth module is becoming quite customised. I had presumed that includi

[web2py] Re: Logging SQL statements.

2010-03-31 Thread chris_g
Thanks, that worked. I made this change to gluons/tools.py until I captured the error. def insert(self, **fields): query = self._insert(**fields) self._db['_lastsql'] = query * logging.error('insert:\n%s'%query) ... On Apr 1, 12:55 pm, mdipierro wrote: > The las

[web2py] Logging SQL statements.

2010-03-31 Thread chris_g
Currently, my sql.log contains the DAL generated SQL statements that were used to generated the database schema. Is there a way to log all SQL statements that DAL generates? I am getting a SQL error after I customised my Auth tables for a legacy database, and I'd like to see exactly what SQL is bei

[web2py:/] Re: Other new DAL features in trunk

2009-11-10 Thread chris_g
This is marvellous news. I read the manual last night and realised that the field ID restriction was the only thing stopping me deploying web2py in conjunction with a major legacy app that I am using. Thanks Michael for getting this feature happening. Can I confirm one thing, with a table like th