[web2py] copy database, problem with foreign key constraint

2013-02-26 Thread pablo . angulo
Hello: I'm trying to copy the contents from the testing sqlite database into apache. Both: - the script cpdb, - export and import of a csv file, - manual, careful export and import of each table of a database fail. The reason is related to foreign keys. The method import_from_csv_files

[web2py] Re: Again: virtual field requires type-attribute

2013-02-26 Thread Donatas Burba
I have a workaround for this issue. Just a little helper function in modules: def virtual_field(db, table_name, field_name, field_type, compute=lambda row: None, label='', represent=None): db[table_name][field_name] = Field.Virtual(compute) db[table_name][field_name].type = field_type

[web2py] Re: multiple events on single button

2013-02-26 Thread Niphlod
that's a javascript issue: you're trying to submit the form in the standard way, so the page POSTs the values, the page gets refreshed - as a normal form submission does - and your afterwards-attached fancybox doesn't have the chance to show up. You need to post the form using ajax On Tuesday,

[web2py] Re: Automatically updating a db table from a CSV file

2013-02-26 Thread Niphlod
watch the folder for the new file and then use import_from_csv() or something else to create/update your records. On Tuesday, February 26, 2013 4:12:23 AM UTC+1, cmzobrist wrote: I am looking to up date a database table from a CSV file automatically when a CSV file is sent via FTP to my

[web2py] Re: Relocating auth/user Login component

2013-02-26 Thread Niphlod
it's all configured using auth.settings see http://web2py.com/books/default/chapter/29/09?search=auth.settings.login_url and following On Tuesday, February 26, 2013 1:34:59 AM UTC+1, Vixus wrote: Ok, I understand. But what if I want the auth stuff in a controller called user, and not

Re: [web2py] Re: Error db._adapter

