[web2py:32229] column ... is not unique

2009-10-05 Thread mika
hi! The problem is that traceback shows that column in my db is not unique. In code, there was 'unique=True', but I changed it. The problem still occurs. What should I do? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Grou

[web2py:32230] Re: form[0][0][0].insert()

2009-10-05 Thread annet
Hi Denes, Thanks for the extensive answer to my question. Both the digression and sample code were very helpful. Kind regards, Annet. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to

[web2py:32231] Re: Can Web2py use a SQLite database on another machine on the LAN?

2009-10-05 Thread BluePoint
Thanks everyone for wise advice. In my particular case, there is normally only one user, just occasionally two, on different machines, but the applications must run on either of two machines using the same database. I will bear in mind your advice about serving applications over the network and u

[web2py:32232] Re: column ... is not unique

2009-10-05 Thread Carl
Is this happening in your local development environment is it using sqlite? If so, the only solution I found was to delete the local database and start over. On Oct 5, 9:23 am, mika wrote: > hi! > > The problem is that traceback shows that column in my db is not > unique. In code, there was 'un

[web2py:32233] can't access 'id' field when running GAE dev_appserver

2009-10-05 Thread Carl
this one has been floored the following works correctly locally (sqlite) but trips over when running on dev_appserver query = (self.db.assessmentQuest.candidate_id == userId) & (self.db.assessmentQuest.id == nQuestId) rows = self.db(query).select(self.db.assessmentQuest.ALL) It's the self.db.as

[web2py:32234] Re: "Add" button next to "combo box"

2009-10-05 Thread Renato-ES-Brazil
Cool! Before I try to do something I really wanted to know if there was something done by passing a parameter. Thanks a lot guys! On Oct 5, 1:08 am, mdipierro wrote: > It would be nice to a widget that does this. > > On Oct 4, 10:14 pm, Álvaro Justen [Turicas] > wrote: > > > On Sat, Oct 3, 20

[web2py:32235] Adding a user name to user registration

2009-10-05 Thread Joseph Jude
Hi, I want to customize the auth functionality to add a user id(or name). This is what I've done so far. DB: from gluon.tools import Auth auth=Auth(globals(),db) auth.settings.table_user=db.define_table( auth.settings.table_user_name, Field('user_name',length=128,default='',requir

[web2py:32236] Re: can't access 'id' field when running GAE dev_appserver

2009-10-05 Thread mdipierro
GAE is very weird. It does allow queries that mix queries by ID and by other fields. You must first search by ID, then check that other condition is valid: query = (self.db.assessmentQuest.id == nQuestId) rows = self.db(query).select() if not rows or rows[0].candidate_id != userId: do_somethi

[web2py:32237] Re: Midphase + web2py how do I set it up?

2009-10-05 Thread Chris S
I heard back from tech support. Python is 'supported' on midphase but they still have version 2.4 installed with no ETA on any upgrades. I think that means I can't use them as a host am I correct? When you say not to use a public folder, what would I need to do to avoid that. If I put the web2

[web2py:32238] Unit Testing Controllers with auth.requires_login

