Re: [web2py] CSV Import performance improvement idea

2012-02-13 Thread Johann Spies
On 14 February 2012 00:54, Omi Chiba wrote: > I have a problem with the performance of CSV import and I assume it > generate INSERT statement for every record so it will be 8000 > statement if you have 8000 records in csv file. > > Can we use bulk_insert method instead so there will be always onl

Re: [web2py] request.args returns each arg as string

2012-02-13 Thread Bruno Rocha
in the second example the DAL query operator == is taking care of trying to convert your data to the right type. http://zerp.ly/rochacbruno Em 14/02/2012 05:14, "Annet" escreveu: > I posted a question asking why this doesn't work: > > if request.args(0)==1 > > the answer: request.args returns ea

[web2py] request.args returns each arg as string

2012-02-13 Thread Annet
I posted a question asking why this doesn't work: if request.args(0)==1 the answer: request.args returns each arg as string However, in my application I use this multiple times: rows=db(db.node.id==request.args(0)).select(db.node.ALL) where id is of type integer and not string. What is the dif

[web2py] request.args returns each arg as string

2012-02-13 Thread Annet
I posted a question asking why this doesn't work: if request.args(0)==1 the answer: request.args returns each arg as string However, in my application I use this multiple times: rows=db(db.node.id==request.args(0)).select(db.node.ALL) where id is of type integer and not string. What is the dif

[web2py] Re: Multiple different problems - Dealing with "Integrity Error" for nutnull=True and unique=True database fields

2012-02-13 Thread Rahul
All, Pondering over with Anthony's solution, I just uploaded images to static folder and that works wonders for image caching. Below is the code that I changed in db.py for my model - Field('profile_pic', 'upload', uploadfolder=request.folder +'static/user_pics', requires=IS_LENGTH(262144

[web2py] * DATE FIELDS REPRESENT *

2012-02-13 Thread cyber
Hi there! Please help me deal with date representation. For example, I have a date field: Field('date_start', 'date', default = datetime.date.today()) db.contracts.date_start.represent = lambda v:v.strftime('%d.%m. %Y') It works perfectly if I use SQLFORM. But if I use just selection fr

[web2py] Re: How to Change the date format

2012-02-13 Thread Rahul
Hi , import datetime now = datetime.datetime.now() #You probably need something like below -- date = now.strftime("%d %b %Y") Some more cool and excellent Date manipulation and display tactics at: http://www.saltycrane.com/blog/2008/06/how-to-get-current-date-and-time-in/ Regards, Rahul D (www

[web2py] Re: dataTables with serverside json

2012-02-13 Thread Vineet
Yes. As a side note, DABO is written fully in Python itself. It is a full fledged framework using wxPython for GUI. But I am using its database-interaction tier & business-logic tier (dabo.biz & dabo.db). Since we, web2py followers, are using "web2py" as a footing, you may ignore the code regardi

[web2py] Re: dataTables with serverside json

2012-02-13 Thread Vineet
Yes. As a side not, DABO is written fully in Python itself. It is a full fledged framework using wxPython for GUI. But I am using its database-interaction tier & business-logic tier (dabo.biz & dabo.db). Since we, web2py followers, are using web2py as a footing, you may ignore the code regarding

[web2py] Re: Routes.py and janrain login

2012-02-13 Thread lyn2py
Or you can click on "reload routes" in the web2py admin :) On Feb 14, 12:38 am, Rene Dohmen wrote: > Got it working with the example from the web2py book: > > routers = dict( >   BASE  = dict(default_application='formatics'), > ) > > Thank you web2py book :) > > Maybe a nice reminder for people r

[web2py] Join operations on google app engine

2012-02-13 Thread Saurabh S
I have an online application deployed on google cloud. I have used web2py framework to develop the application. I have 2 tables the auth_user table and tasks table.Both of them have more than 1000 records each.The tasks table contains person_id field which stores the id's in auth_user table I ne

[web2py] Re: Conditional deletes (ondelete etc) in sqlform.grid

2012-02-13 Thread Mark Kirkwood
I've worked around this by tackling the issue a different way: - disable the delete button on the grid altogether with deletable=False - selectively enable it in edit mode for records that are safe/appropriate to delete Maybe I should have done it this way to begin with - as it is nicer if th

