Re: [web2py] Re: temporary tables to easily use native smartgrid with session-specific data?

2013-01-21 Thread Johann Spies
I use the following method which is not session dependent (and therefore not as as complicated as your requirement): Define a model for the query Drop the table before the query is executed Use Postgresql's 'SELECT INTO' or 'CREATE TABLE AS XXX FROM' in the query to populate the table. Maybe in y

[web2py] Re: temporary tables to easily use native smartgrid with session-specific data?

2013-01-21 Thread Tim Richardson
Thanks again Niphlod; I think this will be a handy technique to have up my sleeve. --

Re: [web2py] Re: Book in epub format?

2013-01-21 Thread Johann Spies
On 21 January 2013 22:49, Niphlod wrote: > rotfl. always available, but I don't know a single thing about the epub > format. > did anyone tried just converting the pdf to epub using calibre ? > The success of converting pdf to epub using calibre depends on how the pdf was created. I had some su

Re: [web2py] How I can use tag with Markmin?

2013-01-21 Thread Ignacio Ocampo
Very fun! :) On Mon, Jan 21, 2013 at 11:22 PM, Massimo Di Pierro < massimo.dipie...@gmail.com> wrote: > This works > > MARKMIN(text, extra={"pre_with_code": lambda text: > "{0}".**format(text)}) > > but is is a little dangerous since the user can do > > `` > > alert('oops!'); > > `` > > The arg

Re: [web2py] How I can use tag with Markmin?

2013-01-21 Thread Massimo Di Pierro
This works MARKMIN(text, extra={"pre_with_code": lambda text: "{0}".format(text)}) but is is a little dangerous since the user can do `` alert('oops!'); `` The argument of text should be escaped somehow. Not sure how since you want to allow verbatim code. On Monday, 21 January 2013 22:30:

Re: [web2py] How I can use tag with Markmin?