2009-10-05 Thread Dmitri Zagidulin
The article on Unit Test Controllers using unittest (http://www.web2py.com/AlterEgo/default/show/213 ) gives some examples on how to unit-test web2py controllers. However, how do I test controller functions that are decorated with auth.requires_login()? When I tried running a test similar to tha

[web2py:32239] anti spam, anti porn strategy?

2009-10-05 Thread Web2py-SuperFan
Hi all, I'm implementing a comments and wiki feature on my web2py app. Is there any best practices or strategies you've used or would recommend on preventing spam or porn posts onto the site. I'm looking for some automated prevention as I'm afraid the amount of posts will be way too much for hu

[web2py:32240] Re: anti spam, anti porn strategy?

2009-10-05 Thread david bain
implementing a captcha or recaptcha based system should help. On Mon, Oct 5, 2009 at 9:27 AM, Web2py-SuperFan wrote: > > Hi all, > > I'm implementing a comments and wiki feature on my web2py app.  Is > there any best practices or strategies you've used or would recommend > on preventing spam or

[web2py:32241] Re: anti spam, anti porn strategy?

2009-10-05 Thread Álvaro Justen [Turicas]
On Mon, Oct 5, 2009 at 11:27, Web2py-SuperFan wrote: > > Hi all, > > I'm implementing a comments and wiki feature on my web2py app.  Is > there any best practices or strategies you've used or would recommend > on preventing spam or porn posts onto the site.  I'm looking for some > automated preve

[web2py:32242] Re: Midphase + web2py how do I set it up?

2009-10-05 Thread Álvaro Justen [Turicas]
On Mon, Oct 5, 2009 at 10:15, Chris S wrote: > > I heard back from tech support.  Python is 'supported' on midphase but > they still have version 2.4 installed with no ETA on any upgrades.  I > think that means I can't use them as a host am I correct? Well, so your hosting company doesn't matter

[web2py:32243] newbie looking for style advice

2009-10-05 Thread devnull
Hello all. Just discovered web2py and I think it's great. I wish we were using it here at work, and so do some of my co-workers. I have created a little form as an exercise for myself and I came up with some questions. It's likely that some of the things I'm wondering about are handled by the fr

[web2py:32244] Re: newbie looking for style advice

2009-10-05 Thread mdipierro
Thank you devnull, some answers below: On Oct 5, 10:14 am, devnull wrote: > Hello all. Just discovered web2py and I think it's great. I wish we > were using it here at work, and so do some of my co-workers. > > I have created a little form as an exercise for myself and I came up > with some que

[web2py:32245] drupal hooks

2009-10-05 Thread mdipierro
In the context of creating a plugin system this may be useful: http://api.drupal.org/api/group/hooks/7 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web2py

[web2py:32246] Re: can't access 'id' field when running GAE dev_appserver

2009-10-05 Thread Carl
thanks M I've changed the 3 places where I'd used combined fields with an id search and all is humming on dev_appserver. cheers On Oct 5, 2:07 pm, mdipierro wrote: > GAE is very weird. It does allow queries that mix queries by ID and by > other fields. > You must first search by ID, then check

[web2py:32247] Database Synchronization and UUID's

2009-10-05 Thread CJSteel
Database Synchronization and UUID's I am wondering if I need to do searches by uuid's in a different way. I have been experimenting with them and frequently run into the error - > KeyError: 'uuid' when attempting to do queries or when trying to pass them as variables from controllers to views and

[web2py:32248] Re: Database Synchronization and UUID's

2009-10-05 Thread mdipierro
There must be a bug. Will double check tonight. On Oct 5, 12:38 pm, CJSteel wrote: > Database Synchronization and UUID's > > I am wondering if I need to do searches by uuid's in a different way. > I have been experimenting with them and frequently run into the error -> > KeyError: 'uuid' when a

[web2py:32249] Re: web2py + pyjamas desktop = a desktop framework?

2009-10-05 Thread don
What I would like is to not 'see the man behind the curtain', that is the server. I know that he is going to be there, somewhere, but I don't want the user to be aware of the server's existence - and that includes using a Windows service. Ideally, I would like the application to be a 'portable a

[web2py:32250] Re: newbie looking for style advice

2009-10-05 Thread devnull
Below is the difficulty I was having getting request.vars to the target of the redirect. [add] redirects to [add_2], and when it does, request.vars doesn't have .x and .y ... instead I find myself stuffing x and y into the session explicitly and then pulling them out in [add_2] also explicitly. I

[web2py:32251] Re: drupal hooks

2009-10-05 Thread Alex Fanjul
I thought that "Hooks" is the "mend/patch" for non objetc oriented languages/frameworks like Drupal, because Drupal started in php4 when php wasnt object oriented yet... (no inheritance, no interfaces, ...) By the way, What is the language paradigm of web2py? it is object oriented, isnt it? r

[web2py:32252] Re: drupal hooks

2009-10-05 Thread mdipierro
I am not suggesting we implement hooks. I am pointing web2py users to a place where people have actually build a plugins (modules) system that has been successful in practice. The implementation is ugly and we should not copy that but it may give us some ideas about what plugins should do or sho

[web2py:32253] Re: can't access 'id' field when running GAE dev_appserver

2009-10-05 Thread Robin B
GAE has added a feature so you can query by id or keyname (using __key__), it is not implemented in DAL yet. http://code.google.com/appengine/docs/python/datastore/queriesandindexes.html#Queries_on_Keys Robin On Oct 5, 8:07 am, mdipierro wrote: > GAE is very weird. It does allow queries that

[web2py:32254] Re: Midphase + web2py how do I set it up?

2009-10-05 Thread Chris S
Is there any information I should be aware of when trying to run web2py on Python 2.4? I do agree I wouldn't choose this host, but this is a FREE opportunity for me to check out web2py on a friends paid for account. I'm using this to compare/contrast a host with GAE before I start paying hosting

[web2py:32255] Re: Midphase + web2py how do I set it up?

2009-10-05 Thread mdipierro
You may need this: http://www.web2py.com/AlterEgo/default/show/219 You may also have problems with appliances that use 2.5 syntax but nothing that you cannot find a way around to. The source of web2py is 2.4 compliant. Massimo On Oct 5, 4:39 pm, Chris S wrote: > Is there any information I sho

[web2py:32256] synchronize Google Apps groups with web2py groups?

2009-10-05 Thread Graham Charles
Has anyone already written code to synchronize Google Apps groups with web2py groups? That is, I'd like to be able to make use of the groups I've defined in Google Apps in decorator functions like @auth.requires_membership The code in gluon.contrib.login_methods.gae_google_account retrieves a

[web2py:32257] Re: web2py + pyjamas desktop = a desktop framework?

2009-10-05 Thread Álvaro Justen [Turicas]
On Mon, Oct 5, 2009 at 15:22, don wrote: > > What I would like is to not 'see the man behind the curtain', > that is the server. > > I know that he is going to be there, somewhere, but I don't > want the user to be aware of the server's existence - and that > includes using a Windows service.  Id

[web2py:32258] Re: web2py + pyjamas desktop = a desktop framework?

2009-10-05 Thread don
Yes, that is a possibility. I could do something similar to this using a small Python application instead of a shell script as I want something that will run on Windows. Thanks, Don. On Oct 5, 8:02 pm, Álvaro Justen [Turicas] wrote: > My mother uses a system based on web2py and I've created

[web2py:32259] Re: web2py + pyjamas desktop = a desktop framework?

2009-10-05 Thread Jonathan Lundell
On Oct 5, 2009, at 5:02 PM, Álvaro Justen [Turicas] wrote: > It depends on how you will distribute your application. > My mother uses a system based on web2py and I've created a shell > script to: > - kill any web2py.py process > - start a new web2py.py process > - open firefox in http://localh

[web2py:32260] Re: web2py + pyjamas desktop = a desktop framework?

2009-10-05 Thread don
Fluid, Prism and Chrome 'application short-cuts' all look very similar. Don. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web2py@googlegroups.com To unsub

[web2py:32261] Re: "Add" button next to "combo box"

2009-10-05 Thread Renato-ES-Brazil
I am here trying to create a custom widget, inside a class that extends SQLFORM, but how could I create a custom widget that allow me to send others parameters besides "field" and "value"? I would like call the new widget by sending the parameters "control" and "function". So, inside the function

[web2py:32262] Re: "Add" button next to "combo box"

2009-10-05 Thread mdipierro
you can do something like class MyWidget: def __init__(self,**parameters): self.parameters=parameters def __call__(self,field,value): # use self.parameters return INPUT(_type='text',_name=field.name,_value=value) db.table.field.widget=MyWidget(parameter1="1",pa

[web2py:32263] Re: "Add" button next to "combo box"

2009-10-05 Thread Renato-ES-Brazil
I've created a simple code. In my db_task.py I have the following lines, among others: from applications.myapp.modules.mywidgets import * db.main.product.requires=IS_IN_DB(db,db.product.id,db.product.name, orderby=~db.product.name) db.main.product.widget = options_with_add_link.widget And in

[web2py:32264] Re: "Add" button next to "combo box"

2009-10-05 Thread mdipierro
I do not think you need to extend SQLFORM to implement this. You just need a new widget for the reference field. I think. Not that there is anything worng with extending SQLFORM but I think it may be more complex that needs to be. On Oct 5, 8:22 pm, Renato-ES-Brazil wrote: > I've created a simpl

[web2py:32265] Re: "Add" button next to "combo box"

2009-10-05 Thread Renato-ES-Brazil
Massimo, I don't believe! The solution is simpler than I thought. :-) Thanks a lot! :-) >From what I read in the manual I thought I had to extend SQLFORM manually. The solution solved my needs, but just to clarify me, how I could implement the same solution but using a class that extends SQLFORM

[web2py:32266] Re: Database Synchronization and UUID's

2009-10-05 Thread mdipierro
GRR this is a major error in the manual In book page 172 db.import_to_csv_file(form.vars.data.file,unique=False) is supposed to be: db.import_from_csv_file(form.vars.data.file) only db[table].import_from_csv_file take the unique argument. not the import of the entire DB. You get the KeyE

[web2py:32267] Re: Database Synchronization and UUID's

2009-10-05 Thread mdipierro
I added the corresponding arguments to db.import_from_csv_file in trunk so that the example works as listed (but without auth) Sorry for this error. Massimo On Oct 5, 9:10 pm, mdipierro wrote: > GRR this is a major error in the manual > > In book page 172 > > db.import_to_csv_file(form.va

[web2py:32268] Re: Unit Testing Controllers with auth.requires_login

2009-10-05 Thread Dmitri Zagidulin
Actually, my main question is simply - how does one use/instantiate Model code from external files? (Like, if I want to do outsource some business logic to a module, so that several controllers can reuse it?) --~--~-~--~~~---~--~~ You received this message because y

[web2py:32269] Re: Unit Testing Controllers with auth.requires_login

2009-10-05 Thread mdipierro
If a function needs to be used by multiple controllers in the same app, the easy solution is to put it into a model file. If a function needs to be used by multiple controllers in different applications than it needs to be defined in a module, imported, passed the required global variables and ca

[web2py:32270] Re: Unit Testing Controllers with auth.requires_login

2009-10-05 Thread Dmitri Zagidulin
Ok, I think I understand, so far. My main question still stands, though - how can I import or instantiate a model file, externally (say, for unit testing)? And do you have any suggestions on how to unit test auth-protected controller functions? On Mon, Oct 5, 2009 at 10:59 PM, mdipierro wrote:

[web2py:32271] Re: Unit Testing Controllers with auth.requires_login

2009-10-05 Thread mdipierro
we normally suggest using doctests and int this case you can use web2py.py -T if you want to use unittest you should look into gluon/shell.py exec_environment(...) The problem is that you are not just testing functions that take an input and return an output. They needs to have an environment t

[web2py:32272] Re: drupal hooks

2009-10-05 Thread Richard
I agree Drupal modules work well - simple to install/use/uninstall and cover a wide range of functionality. Also Firefox extensions do a good job. On Oct 6, 7:32 am, mdipierro wrote: > I am not suggesting we implement hooks. > > I am pointing web2py users to a place where people have actually b

[web2py:32273] Re: Database administration - db upload field

2009-10-05 Thread yamandu
I was almost blaming SQLite and almost changed it. Why the need of the default attribute? Is this a bug? I did not understand. On 10 set, 17:36, mdipierro wrote: > def upload(): >     import cStringIO >     data=request.body.read() >     f=cStringIO.StringIO(data) >     current_filename='bla.bla

[web2py:32274] Re: Database administration - db upload field

2009-10-05 Thread mdipierro
I do not understand the question Massimo On Oct 5, 11:05 pm, yamandu wrote: > I was almost blaming SQLite and almost changed it. > Why the need of the default attribute? > Is this a bug? I did not understand. > > On 10 set, 17:36, mdipierro wrote: > > > def upload(): > >     import cStringIO >

[web2py:32275] Re: newbie looking for style advice

2009-10-05 Thread Richard
when you redirect you get a new request object so you could pass the data to the new request.vars with: URL(r=request, f='add_2', vars={'x':request.vars.x, 'y':request.vars.y}) or simply: URL(r=request, f='add_2', vars=request.vars) Probably better to pass temporary data in vars than store in ses

[web2py:32276] Re: anti spam, anti porn strategy?

2009-10-05 Thread Richard
I've used the recaptcha built in to auth_user registration and it worked well. Is it easy to integrate with other forms? On Oct 6, 1:34 am, david bain wrote: > implementing a captcha or recaptcha based system should help. > > On Mon, Oct 5, 2009 at 9:27 AM, Web2py-SuperFan wrote: > > > Hi all,

[web2py:32277] help on sending email on gae

2009-10-05 Thread vneve
I can send mails when running on localhost, but could not get this working after deploying to gae. I'm using this from the default db.py: mail.settings.server='smtp.gmail.com:587'# your SMTP server mail.settings.sender = 'em...@gmail.com' # your email mail.settings.logi n= 'email:**'