[web2py] Re: dataTables with serverside json

2012-02-13 Thread Vineet
Yes. As a side not, DABO is written fully in Python itself. It is a full fledged framework using wxPython for GUI. But I am using its database-interaction tier & business-logic tier (dabo.biz & dabo.db). http://www.dabodev.com http://www.dabodev.com/documentation -- Vineet On Feb 13, 8:16 pm, R

[web2py] Re: how to pass db object to component?

2012-02-13 Thread Anthony
Is this an ajax component? In that case, all the LOAD helper is doing is setting up the JS code to make an ajax GET request to the component's URL, so you can't easily pass large amounts of data to the component function. If you only need the results of the query within the component, you might

[web2py] Re: Problem with update [Closed]

2012-02-13 Thread weheh
.

[web2py] how to pass db object to component?

2012-02-13 Thread weheh
What, if any, is the proper syntax for passing a db storage object to a component? In other words: # controller def index(): query=... return dict(data=db(query).select()) # view ... {{=LOAD('c1','f1')}} So where in the LOAD statement can I pass in data as a db Storage or must it be a d

[web2py] Re: Implementing task queue using web2py

2012-02-13 Thread Saurabh S
It worked when I passed a different controller in the url other than the one it is being called from. It is production. I checked the task queue it simply retries continuously if the same controller is provided. No params is not a mandatory argument to takqueue.add() I guess. Because it does not t

Re: [web2py] Re: web2py-python3

2012-02-13 Thread Ovidio Marinho
Do you have tutorial installation. Ovidio Marinho Falcao Neto Web Developer ovidio...@gmail.com ovidiomari...@itjp.net.br ITJP - itjp.net.br 83 8826 9088 - Oi 83 9334 0266 - Claro

[web2py] Re: Is Python 2.5 ok or do I need 2.5.6?

2012-02-13 Thread Anthony
> > At the deployment section of the book now. Earlier I've been running > web2py with python 2.7 but to run from source I need to install 2.5. Actually, if you've been running web2py with Python 2.7, then you have been running the source version of web2py. The version of web2py that comes wit

Re: [web2py] Re: Possibly bug with insert

2012-02-13 Thread Bruce Wade
Deleting the database looks to have fixed it. On Mon, Feb 13, 2012 at 2:24 PM, Bruce Wade wrote: > Yeah I don't think that is the issue because it has worked several times > before, probably a bug in the database I will just rebuild it and try again. > > > On Mon, Feb 13, 2012 at 2:08 PM, Richar

Re: [web2py] Re: web2py-python3

2012-02-13 Thread Bruce Wade
Nice, will there ever be an official web2py on python 3? On Mon, Feb 13, 2012 at 2:21 PM, Vadim K wrote: > Nice port, I would say. > > I'll give it a try -- -- Regards, Bruce Wade http://ca.linkedin.com/in/brucelwade http://www.wadecybertech.com http://www.warplydesigned.com http://www.fit

[web2py] Conditional deletes (ondelete etc) in sqlform.grid

2012-02-13 Thread Mark Kirkwood
I am attempting to implement a check that allows deletes only under some circumstances. I figured I would do this via the ondelete arg in the grid. Unfortunately I have run into a few stumbling blocks with this: 1/ The 1.99.4 code is busted - references 'ret' before it is defined Fortunately a

[web2py] Re: web2py-python3

2012-02-13 Thread Vadim K
Nice port, I would say. I'll give it a try

[web2py] Re: Calling remote program on DB2 from Python/Web2py

2012-02-13 Thread Omi Chiba
I will try tomorrow and let you know. I have RPG to return the price for the given currency (e.g. USD $100 => EUR $76) so it will be a good sample. On Feb 13, 4:13 pm, António Ramos wrote: > Excelent > How to pass parameters and receive result? > > Thank you > António > > 2012/2/13 Omi Chiba >

[web2py] CSV Import performance improvement idea

2012-02-13 Thread Omi Chiba
I have a problem with the performance of CSV import and I assume it generate INSERT statement for every record so it will be 8000 statement if you have 8000 records in csv file. Can we use bulk_insert method instead so there will be always only one INSERT statement which should reduce the perform

Re: [web2py] Re: Possibly bug with insert