2013-01-21 Thread Bruno Rocha
for this I thinnk you sould use extra render. {{text = "`` here is my code ``:pre_with_code"}} {{=MARKMIN(text, extra={"pre_with_code": lambda text: "{0}".format(text)})}} Tested on shell In [4]: text = "`` here is my code ``:pre_with_code" In [5]: print MARKMIN(text, extra={"pre_with_code": l

Re: [web2py] How I can use tag with Markmin?

2013-01-21 Thread Ignacio Ocampo
Thank you Bruno, and anything :) ? On Mon, Jan 21, 2013 at 10:09 PM, Bruno Rocha wrote: > > `` > Your code here > `` > > for testing: http://web2py.com/markmin > > -- > > > > -- Ignacio Ocampo Millán --

Re: [web2py] How I can use tag with Markmin?

2013-01-21 Thread Bruno Rocha
`` Your code here `` for testing: http://web2py.com/markmin --

Re: [web2py] How I can use tag with Markmin?

2013-01-21 Thread Ignacio Ocampo
Bruno, thank you. But if I only need the simple ? anything How I can do it? On Monday, January 21, 2013 9:56:35 PM UTC-6, rochacbruno wrote: > > `` > Hello World > ``:code_html > > > `` > print "hello world" > ``:code_python > > On Tue, Jan 22, 2013 at 1:50 AM, Ignacio Ocampo > > wrote: > >>

Re: [web2py] How I can use tag with Markmin?

2013-01-21 Thread Bruno Rocha
`` Hello World ``:code_html `` print "hello world" ``:code_python On Tue, Jan 22, 2013 at 1:50 AM, Ignacio Ocampo wrote: > How I can use tag with Markmin? Thank you. > > -- > > > > --

[web2py] How I can use tag with Markmin?

2013-01-21 Thread Ignacio Ocampo
How I can use tag with Markmin? Thank you. --

[web2py] Re: Help on Unit Tests

2013-01-21 Thread Anthony
Regarding unit testing specifically, I think there are two basic approaches. One approach is to slightly modify the way you write and call the unit test file, and rely on web2py to build its environment in the usual way. This method is described here: http://web2py.com/AlterEgo/default/show/260

Re: [web2py] Help on Unit Tests

2013-01-21 Thread Bruno Rocha
There is no official approach, testing is being an issue for a long time, there was a project called web2py test runner, but the maintainer abandoned the project. If you can contribute with something on this subject, your contribution will be very welcome. The main problem of testing is the fact

[web2py] Help on Unit Tests

2013-01-21 Thread Israel Fermin Montilla
Hi there! I'm new in web2py, I come from programming a lot in django which has built in unit test support and I'm kind of a testing freak. There are like 3 or 4 different articles with different approaches for testing in web2py and the official documentation of the webclient (which helps a lot

[web2py] Re: web2py best practices/patterns

2013-01-21 Thread samuel bonilla
look, this is for big project : Model Less Apps (using data models and modules in web2py) http://www.web2pyslices.com/slice/show/1479/model-less-apps-using-data-models-and-modules-in-web2py <

[web2py] Re: temporary tables to easily use native smartgrid with session-specific data?

2013-01-21 Thread Niphlod
there's no such thing as a db that holds records just for the duration of a session automatically (with a session being n>1 requests). Just add the usual suspects to the table"updated_on", a "user_id" and a "status" column, with a default "temp" and change it to "confirmed" as soon as the u

[web2py] temporary tables to easily use native smartgrid with session-specific data?

2013-01-21 Thread Tim Richardson
I want a controller that fetches a user-chosen subset of data via JSON from an external site, and then presents that for review using smartgrids. Being lazy, I could put the fetched data into a couple of tables. There is a one-to-many relationship in the data (orders and order lines). But the fet

Re: [web2py] Re: onvalidation form.vars empty

2013-01-21 Thread António Ramos
I need a multi file uploader. Web2py does not have it yet. I saw an example using another table for the files. I dont know how to sqlform 2 tables. The book showed me how to do it with sqlform.factory Thank you António 2013/1/21 Massimo Di Pierro > If you want want to interact with a database

Re: [web2py] Redmine beside web2py with Nginx deployment script

2013-01-21 Thread Arnon Marcus
I actually ended up choosing CentOS over Ubuntu, as I'm going for a multi-VM array over Windows 2008R2 Hyper-V, and it has better support for CentOS/RHEL then for Ubuntu (something relating to virtualization acceleration...) Will the already-existing script for CentOS work for 6.3 86_64 ? How dif

Re: [web2py] Re: onvalidation form.vars empty

2013-01-21 Thread Massimo Di Pierro
If you want want to interact with a database table why use SQLFORM.factory and not simply SQLFORM? On Monday, 21 January 2013 15:25:07 UTC-6, Ramos wrote: > > Thank you Massimo, you are always available to help. Where is Bill Gates > when we need it right? > > I restarted web2py and it works

[web2py] Re: 'list:reference', contains, Mysql, instr

2013-01-21 Thread Massimo DiPierro
Now I understand the problem. You want to pass an expression where a value is expected. I do not believe we can support this. INSTR does not solve the problem because it would not be correct to looks for substrings. In fact paper.authors may contain '|12|13|' and it would incorrectly return that

Re: [web2py] Redmine beside web2py with Nginx deployment script

2013-01-21 Thread Richard Vézina
I just publish the script last version of the script on Bitbucket : https://bitbucket.org/richardv/setup-ubuntu-redmine-unicorn-web2py-uwsgi-nginx/src/4383ed417c128f7d4e46a42c708fe9ff78bec169/setup-ubuntu-redmine-unicorn-web2py-uwsgi-nginx.sh?at=default I plan to publish it on GitHub too in the co

[web2py] Re: Re-enable admin interface

2013-01-21 Thread Niphlod
admin works on sessions like any other app. I think your problem will be easily fixed by just deleting the applications/admin/sessions/* files. On Monday, January 21, 2013 7:18:01 PM UTC+1, Wonton wrote: > > Hello, > > Trying to upload my web2py project to the server I failed to enter the > admi

Re: [web2py] Re: onvalidation form.vars empty

2013-01-21 Thread António Ramos
Thank you Massimo, you are always available to help. Where is Bill Gates when we need it right? I restarted web2py and it works Strange Second question. as i am using sqlform.factory to add records how to use it also to update or delete? Thank YOU again! António 2013/1/21 Massimo Di

[web2py] Re: Scheduler ignoring period/repeat setting.

2013-01-21 Thread Niphlod
scheduler support coming . I think you didn't understand how models works / the scheduler works. Sorry for probably being redundant/naive, but just to check. in models belong: def myfunction(): whatever from gluon.scheduler import Scheduler myscheduler = Scheduler(db) Th

[web2py] Re: Exposing validators as JSON?

2013-01-21 Thread Bill Thayer
Nice! Looking for loads_json in serializers.py; Found custom_json instead that takes an object, checks it for a custom attribute and a callable. then returns the objects custom_json() method...[I call it a method but in Python I guess it's an attribute?]...Basically, before calling json() I ne

Re: [web2py] Re: Book in epub format?

2013-01-21 Thread Niphlod
rotfl. always available, but I don't know a single thing about the epub format. did anyone tried just converting the pdf to epub using calibre ? On Monday, January 21, 2013 4:11:14 PM UTC+1, Alan Etkin wrote: > > I can try if I understand the working of the book app. At the moment my >> underst

Re: [web2py] Form with fields collected from javascript

2013-01-21 Thread Christian Espinoza
Weird, because I'm noted that the first save process doesn't work, but from the second all work fine :-/ and I'm have the same code without changes... I'm have the trunk version.. El lunes, 21 de enero de 2013 17:12:38 UTC-3, rochacbruno escribió: > > SQLFORM expects a field named "fences_cu

Re: [web2py] Form with fields collected from javascript

2013-01-21 Thread Bruno Rocha
SQLFORM expects a field named "fences_customer" the pattern is tablename_fieldname --

Re: [web2py] Form with fields collected from javascript

2013-01-21 Thread Christian Espinoza
Hi Bruno I have on this way the code now at the view: {{=form.custom.begin}} Name: {{=form.custom.widget.name}} {{=form.custom.submit}} {{=form.custom.end}} and I getting the values for every input ok, but SQLForm doesn't store nothing at the db... Thanks Christian. El lunes, 21 de enero

[web2py] Re: How to redirect within a method that was invoked via Ajax?! Problem with wrong method being called.

2013-01-21 Thread Massimo Di Pierro
Assuming your ajax callback function is correctly called you just need to do: redirect(location, client_side=True) instead of redirect(location) With client_side = True you are handling the redirect client-side and not server side. This is designed to work over ajax requests. On Monda

Re: [web2py] book typo

2013-01-21 Thread Richard Vézina
Ok, nevermind then... I was with 2.3.2. Richard On Mon, Jan 21, 2013 at 12:57 PM, Massimo Di Pierro < massimo.dipie...@gmail.com> wrote: > Both work with trunk code. > > > On Monday, 21 January 2013 09:56:43 UTC-6, Richard wrote: >> >> Hello, >> >> There is a typo in the book : {{=form.custom.d

Re: [web2py] Re: onvalidation form.vars empty

2013-01-21 Thread Massimo Di Pierro
Here is my test. $ python web2py.py -S welcome (InteractiveConsole) >>> import sys >>> form = SQLFORM.factory(Field('name')) >>> form.process(onvalidation=lambda form:sys.stdout.write('check!\n'),formname=None,session=None) check! It works. Something else is wrong in your code. If you could pos

[web2py] How to redirect within a method that was invoked via Ajax?! Problem with wrong method being called.

2013-01-21 Thread c0nstin3
Hi everyone, Could someone please help me with a problem I'm having with the *amazing*web2py framework? This is hard to explain, so please bear with me, I'm still new to web development :) I seem to have a problem with using redirect in a function that is called via ajax. I thought

Re: [web2py] Re: problems with wiki create

2013-01-21 Thread paolo.vall...@gmail.com
Hi Alan, good catch, I don't know how wiki works but if it is only to add a field to the table and handle it during insert/update it is worth to do that. isn't it? When a user is editing a page he/she can choose from a dropdow list the render engine to use. Paolo 2013/1/21 Alan Etkin > ... In

[web2py] Re-enable admin interface

2013-01-21 Thread Wonton
Hello, Trying to upload my web2py project to the server I failed to enter the admin password (4 times :-S) so the admin interface was automatically disabled. Since I have no access to my server and I have to request all things to the server administrators I asked them to re-enable the admin in

Re: [web2py] Form with fields collected from javascript

2013-01-21 Thread Bruno Rocha
include hidden fields the use Javascript to populate $('#customer').val("something") --

Re: [web2py] Re: onvalidation form.vars empty

2013-01-21 Thread António Ramos
Sorry for insisting, I ´m using onvalidation in sqlform but if i use it in sqlform.factory i get a flash message Errors in Form. Please check it out!!! *Secondly* as i am using sqlform.factory to add records how to use it also to update or delete? Thank you António 2013/1/21 Massimo Di Pierro

Re: [web2py] Re: onvalidation form.vars empty

2013-01-21 Thread Massimo Di Pierro
yes. On Monday, 21 January 2013 11:35:00 UTC-6, Ramos wrote: > > can onvalidation be used with sqlform.factory ? > > i´m getting error > > Errors in Form. Please check it out!!! > > > Thank you > > > António > > 2013/1/17 Massimo Di Pierro > > >> *You are storing the image twice:* >> * >> * >> *if

Re: [web2py] book typo

2013-01-21 Thread Massimo Di Pierro
Both work with trunk code. On Monday, 21 January 2013 09:56:43 UTC-6, Richard wrote: > > Hello, > > There is a typo in the book : {{=form.custom.delete}} > At the end of the section custom form : > http://web2py.com/books/default/chapter/29/07#Custom-forms > Just above CSS Conventions. > > Shoul

Re: [web2py] Re: Custom form delete Crud checkbox

2013-01-21 Thread Massimo Di Pierro
this was fixed in trunk some time ago: self.custom.delete = self.custom.deletable = '' On Monday, 21 January 2013 09:55:09 UTC-6, Richard wrote: > > > On Wed, Dec 26, 2012 at 5:55 AM, Alan Etkin > > wrote: > >> form.custom.deletable > > > In this case there is an error in book : {{=form.custom.

[web2py] Re: 'list:reference', contains, Mysql, instr

2013-01-21 Thread Massimo Di Pierro
Before we attempt to fix this. It works for me as it is with sqlite. Why does doesn't it wirk with mysql? MySQL has a LIKE operator. Wat error do you get? I can see why using the INSTR operator on MySQL may be better but do we know it is faster? Massimo On Monday, 21 January 2013 08:55:40 UTC

[web2py] Form with fields collected from javascript

2013-01-21 Thread Christian Espinoza
Hello!! I have a Form for this table, but I'm only want to get the 'name' field from the user input. the other fields I need fill them from javascript vars... Model: db.define_table('fences', Field('customer', db.customer, label='Cliente', notnull=True), Field('name', leng

Re: [web2py] Re: problems with wiki create

2013-01-21 Thread Alan Etkin
> > ... In the meanwhile I have opened a issue for having the render option at > page ... > Perhaps it's possible to add a .render record field and have the wiki collect the option from the record on document reads. When calling auth.wiki(render=...) the wiki object should set the .render fie

Re: [web2py] Re: onvalidation form.vars empty

2013-01-21 Thread António Ramos
can onvalidation be used with sqlform.factory ? i´m getting error Errors in Form. Please check it out!!! Thank you António 2013/1/17 Massimo Di Pierro > *You are storing the image twice:* > * > * > *if trabalhador_form.process(onvalidation=attach_image_to_record).accepted: > # here after v

Re: [web2py] Redmine beside web2py with Nginx deployment script

2013-01-21 Thread Richard Vézina
On Tue, Jan 15, 2013 at 10:31 AM, Arnon Marcus wrote: > and postgres, each are "owned" by a different use, each of which is > different from my user - so I don't have permission to edit them... > What should I do? > sudo YOUR COMMAND Richard --

[web2py] 'list:reference', contains, Mysql, instr

2013-01-21 Thread pablo . angulo
Hello: I was getting incorrect SQL from statements like: db(db.paper.authors.contains(person.id)).select() where db.define_table('paper', Field('title'), Field('authors', 'list:reference person'), ) so I rewrote dal.MySQLAdapter.CONTAINS from: def CONTAINS(self, first, s

[web2py] book typo

2013-01-21 Thread Richard
Hello, There is a typo in the book : {{=form.custom.delete}} At the end of the section custom form : http://web2py.com/books/default/chapter/29/07#Custom-forms Just above CSS Conventions. Should be : {{=form.custom.deletable}} Richard --

Re: [web2py] Re: Custom form delete Crud checkbox

2013-01-21 Thread Richard Vézina
On Wed, Dec 26, 2012 at 5:55 AM, Alan Etkin wrote: > form.custom.deletable In this case there is an error in book : {{=form.custom.delete}} At the end of the section custom form : http://web2py.com/books/default/chapter/29/07#Custom-forms Just above CSS Conventions. Richard --

Re: [web2py] Re: Book in epub format?

2013-01-21 Thread Alan Etkin
> > I can try if I understand the working of the book app. At the moment my > understanding of how the book app works is very limited. > When you go to /default/chapter// the app creates .html files stored in /static_chaps For more information try sending a Bat-Signal to Niphlod --

Re: [web2py] Re: is bug? sqlform.factory

2013-01-21 Thread Alan Etkin
> > But I agree this is odd. > My bad, I thought the two args were mandatory (sorry Bruno for re-posting, I sent a reply to author by mistake) --

Re: [web2py] Re: is bug? sqlform.factory

2013-01-21 Thread Bruno Rocha
I think the "max" is the first because you can ommit the second. IS_LENGTH(10) will allow max 10. No need to inform the second. But I agree this is odd. --

[web2py] Re: is bug? sqlform.factory

2013-01-21 Thread Alan Etkin
You can use the IS_LENGTH validator: requires = IS_LENGTH(1, 0) # The max length is the first argument, don't ask why --

Re: [web2py] is bug? sqlform.factory

2013-01-21 Thread Bruno Rocha
IS it SQLITE? Sqlite dos not implements ALTER TABLE for column properties, if you created the model with n length and so changed it later, sqlite does not respect this. It is a sqlite problem. *if another database, so can be a dal problem On Mon, Jan 21, 2013 at 11:43 AM, www.diazluis.com wrot

[web2py] is bug? sqlform.factory

2013-01-21 Thread www.diazluis.com
when implemented the following code, I notice that the system does not respect the length of the field in the database. if the user enters a name of more than one (1) character the system stores .. wonder: is this a bug? to the following model: auth_user_id = (auth.user and auth.user.id)

[web2py] Scheduler ignoring period/repeat setting.

2013-01-21 Thread Stormcrow
I have created a *scheduler.py *in /models/ which looks something like this: def my_function(): ### function body ### scheduler = Scheduler(db) scheduler.queue_task( function='my_function', task_name = 'my_function', repeats = 0, # unlimited runs period = 300 # every 5 minutes )

Re: [web2py] How to automatically send emails to users if they perform an action like sign up...

2013-01-21 Thread Bruno Rocha
in your models. mail = auth.settings.mailer mail.settings.server = "your_smtp_server_and:port" mail.settings.sender = "y...@you.com" mail.settings.login = "y...@you.com:password" # sends an verification e-mail upon registration auth.settings.registration_requires_verification = True def send_em

[web2py] How to automatically send emails to users if they perform an action like sign up...

2013-01-21 Thread sasogeek
I want to know how to send emails to users automatically based on their actions... specifically things like an email verification (for validation), notifications for updates and similar actions... --

[web2py] looking for volunteers to help proof-read book 5th ed.

2013-01-21 Thread dhmorgan
Signed, I hope! I just downloaded diff and am looking forward to the task. --

Re: [web2py] How to update web app on server without change the data already in database

2013-01-21 Thread selecta
as Johann already mentioned overwriting all your .py files will not change you database so you should be fine doing that if you do not wan to do this manually you can e.g. use a version control system and exclude the content of the databases directory then on the client side all you have to do

[web2py] scientific reference for migrations

2013-01-21 Thread selecta
As I am currently writing my phD thesis i wonder if there is a proper reference to the migrations technique used in web2py. I cannot even find a proper Wikipedia article for that (not that this would be a reference I would like to use). the closest I found so far is http://guides.rubyonrails.or

[web2py] Re: Exposing validators as JSON?

2013-01-21 Thread Alan Etkin
> For me, a 'json:reference attributes' field would basically be like a "list: string" field but with only one string > holding a json object of a variable list of attributes with their value and unit. Then you can do simply: db.define_table(... Field("a_list_of_json_objects", "json")) When yo

[web2py] Re: looking for volunteers to help proof-read book 5th ed.

2013-01-21 Thread Alan Etkin
> > The attached file contains the changes between the 4th edition and 5th > edition (only the new text). The imap adapter has two new features that could be updated in the email section (faster queries by field and override mailbox name mapping). --

Re: [web2py] Re: Book in epub format?

2013-01-21 Thread Johann Spies
On 18 January 2013 17:38, Massimo Di Pierro wrote: > Can you help us make the epub? > > On Thursday, 17 January 2013 04:59:59 UTC-6, Johann Spies wrote: >> >> Is there any chance to get the book in epub-format? >> >> I think it should be possible using markmin -> xhtml > epub (via calibre)? >> >>

Re: [web2py] Problem: SQLFORM.grid and setting a value for a field when a new dataset is created

2013-01-21 Thread Johann Spies
On 18 January 2013 15:05, Sverre wrote: > I have a contact table that includes our employees too. To make a > difference I have a cclass field to make the difference. When I want to > create an employee the user should not have a choice to set the cclass > field, but when he is creating a custome

Re: [web2py] Re: PowerFormWizard 0.1.4 - Bug Fixes and auto_validation (+ a new plugin for grids)

2013-01-21 Thread António Ramos
Your powerformwizard is layed out horizontally. For large number of steps i think it would be better vertically like an accordion .Also better for printing Also instead of blocking users from going to next step without filling fields in current step it would be nicer just to block editing next step

Re: [web2py] How to update web app on server without change the data already in database

2013-01-21 Thread Johann Spies
On 21 January 2013 04:46, animnook wrote: > I have a web app on server and I use web2py web interface to update the > project file. > But the users wants to add data in db while I am still working on other > part of the app. > as right now I just copy and paste everything in controller file local