2013-02-26 Thread __pyslan__ - Ayslan Jenken
The result is the same error... I get the result as (1), but the error is always thrown. On Tue, Feb 26, 2013 at 2:25 AM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: Try: import MySQLdb conn.MySQLdb.connect(db=db, user=user,

Re: [web2py] Re: Scheduler: help us test it while learning

2013-02-26 Thread Niphlod
On Monday, February 25, 2013 10:59:28 PM UTC+1, Yarin wrote: Sweet- looking forward to using the API. Schema changes a pain but done for right reasons. Can you give more explanation of the immediate=True param? The app has some docs about it, but to make a tl;dr of it scheduler checks

[web2py] Re: copy database, problem with foreign key constraint

2013-02-26 Thread pablo . angulo
The diagnostic is confirmed by the following experiment: I filled the few missing lines in the csv files with dummy data so that all ids are consecutive starting at 1, and the import worked. -- --- You received this message because you are subscribed to the Google Groups web2py-users group.

[web2py] Re: Setting Up Basic Authentication between 2 Web2Py Apps

2013-02-26 Thread Cliff Kachinske
Not sure what you mean by 'does not work.' Does it raise an error, or does it just fail to give you access when you expect it? I believe if you look in the database directory of both apps you will find an SQLite database file. The Accessor application only knows to look in its own database

[web2py] Re: smartgrid selectable comments

2013-02-26 Thread Kostas M
Niphlod thank you very much for your reply. I implemented the 2nd option you mentioned, using jquery to add a textarea in the form tags. In the controller, I use the request.vars.textareaname to retrieve the contents of the textarea and then I insert them into the proper table. Just a thought:

[web2py] Re: smartgrid selectable comments

2013-02-26 Thread Niphlod
well, that's something you need to manage depending on what textarea saves and when the same data gets retrieved. Security-wise, the .serialize() method of jquery should percent-encode all the content, so, e.g., even if there is some javascript typed into the textarea the POST would not break

[web2py] [newbee] Wiki_plugin - WidgetBuilder-jqgrid : How to link data from db to jqgrid

2013-02-26 Thread openoc80
Hi, I am new on Web2py and I try the plugin_wiki and the widget jqgrid with the WidgetBuilder. I have created in db.py my table but my jqgrid in my page (my form) is all the time empty. I have tried to do the select of my table in the meta_code but my jqgrid is empty. My question: How and

[web2py] Re: [newbee] Wiki_plugin - WidgetBuilder-jqgrid : How to link data from db to jqgrid

2013-02-26 Thread Paolo valleri
Hi Bruno, plugin_wiki is deprecated and it has been replaced by auth.wiki, have a look here: http://web2py.com/books/default/chapter/29/03?search=auth.wiki#The-built-in-web2py-wiki Paolo On Tuesday, February 26, 2013 5:09:06 PM UTC+1, open...@gmail.com wrote: Hi, I am new on Web2py and I

[web2py] Re: How to properly handle dynamic urls?

2013-02-26 Thread bracquet
Thanks, I must have missed that. Although I'm still a bit confused. The last framework I played with used regex to determine the URL, so I could do something like: welcome/default/products/(\d{2}) # shows overall product page for given product primary id

[web2py] Re: How to properly handle dynamic urls?

2013-02-26 Thread bracquet
Sorry, let me clarify and be more specific again. The framework I referred to was Django, where their url dispatcher can create named groups like so: r'^places/(?Plastname\w+)/(?Pfirstname\w+)/$', 'misc.views.home' This url would be mapped to a function with the name given in the url: def

Re: [web2py] Re: How to properly handle dynamic urls?

2013-02-26 Thread Jonathan Lundell
On 26 Feb 2013, at 8:44 AM, bracq...@gmail.com wrote: Thanks, I must have missed that. Although I'm still a bit confused. The last framework I played with used regex to determine the URL, so I could do something like: welcome/default/products/(\d{2}) # shows overall product page for

Re: [web2py] Re: Many to many relationships

2013-02-26 Thread Massimo Di Pierro
No need. It is a book issue. I will take care of it. On Monday, 25 February 2013 23:49:48 UTC-6, Toby Wilson wrote: Thanks Massimo. Is the second point regarding the shell I raise a known issue as well? *From:* web...@googlegroups.com javascript: [mailto:

[web2py] Re: Again: virtual field requires type-attribute

2013-02-26 Thread Massimo Di Pierro
This helped me a lot. I included these defaults in web2py so that you should need to do it yourself. Can you please check if db.test.c12 = Field.Virtual (lambda r: r.t1+r.t2) now works as expected? On Tuesday, 26 February 2013 05:28:59 UTC-6, Donatas Burba wrote: I have a workaround for

Re: [web2py] Re: Error db._adapter

2013-02-26 Thread Massimo Di Pierro
Now we ruled out web2py completely in this. You need a MySQL expert. On Tuesday, 26 February 2013 06:14:35 UTC-6, __pyslan__ wrote: The result is the same error... I get the result as (1), but the error is always thrown. On Tue, Feb 26, 2013 at 2:25 AM, Massimo Di Pierro

[web2py] Re: [newbee] Wiki_plugin - WidgetBuilder-jqgrid : How to link data from db to jqgrid

2013-02-26 Thread openoc80
Thanks Paolo. I did not know that it was deprecated ! I am really a newbee !!! I am going to read this chapter with attention. I think ... see you soon ! Bruno On Tuesday, February 26, 2013 5:15:48 PM UTC+1, Paolo valleri wrote: Hi Bruno, plugin_wiki is deprecated and it has been replaced

Re: [web2py] Re: Error db._adapter

2013-02-26 Thread __pyslan__ - Ayslan Jenken
Ok. Thanks. On Tue, Feb 26, 2013 at 2:43 PM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: Now we ruled out web2py completely in this. You need a MySQL expert. On Tuesday, 26 February 2013 06:14:35 UTC-6, __pyslan__ wrote: The result is the same error... I get the result as (1),

[web2py] Re: How to properly handle dynamic urls?

2013-02-26 Thread Anthony
In that case, you could do something like: def places(): lastname, firstname = request.args[0:2] Then for a URL like /myapp/mycontroller/places/John/Doe, John would be in request.args[0] and Doe would be in request.args[1]. Anthony On Tuesday, February 26, 2013 11:57:55 AM UTC-5,

[web2py] web2py 2.1.1 to 2.3.2

2013-02-26 Thread Omi Chiba
I was a little busy and my version was 2.1.1 but now it's 2.3.2! Is there anyone who can explain what's the major change since 2.1.1? -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails

[web2py] Re: web2py 2.1.1 to 2.3.2

2013-02-26 Thread Massimo Di Pierro
You can find the changelog here: http://web2py.com/examples/default/changelog On Tuesday, 26 February 2013 13:22:58 UTC-6, Omi Chiba wrote: I was a little busy and my version was 2.1.1 but now it's 2.3.2! Is there anyone who can explain what's the major change since 2.1.1? -- --- You

[web2py] Re: How to properly handle dynamic urls?

2013-02-26 Thread bracquet
So, the way to handle these types of links (with the example before): welcome/default/products/(\d{2}) # shows overall product page for given product primary id welcome/default/products/(\d{2})/description # shows product description for given product primary id

[web2py] Re: web2py 2.1.1 to 2.3.2

2013-02-26 Thread Omi Chiba
Thanks : ) On Tuesday, February 26, 2013 1:43:03 PM UTC-6, Massimo Di Pierro wrote: You can find the changelog here: http://web2py.com/examples/default/changelog On Tuesday, 26 February 2013 13:22:58 UTC-6, Omi Chiba wrote: I was a little busy and my version was 2.1.1 but now it's 2.3.2!

[web2py] Re: How to properly handle dynamic urls?

2013-02-26 Thread Anthony
Note, you generally will not have to test for the length of request.args. Instead, you can do request.args(...), and it will return None if the index is out of range. So, your code could like something like this: def products(): product, content, comment = request.args(0), request.args(1),

[web2py] Re: How to properly handle dynamic urls?

2013-02-26 Thread Anthony
You could also use the pattern-based rewrite system to route to entirely separate functions depending on the content requested (e.g., separate functions for description and comments). Anthony On Tuesday, February 26, 2013 3:06:08 PM UTC-5, Anthony wrote: Note, you generally will not have to

[web2py] Debugging with the scheduler

2013-02-26 Thread José Luis Redrejo
Hello, I'm working with async processes using the scheduler (with the unvaluable help of the learn by trial application from Niphlod. I wonder if there's an easy way to debug the processes that are being executed in the background (I'm having problems with them, they work ok when run from web2py

[web2py] jquery mobile plugin layout problem

2013-02-26 Thread Omi Chiba
How can I add margin both side of the page? I attached my screen shot. jquery mobile should give me the margin on left and right side so text, buttons fit nicely but there is no space when you use the plugin so the text doesn't look good. I use web2py 2.3.2 and downloaded the latest jquery

Re: [web2py] Re: Again: virtual field requires type-attribute

2013-02-26 Thread Martin Weissenboeck
Sorry, no - same message. I have taken the last version from trunk one hour ago. Ticket ID 127.0.0.1.2013-02-26.21-39-35.e1477239-8991-4217-810f-9e320daf692c type 'exceptions.AttributeError' 'FieldVirtual' object has no attribute 'type' Version web2py™ (2, 4, 1, 'alpha.2',

Re: [web2py] Re: Again: virtual field requires type-attribute

2013-02-26 Thread Massimo Di Pierro
I get: $ python web2py.py -S welcome Version 2.4.1-alpha.2+timestamp.2013.02.26.11.40.15 Database drivers available: SQLite(sqlite3), MySQL(pymysql), PostgreSQL(pg8000), IMAP(imaplib) WARNING:web2py:import IPython error; use default python shell Python 2.7.1 (r271:86832, Jul 31 2011, 19:30:53)

[web2py] Re: outdated web2py plugin for jquery mobile

2013-02-26 Thread Omi Chiba
Same here. One of web2py Japan member found it's using the old jquery mobile files. I changed the code in views/plugin_jqmobile/layout.html link rel=stylesheet href=http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.css; / script

[web2py] Re: Debugging with the scheduler

2013-02-26 Thread Niphlod
never done it, but debugging a multiprocessing spawned process needs additional tuning http://pydev.org/manual_adv_remote_debugger.html PS: can I ask what is not working ? if it's a focused problem maybe I can come up with an answer . On Tuesday, February 26, 2013 9:12:23 PM UTC+1, José L.

Re: [web2py] Re: Again: virtual field requires type-attribute

2013-02-26 Thread Martin Weissenboeck
And here is the full traceback: Traceback 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. Traceback (most recent call last): File D:\dropbox\InfoSMS\web2py\gluon\restricted.py, line 212, in restricted exec ccode in environment File

Re: [web2py] Re: Again: virtual field requires type-attribute

2013-02-26 Thread Massimo Di Pierro
db = DAL() db.define_table('test',Field('t1'),Field('t2')) Table test (id,t1,t2) db.test.c12 = Field.Virtual (lambda r: r.test.t1+r.test.t2) db.test.insert(t1='x',t2='y') 1L db.test(1).c12 'xy' Notice: db.test.c12 = Field.Virtual (lambda r: r.test.t1+r.test.t2) not db.test.c12 =

[web2py] requires is not work in form()

2013-02-26 Thread 黄祥
hi, i've test the form validators() is not work when using form(). even if i set it on models is not work too. when using crud() and sqlform() the requires is work when i define it in models. did anyone know about it? thank you a lot before. *example:* form action= enctype=multipart/form-data

[web2py] Re: requires is not work in form()

2013-02-26 Thread Niphlod
you can't define requires in anything that is not a Field instance. On Tuesday, February 26, 2013 11:12:24 PM UTC+1, 黄祥 wrote: hi, i've test the form validators() is not work when using form(). even if i set it on models is not work too. when using crud() and sqlform() the requires is

Re: [web2py] Re: Again: virtual field requires type-attribute

2013-02-26 Thread Martin Weissenboeck
Thank you for your help - now it works perfect! 2013/2/26 Massimo Di Pierro massimo.dipie...@gmail.com db = DAL() db.define_table('test',Field('t1'),Field('t2')) Table test (id,t1,t2) db.test.c12 = Field.Virtual (lambda r: r.test.t1+r.test.t2) db.test.insert(t1='x',t2='y') 1L

[web2py] Re: web2py under GAE: disabling indexes

2013-02-26 Thread Scott Hunter
Sorry about that. I've fixed it, and now I get the following: In FILE: /base/data/home/apps/s~sbhweb2py/1.365574604253984974/applications/ ppt_demo/models/db_wizard.py Traceback (most recent call last): File /base/data/home/apps/s~sbhweb2py/1.365574604253984974/gluon/restricted.py,line

[web2py] Re: requires is not work in form()

2013-02-26 Thread Anthony
*input id=a name=a type=text value= size=3 {{requires = IS_NOT_EMPTY(error_message='cannot be empty!')}} /* My first recommendation is to stop trying completely random syntax that you haven't seen anywhere in the documentation or examples. Based on the documentation, there's no

[web2py] Re: web2py under GAE: disabling indexes

2013-02-26 Thread howesc
your line numbers are off from mine so i'm having trouble making sense of this. :( can you send your model definition so i can see what you are working with? i think then i can line it up with the dal version i have here (which was trunk from HG as of saturday AM PST) cfh On Tuesday,

[web2py] Re: web2py under GAE: disabling indexes

2013-02-26 Thread Scott Hunter
I'm working from Version 2.3.2 (2012-12-17 15:03:30) stable Here's the table in question (I've commented-out the custom_qualifier for the string fields): db.define_table('t_run', Field('f_trial', type='reference t_trial', label=T('Trial')), Field('f_when', type='date',

[web2py] Re: web2py under GAE: disabling indexes

2013-02-26 Thread howesc
here's an updated DAL patch to try. thanks for trudging through this with us! cfh On Tuesday, February 26, 2013 3:36:30 PM UTC-8, Scott Hunter wrote: I'm working from Version 2.3.2 (2012-12-17 15:03:30) stable Here's the table in question (I've commented-out the custom_qualifier for

[web2py] Re: web2py under GAE: disabling indexes

2013-02-26 Thread howesc
oh, and about the web2py-supplied fields, those come from auth.signature, which is just a table that you inherit from. from gluon/tools.py you see the auth.signature definition as: self.signature = db.Table( self.db, 'auth_signature', Field('is_active',

[web2py] User specific sessions

2013-02-26 Thread Yarin
Normally when storing variables within the session object, they will persist throughout the entire browser session lifetime, regardless of whether a user is logged in. What's the best way to implement user-specific session storage- i.e. variables I want stored in session for as long as a

[web2py] Re: web2py under GAE: disabling indexes

2013-02-26 Thread Scott Hunter
With the latest patch, I was able to disable indices on the string fields I wanted to. Unfortunately (for me), I've just about used up my quota, so I'll have to wait until tomorrow to see how much doing so saves me. Thanks, Scott On Tuesday, February 26, 2013 8:50:29 PM UTC-5, howesc wrote:

[web2py] Re: requires is not work in form()

2013-02-26 Thread 黄祥
thank you so much for your hints, niphlod. a, i understand my mistake now, thanks a lot for showing my error part with your detail explaination, anthony. i tested it using form(input()) in controller and it works fine now. -- --- You received this message because you are subscribed to the

[web2py] routes question

2013-02-26 Thread greaneym
If the parametric routes format is used to route domains, do the domains have to be on the same physical host? The cookbook refers to an example where the domains are on the same physical host on p. 273. Does an example like this work if the domains are on two physically separate hosts?

Re: [web2py] routes question

2013-02-26 Thread Jonathan Lundell
On 26 Feb 2013, at 6:32 PM, greaneym grean...@gmail.com wrote: If the parametric routes format is used to route domains, do the domains have to be on the same physical host? The cookbook refers to an example where the domains are on the same physical host on p. 273. Does an example like

[web2py] Re: requires is not work in form()

2013-02-26 Thread 黄祥
the other part that is not work is when using select option, i can't insert the requires=IS_NOT_EMPTY() do you have any idea about this? thank you so much before *1 testing results in controllers default.py : all work fine except the select option can't have requires because i generate it

[web2py] SQLFORM in Bootstrap modal

2013-02-26 Thread Vincenzo Ampolo
Hi, I'm looking to a way to use the available by default bootstrap modal on a SQLFORM. It would be easy to integrate it, or any sort of lightbox like plugin, with SQLFORM if there is the capability to give a template to SQLFORM(). Looking at the documentation it doesn't seem that there is

[web2py] Re: requires is not work in form()

2013-02-26 Thread Anthony
TR ( TD ( *SELECT ( OPTION ( _value='' ), OPTION ( _value='1', '1' ), * * for i,row in enumerate(rows): * *OPTION ( 'row.product_name', _value=' row.id' ), * *

Re: [web2py] routes question

2013-02-26 Thread greaneym
I am confused by routes and I'm trying to learn how to use them. I see this example, thinking it might apply to my situation, ^[client]:[protocol]://[hostname]:[method] [url]$ and really I am just not sure how to do what I need because I don't know enough, so I am just trying things until I

[web2py] Re: User specific sessions

2013-02-26 Thread Anthony
You could use auth.settings.login_onaccept and auth.settings.logout_onlogout functions to clear the items from session that you don't want to persist. On Tuesday, February 26, 2013 8:59:46 PM UTC-5, Yarin wrote: Normally when storing variables within the session object, they will persist

[web2py] Re: requires is not work in form()

2013-02-26 Thread 黄祥
a, i c, so use a list to do select in controller, thanks a lot for your detail explaination, anthony. On Wednesday, February 27, 2013 10:16:46 AM UTC+7, Anthony wrote: TR ( TD ( *SELECT ( OPTION ( _value='' ), OPTION ( _value='1', '1' ), * *

Re: [web2py] routes question

2013-02-26 Thread Jonathan Lundell
On 26 Feb 2013, at 7:25 PM, greaneym grean...@gmail.com wrote: I am confused by routes and I'm trying to learn how to use them. I see this example, thinking it might apply to my situation, ^[client]:[protocol]://[hostname]:[method] [url]$ and really I am just not sure how to do what I need

[web2py] Re: User specific sessions

2013-02-26 Thread Yarin
Thanks Anthony- I ended up doing just that. I created a user_session storage object that houses all user specific session vars, and clear that one object when appropriate: session.user_session = Storage(user_id=auth.user_id) session.user_session.my_vars = ... On Tuesday, February 26, 2013

[web2py] Rows object not returning reference fields

2013-02-26 Thread Calvin
I am encountering a strange observation in that when accessing the Rows object for a given table, the object returns all the fields except for those that are of the reference type. I am using the HEAD version... Is this a bug? -- --- You received this message because you are subscribed to

[web2py] Re: SQLFORM in Bootstrap modal

2013-02-26 Thread Paolo valleri
Hi Vincenzo, I came across to the same problem with sqlform and modal. As far as I remember there is nothing 'automatic' to solve the problem. However, so far I fixed the duplicate submit buttons by hiding the 'original' one, namely the one belonging to the sqlform, and then adding just a few