2012-02-13 Thread Bruce Wade
Yeah I don't think that is the issue because it has worked several times before, probably a bug in the database I will just rebuild it and try again. On Mon, Feb 13, 2012 at 2:08 PM, Richard Vézina wrote: > Try db.commit() between your two insert... Maybe web2py is doing only one > commit at the

[web2py] Is Python 2.5 ok or do I need 2.5.6?

2012-02-13 Thread Bill Thayer
Thanks to everyone for answering my questions so far. At the deployment section of the book now. Earlier I've been running web2py with python 2.7 but to run from source I need to install 2.5. The python web site has an msi installer for 2.5 but only source code for 2.5.6. http://www.python.org

Re: [web2py] Calling remote program on DB2 from Python/Web2py

2012-02-13 Thread António Ramos
Excelent How to pass parameters and receive result? Thank you António 2012/2/13 Omi Chiba > Posted on web2py slice. > http://www.web2pyslices.com/slices/take_slice/151 > > I'm so excited and it is greater than aha moment for me. We're using > DB2 for our internal web app and now I can do almost

Re: [web2py] Re: Possibly bug with insert

2012-02-13 Thread Richard Vézina
Try db.commit() between your two insert... Maybe web2py is doing only one commit at the end of your function, but since you do insert by hand instead of let the form insert your maybe have to commit... Richard On Mon, Feb 13, 2012 at 4:51 PM, Bruce Wade wrote: > Didn't touch psql. there is 3 re

Re: [web2py] Re: Possibly bug with insert

2012-02-13 Thread Bruce Wade
Didn't touch psql. there is 3 records in that table already, so I was not sure why it would even default to 1. Here is the code that processes after the form is accepted. My code didn't increment anything just standard web2py calls. if ucashmethod.process(formname='ucash').accepted:

Re: [web2py] Re: Possibly bug with insert

2012-02-13 Thread Richard Vézina
He could reset the sequence for sure, but maybe his code induce the increment problem. Richard On Mon, Feb 13, 2012 at 4:46 PM, Ron McOuat wrote: > It is like the sequence for that primary key has started over with a reset > to initial value since the key value that causes the exception is 1. T

[web2py] Re: Possibly bug with insert

2012-02-13 Thread Ron McOuat
It is like the sequence for that primary key has started over with a reset to initial value since the key value that causes the exception is 1. To do that I would think you would have to tweak the sequence with psql while there is data in the table. Ron

Re: [web2py] Possibly bug with insert

2012-02-13 Thread Richard Vézina
I think a bit more of your code controller would be required to understand what's going on... Richard On Mon, Feb 13, 2012 at 4:29 PM, Bruce Wade wrote: > Hi, > > db.define_table('cash_journal', > Field('transaction_type'), > Field('distributor_id', 'integer'), > Field('happen_time'

[web2py] Memcache ??

2012-02-13 Thread Hassan Alnatour
Dear ALL, What is cache and what is memcache ?? i dont understand it ? why we use it , what happens when we use it !!

Re: [web2py] Re: [w2py-dev] Re: Movuca - Social CMS beta 0.1

2012-02-13 Thread Anthony
> > CMS is not a self-contained isolated library and except of very simple > projects, a web application build on top of it will require changes in the > CMS code. > True, but an app might be a mix of directly editing the CMS code plus writing independent code that merely calls the CSM's API.

[web2py] Possibly bug with insert

2012-02-13 Thread Bruce Wade
Hi, db.define_table('cash_journal', Field('transaction_type'), Field('distributor_id', 'integer'), Field('happen_time', 'datetime', default=request.now), Field('happen_amount', 'decimal(10,2)'), Field('ucash_before', 'decimal(10,2)'), Field('ucash_after', 'decimal(10,2)'),

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

2012-02-13 Thread Richard Vézina
I never try it... But since web2py like linux and unix everything is in a file somewhere, you maybe could try to make use of symbolic links... So you could have a app (plugin app) that is linked as a plugin in others app (main app that rely on some plugins). Really not sure how well it could work.

[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

Re: [web2py] Re: [w2py-dev] Re: Movuca - Social CMS beta 0.1

2012-02-13 Thread Wikus van de Merwe
LGPL is designed for libraries. Static or dynamic linking to LGPL code is allowed without enforcing copy-left. That means that the derivative work can even be a proprietary software. However, if you change the library code itself, you modification has to be released under LGPL. Since version 3

[web2py] Calling remote program on DB2 from Python/Web2py

2012-02-13 Thread Omi Chiba
Posted on web2py slice. http://www.web2pyslices.com/slices/take_slice/151 I'm so excited and it is greater than aha moment for me. We're using DB2 for our internal web app and now I can do almost anything from web2py because RPG/CL/Query... will be dynamically executed from web2py as an part of pr

[web2py] Re: Create indices from DAL

2012-02-13 Thread VP
does this go in model? On Feb 13, 12:20 am, Michael Toomim wrote: > Here's an improved way to create indices in the DAL. Works only with > postgresql and sqlite. > > def create_indices(*fields): >     ''' >     Creates a set of indices if they do not exist >     Use like: >        create_indices(

[web2py] Re: Dedicated IDE

2012-02-13 Thread Lewis
Happily using Komodo Edit 6. If web2py is in the pythonpath, you get autocomplete for it as well as the rest of python. I find it handier than using any of the dedicated python ide's because you also must work on html views and css files. It has autocomplete, syntax checking, and brace matching

[web2py] Current status of adapting OrientDB for web2py

2012-02-13 Thread Nolan Nichols
I'm researching the nosql and graph database landscape for a web2py application that will require the schema to evolve over time and provide network/graph analysis metrics. I started by looking at the Tinkerpop (http://tinkerpop.com/) stack and the Bulbflow (http://bulbflow.com/) python library fo

[web2py] Re: Problem with update

2012-02-13 Thread weheh
Thanks for the resposnes ;-) (typo intended). My bad. The problem was with a duplicated block of code. In one case, session_id is updated. In the other, it isn't. The one where it isn't was winning. Nothing wrong with web2py (as expected). Sorry for wasting time ... very much appreciate the feedba

[web2py] Re: web2py shell not executing db.define_table() but does record it in SQL log.

2012-02-13 Thread Bill Thayer
yes I was using the web based shell

[web2py] Re: Multiple different problems - Dealing with "Integrity Error" for nutnull=True and unique=True database fields

2012-02-13 Thread Anthony
On Monday, February 13, 2012 5:40:53 AM UTC-5, Rahul wrote: > > Hi All, >I am using the below statement to serialize images in my view > - > {{=TAG.img(_width=25, _height=30, _src=URL(r=request, c='default', > f='download', args=[adminupdate.profile_pic]))}} > Maybe something like: {{

Re: [web2py] Re: Multiple different problems - Dealing with "Integrity Error" for nutnull=True and unique=True database fields

2012-02-13 Thread Niphlod
that caches something into web2py, not into browser. To cache into browser, probably the most rapid way is to send out expire headers in the future. something like this would cache the file into browser for 30 days You are using the default download function, so if you need this functionality

[web2py] Can this be improved?

2012-02-13 Thread pbreit
I think list comprehensins are reasonable way to populate drop-downs. You don't need to specify he select fields if you dont want to. Then you'll just gt back ALL fields. Naming the db "db" is much easier to read for us.

[web2py] Re: web2py shell not executing db.define_table() but does record it in SQL log.

2012-02-13 Thread Anthony
Are you using the web-based shell in the admin app, or a regular Python shell? You might try a regular shell, as the web-based shell seems to have some limitations. Anthony On Monday, February 13, 2012 11:13:41 AM UTC-5, Bill Thayer wrote: > > No luck there either. Tried twice: > > In [2] : pri

Re: [web2py] Problem with update

2012-02-13 Thread Richard Vézina
You should replace IS_NULL_OR by IS_EMPTY_OR, IS_NULL_OR is depricated if I remember. I don't see what could be wrong... But I read recently about "test" that could be conflicting with web2py some how... But I guest that you try to implement a home made solution to follow logged on and logged off

[web2py] Re: Routes.py and janrain login

2012-02-13 Thread Rene Dohmen
Got it working with the example from the web2py book: routers = dict( BASE = dict(default_application='formatics'), ) Thank you web2py book :) Maybe a nice reminder for people running with mod_wsgi: you have to restart the webserver to activate changes in routes.py, and that's why it didn't w

[web2py] Problem with update

2012-02-13 Thread pbreit
Shouldn't be he problem but I see at leat one typo: resposne.session_id Can you try setting session_id to 0? Why are you doing this?

[web2py] Re: web2py shell not executing db.define_table() but does record it in SQL log.

2012-02-13 Thread Bill Thayer
No luck there either. Tried twice: In [2] : print db.tables ['auth_user', 'auth_group', 'auth_membership', 'auth_permission', 'auth_event', 'auth_cas', 'image', 'comment'] In [3] : print db.tables ['auth_user', 'auth_group', 'auth_membership', 'auth_permission', 'auth_event', 'auth_cas', 'image

[web2py] Re: One time action for user

2012-02-13 Thread Hassan Alnatour
Dear Anthony , Thnx it works :)

[web2py] Re: redirect doesn't redirect.

2012-02-13 Thread Annet
Hi Ricardo, Thanks for your reply, changing 1 to "1" solved the problem. Kind regards, Annet On Feb 13, 12:47 pm, Ricardo Pedroso wrote: > On Mon, Feb 13, 2012 at 10:58 AM, Annet wrote: > >    elif request.args(0)==1: > > This one above is always False. Should be at least: > > elif request.a

[web2py] Re: One time action for user

2012-02-13 Thread Anthony
This isn't foolproof, but upon voting, you can send a cookie to the user's browser. Before allowing a user to vote, check for the cookie, and if it exists, don't allow the vote. Note, this will only prevent someone from voting twice from the same machine and browser, assuming they don't delete

Re: [web2py] Re: dataTables with serverside json

2012-02-13 Thread Richard Vézina
Hi Vineet, Thanks for sharing. So, if I understand correctly, you use DABO code as an equivalent of the php code in the example from the DTs to allow grid to interact with database... I will have a look at PowerTable this week to see if it actually implement server processing and if not to try to

Re: [web2py] Re: Multiple different problems - Dealing with "Integrity Error" for nutnull=True and unique=True database fields

2012-02-13 Thread Richard Vézina
cache=(cache.ram, delay) You should consult book with "cache" keyword. Caching is allowed for certain thing like query. Richard On Mon, Feb 13, 2012 at 5:40 AM, Rahul wrote: > Hi All, > I am using the below statement to serialize images in my view > - > {{=TAG.img(_width=25, _height=30,

Re: [web2py] New Plugin: plugin_markitup

2012-02-13 Thread Marin Pranjić
Thanks, i will test by the end of the week. I need this. Marin On Sun, Feb 12, 2012 at 10:07 PM, Ross Peoples wrote: > I have created another plugin for the MarkItUp widget. I know that > plugin_wiki has this currently, but I wanted a dedicated plugin for this > for an upcoming project I'm worki

[web2py] One time action for user

2012-02-13 Thread Hassan Alnatour
Dear All, i have a polls application and there is no registration but i want the user to vote only one time , how can i do that ?

Re: [web2py] redirect doesn't redirect.

2012-02-13 Thread Ricardo Pedroso
On Mon, Feb 13, 2012 at 10:58 AM, Annet wrote: >    elif request.args(0)==1: This one above is always False. Should be at least: elif request.args(0)=="1": request.args returns each arg as string. Ricardo

[web2py] redirect doesn't redirect.

2012-02-13 Thread Annet
I am working on a network app, in which I use the same controllers and views for all hubs. To keep them separated all hubs have an id and every hub function start with test_hub_vars: def test_hub_vars(): if not len(request.args): redirect(URL('default','error')) elif request.args(0

[web2py] Re: Multiple different problems - Dealing with "Integrity Error" for nutnull=True and unique=True database fields

2012-02-13 Thread Rahul
Hi All, I am using the below statement to serialize images in my view - {{=TAG.img(_width=25, _height=30, _src=URL(r=request, c='default', f='download', args=[adminupdate.profile_pic]))}} What could I do to make the browser keep the images in cache? Regards, Rahul D On Feb 13, 11:13 am,

[web2py] Re: SQLFORM.smartgrid links to reference field

2012-02-13 Thread Roderick
bump... anybody?

[web2py] embedding web2py forms in static websites

2012-02-13 Thread Richard Penman
I want to embed web2py forms in a static website (same domain) and keep the static part as simple as possible. Currently I have this in the static website: $("#form").load("path/to/web2py/app"); And this in the web2py app: def email(): script = """ $("#contact_form").submit(functio