Re: [web2py] Re: SEO Friendly URLs and Page Titles

2012-08-25 Thread Anthony
Oh, yeah, I guess you probably can't use the id in a compute because there is no id until the record has been inserted. You could instead make the id part of the URL (like Stack Overflow), or maybe make it a virtual field, or generate your own unique id (separate from the record id). Anthony O

Re: [web2py] Re: SEO Friendly URLs and Page Titles

2012-08-25 Thread SeamusSeamus
Thanks for the info Anthony... When I do this: Field('slug', compute=lambda row: IS_SLUG()(row.title + "-" + str(row.id))[0]) I get none as a slug... On Saturday, August 25, 2012 5:53:49 PM UTC-6, Anthony wrote: > > Sure, something like that seems fine. Look at what SO does -- for example

[web2py] Re: Option to visit Non-mobile site with @mobilize

2012-08-25 Thread Anthony
I don't think you can control that using the @mobilize decorator, but instead of using the decorator, you can use request.user_agent().is_mobile to detect mobile clients and make changes accordingly. The @mobilize decorator just does this: user_agent = request.user_agent() if us

[web2py] Option to visit Non-mobile site with @mobilize

2012-08-25 Thread Mark Li
I would like to add the option to visit the regular version of the site on the mobile-view. However, from my understanding of @mobilize, it automatically redirects to the mobile version of the page if a mobile device is detected. Is there a way to override this behavior if a visitor on a mobile

Re: [web2py] Re: SEO Friendly URLs and Page Titles

2012-08-25 Thread Anthony
Sure, something like that seems fine. Look at what SO does -- for example: http://stackoverflow.com/questions/12050934/web2py-build-forms-in-controller-or-view. I think they use the number as the unique record identifier, but also include a slug (which doesn't necessarily have to be unique). A

[web2py] Re: SQLFORM id

2012-08-25 Thread pylix
I don't; just wondering if it was possible. I reconfigured my app to get the vars after they're processed I have no outstanding issues. for me this topic is closed. thanks for all the responses and explanations. On Saturday, August 25, 2012 6:57:09 PM UTC-4, Anthony wrote: > > but this all leads m

Re: [web2py] Re: NoSQL Question Again!!!

2012-08-25 Thread Niphlod
Ok, I think you have a problem with all the apps without a predefined model, not a problem with web2py. I don't think there are out there applications without a model (some kind of model is required in programming, heck, even ideas in your brain are) but there are evolving applications. You

Re: [web2py] Re: SEO Friendly URLs and Page Titles

2012-08-25 Thread SeamusSeamus
This runs into a problem where if I have two items of the same 'title', the user will only be linked to the first one that was created. Can I make it so the slug is a field that I designate? Or make it so the slug adds a incrementing number such as: Field('slug', compute=lambda row: IS_SLUG(

Re: [web2py] Re: Defining stored procedures

2012-08-25 Thread Anthony
I suppose executesql would be fine in that case if you want to do it that way. On Saturday, August 25, 2012 6:34:18 PM UTC-4, Yarin wrote: > > Yeah I could create them outside of web2py, was just wondering if there > was a good way to perform SQL 'prep' on a db along with the table > migrations

[web2py] Re: SQLFORM id

2012-08-25 Thread Anthony
> > but this all leads me to the realization that web2py does > not give a value to the form field of a SQLFORM until the form > is processed, is there a request.vars.id that can > be used before processing? > Note, the id is the record id of the record added to the database. The record cannot b

[web2py] Re: set a javascript variable using web2py helpers

2012-08-25 Thread Anthony
> > Enter code here... > > // In the mySite.js file >var myImg = "{{IMG(_src = URL('static','image/myImage.jpg') )}}"; > Note, the above will only work if mySite.js is a web2py template and the file is served by calling a web2py action (i.e., it can't be a static file). Another approach, th

Re: [web2py] Re: Defining stored procedures

2012-08-25 Thread Yarin Kessler
Yeah I could create them outside of web2py, was just wondering if there was a good way to perform SQL 'prep' on a db along with the table migrations.. not critical though. On Sat, Aug 25, 2012 at 6:29 PM, Anthony wrote: > Do they need to be created dynamically by your app? If not, you could just

[web2py] Re: Defining stored procedures

2012-08-25 Thread Anthony
Do they need to be created dynamically by your app? If not, you could just create them outside of web2py. Side note -- if you want web2py to generate SQL for any queries, you can form the queries as usual and call the ._select() method instead of .select() -- that will return the SQL as a strin

[web2py] Re: Category and Subcategory

2012-08-25 Thread Anthony
That kind of thing has to be done via Javascript on the client side. For some references, see http://stackoverflow.com/questions/8146260/best-practice-for-populating-dropdown-based-on-other-dropdown-selection-in-web2p/8152910#8152910 . Anthony On Saturday, August 25, 2012 5:34:14 PM UTC-4, Seam

[web2py] Defining stored procedures

2012-08-25 Thread Yarin
I'm assuming there's probably no support for defining stored procedures using DAL functions. Instead I was going to try to create them in raw sql using executesql whenever migrate was turned on. Just wondering if this is the best technique, or someone has another idea --

[web2py] Re: Web2Py on OpenShift

2012-08-25 Thread greaneym
Hi Andrew, I am using your web2py build on openshift and noticed today that you submitted a bug report for wsgi that was causing your access to the web2py admin tool to fail. I wonder if you have tried the ssh tunneling steps in the web2py manual in 13.3 but using a port that openshift does

Re: [web2py] Re: NoSQL Question Again!!!

2012-08-25 Thread apps in tables
A nice aticle http://www.aosabook.org/en/nosql.html I am still looking for schema-free application example. > > Regards, > > Ashraf > --

[web2py] Category and Subcategory

2012-08-25 Thread SeamusSeamus
Right now I am categorizing my products by 'category' and 'subcategory' using smartgrid. This makes it very easy for me to log in and set my cats and sub cats. I have two tables below. db.define_table('cat', Field('name'), format = '%(name)s' ) db.define_table('subcat', Field('

Re: [web2py] Re: DAL not returning results on temp table query

2012-08-25 Thread Yarin Kessler
Massimo- good, that's help- thanks On Sat, Aug 25, 2012 at 4:39 PM, Massimo Di Pierro < massimo.dipie...@gmail.com> wrote: > Exately. On top of this until yesterday executesql had a "try fetchall() > except return None." which is now gone. If you get the latest web2py from > trunk it should give

Re: [web2py] Error when assigning form.vars

2012-08-25 Thread SeamusSeamus
Thanks! On Saturday, August 25, 2012 1:37:55 PM UTC-6, Jonathan Lundell wrote: > > On 25 Aug 2012, at 12:27 PM, SeamusSeamus > > > wrote: > > When I do this: > form=SQLFORM.factory( > Field('your_email',requires=IS_EMAIL()), > Field('your_phone'), > Field('subject'),

Re: [web2py] Re: NoSQL Question Again!!!

2012-08-25 Thread apps in tables
My point (case) is : For the parts where a model is not known in advance, you can use the underlying NoSQL adapter of your choice to accomplish everything you want. My question is: What will be the structure of the application in that case? controller , view , no model., My very simple

[web2py] Re: custom built login form

2012-08-25 Thread Massimo Di Pierro
+1 On Saturday, 25 August 2012 14:57:53 UTC-5, shartha wrote: > > You're awesome! Thank you Anthony! > > On Tuesday, August 14, 2012 10:51:12 PM UTC-7, shartha wrote: >> >> Hello, >> Quick question: >> Instead of {{=auth.login()}}, I am using the following to be able to >> customize my login for

[web2py] Re: set a javascript variable using web2py helpers

2012-08-25 Thread Massimo Di Pierro
You can. I am not sure if you need var myImg = '{{=IMG(_src = URL('static','image/myImage.jpg') )}}'; // single quotes contain '' or var myImg = "{{=URL('static','image/myImage.jpg')}}"; // url only On Saturday, 25 August 2012 14:56:05 UTC-5, shartha wrote: > > Hi, > > Is there any way to s

[web2py] Re: DAL not returning results on temp table query

2012-08-25 Thread Massimo Di Pierro
Exately. On top of this until yesterday executesql had a "try fetchall() except return None." which is now gone. If you get the latest web2py from trunk it should give you an error. On Saturday, 25 August 2012 13:52:42 UTC-5, Niphlod wrote: > > I think the DBAPI doesn't support several results s

[web2py] Re: DAL not returning results on temp table query

2012-08-25 Thread Yarin
Thanks Simone- yeah I just figured this out. Though I actually went a different route and just stuffed it all in a stored procedure.. On Saturday, August 25, 2012 2:52:42 PM UTC-4, Niphlod wrote: > > I think the DBAPI doesn't support several results set in a single > statement. > > If you cared

Re: [web2py] Major speed improvement need testers

2012-08-25 Thread Massimo Di Pierro
Exactly. mytable.myfield.set_attributes(readable=True,writable=True) is just a shortcut for mytable.myfield.readable=True mytable.myfield.writable=True without it the lambda notation would not be very usable. On Saturday, 25 August 2012 11:50:10 UTC-5, Jonathan Lundell wrote: > > On

[web2py] Re: Screenplay formatting with web2py - markdown2.py

2012-08-25 Thread Massimo Di Pierro
I do not know anything about the subject but a quick search yields: http://johnaugust.com/2004/screenbox So once could define: .screenplay { font: 12px/14px Courier, fixed; width: 420px; background: #eee; border: 1px solid #333; padding: 5px 14px;} .screenplay h2, .screenplay h3, .screenplay bl

[web2py] Re: custom built login form

2012-08-25 Thread shartha
You're awesome! Thank you Anthony! On Tuesday, August 14, 2012 10:51:12 PM UTC-7, shartha wrote: > > Hello, > Quick question: > Instead of {{=auth.login()}}, I am using the following to be able to > customize my login form. However the resulting form does not work and I > cannot login with the

[web2py] set a javascript variable using web2py helpers

2012-08-25 Thread shartha
Hi, Is there any way to set the value of a global javascript variable defined in a .js file using web2py helpers? I have an image in my static/image folder and I want to use the URL of the image in the javascript function. something like this: // In the mySite.js file var myImg = "{{IMG(_

Re: [web2py] Error when assigning form.vars

2012-08-25 Thread Jonathan Lundell
On 25 Aug 2012, at 12:27 PM, SeamusSeamus wrote: > When I do this: > form=SQLFORM.factory( > Field('your_email',requires=IS_EMAIL()), > Field('your_phone'), > Field('subject'), > Field('question', 'text', requires=IS_NOT_EMPTY())) > form.vars = dict(subject=

[web2py] Error when assigning form.vars

2012-08-25 Thread SeamusSeamus
When I do this: form=SQLFORM.factory( Field('your_email',requires=IS_EMAIL()), Field('your_phone'), Field('subject'), Field('question', 'text', requires=IS_NOT_EMPTY())) form.vars = dict(subject='Item %s: %s' % (database.id, database.title)) if form.proce

[web2py] Re: SQLFORM id

2012-08-25 Thread Niphlod
For "creation" forms (forms that not update an existing record but insert a new one) you do not know the id in advance. onvalidation is called before the record is inserted, and is meant to report any errors that standard validators do not cover. Your function is called a moment before the recor

[web2py] Re: SQLFORM id

2012-08-25 Thread pylix
fixed a typo On Saturday, August 25, 2012 2:52:17 PM UTC-4, pylix wrote: > > the problem i found after debugging is this... > here's the some code in the model > > def build_email(form): > html_email = '%s' % BEAUTIFY(form.vars) > mail.send(to=['destinat...@gmail.com'], > reply_

[web2py] Re: DAL not returning results on temp table query

2012-08-25 Thread Niphlod
I think the DBAPI doesn't support several results set in a single statement. If you cared to do those one line at a time you'd noticed that: create temporary table tmp like people does not return results. insert into tmp select * from people returns the just inserted values select * from tmp retur

[web2py] Re: SQLFORM id

2012-08-25 Thread pylix
the problem i found after debugging is this... here's the some code in the model def build_email(form): html_email = '%s' % BEAUTIFY(form.vars) mail.send(to=['destinat...@gmail.com'], reply_to=form.vars.email, subject='request' + str(form.vars.id), message=html_e

Re: [web2py] Re: NoSQL Question Again!!!

2012-08-25 Thread Niphlod
I lost the meaning of your pointsorry. DAL is meant to be a "universal" glue to let the users work with some nice syntax and be able to be database independant. Used within web2py, it speeds up form creation and data retrieval for many dbs (including NoSQL ones). "YesSQL" (please bear with

Re: [web2py] Re: NoSQL Question Again!!!

2012-08-25 Thread apps in tables
Do you mean that this will be the next web2py example (appliance)? --

Re: [web2py] Re: Field.Lazy attaching unbound Class method

2012-08-25 Thread Marin Pranjić
Found it... You should not use 'get' as a fieldname. if you change 'db.test.get' to 'db.test._get' or something else, it will work. or you can use: db.test[1]['get']() instead of db.test[1].get() Marin On Sat, Aug 25, 2012 at 6:35 PM, Marek Mollin wrote: > I missed the table name alright.

Re: [web2py] Major speed improvement need testers

2012-08-25 Thread Jonathan Lundell
On 23 Aug 2012, at 7:25 AM, Massimo Di Pierro wrote: > So now in trunk you can do: > > db = DAL(lazy_tables=True) > db.define_table('person',Field('name'),Field('age','integer'), >on_define=lambda table: [ >table.name.set_attributes(requires=IS_NOT_EMPTY(),default=''), >

Re: [web2py] Re: Field.Lazy attaching unbound Class method

2012-08-25 Thread Marek Mollin
I missed the table name alright. But lazy fields wont be called internally... so row.tablename.fieldname will return a function rather than value... W dniu sobota, 25 sierpnia 2012 18:29:00 UTC+2 użytkownik Marin Pranjić napisał: > > You don't have to call .get() > It will be called internally wi

Re: [web2py] Re: Field.Lazy attaching unbound Class method

2012-08-25 Thread Marin Pranjić
Ignore my comment... This is Field.Lazy not .Virtual. Sorry On Sat, Aug 25, 2012 at 6:29 PM, Marin Pranjić wrote: > You don't have to call .get() > It will be called internally with a row as an argument. > > And you should be using row.tablename.fieldname (instead just > row.fieldname) > > Marin

Re: [web2py] Re: Field.Lazy attaching unbound Class method

2012-08-25 Thread Marin Pranjić
You don't have to call .get() It will be called internally with a row as an argument. And you should be using row.tablename.fieldname (instead just row.fieldname) Marin On Sat, Aug 25, 2012 at 6:20 PM, Marek Mollin wrote: > Still not working. > When I add static I can do: > > >> Test.get(db.te

[web2py] Re: Field.Lazy attaching unbound Class method

2012-08-25 Thread Marek Mollin
Still not working. When I add static I can do: >> Test.get(db.test[1]) >> 'testobject' This is fine. But I cant do db.test[1].get() as it gives me TypeError - expected at least 1 argument. I thought that if something is defined as Field.Lazy that function automatically gets row as first argumen

Re: [web2py] Field.Lazy attaching unbound Class method

2012-08-25 Thread Jonathan Lundell
On 25 Aug 2012, at 8:33 AM, Marek Mollin wrote: > Hello, > > I have a problem with a construct like that: > db.define_table('test', > Field('name'), > ) > > > class Test(object): > def get(row): > return row.name > def get_hello(row, greeting): > return '%s %s' % (gr

[web2py] DAL not returning results on temp table query

2012-08-25 Thread Yarin
I'm trying to execute some SQL from the DAL that relies on a temp table: CREATE TEMPORARY TABLE tmp LIKE people; INSERT INTO tmp SELECT * FROM people; INSERT INTO tmp SELECT * FROM people; SELECT * FROM tmp; This code works fine in a SQL panel, but fails when used in the DAL: def test():

[web2py] Formulario personalizado

2012-08-25 Thread Miguel
Hola, Estoy haciendo pruebas con formularios y me ha surgido una duda, quisiera crear un formulario de creación (SQLFORM, CRUD.create o similar) de una tabla. En esa tabla tengo una relación con otra tabla, al crear el formulario de la tabla completa me aparece la relación mediante un combo de

[web2py] Re: Field.Lazy attaching unbound Class method

2012-08-25 Thread Anthony
Perhaps you want to use static methods: class Test(object): @staticmethod def get(row): return row.name Anthony On Saturday, August 25, 2012 11:33:06 AM UTC-4, Marek Mollin wrote: > > Hello, > > I have a problem with a construct like that: > db.define_table('test', > Field('n

[web2py] Re: custom built login form

2012-08-25 Thread Anthony
On Saturday, August 25, 2012 11:33:57 AM UTC-4, shartha wrote: > > Thanks Anthony, I didn't know you could use jQuery selectors for the > second argument. One more question: > Is it possible to generate the *remember me checkbox* using the * > form.custom.widget*, or I should create my own checkbo

[web2py] Re: custom built login form

2012-08-25 Thread shartha
Thanks Anthony, I didn't know you could use jQuery selectors for the second argument. One more question: Is it possible to generate the *remember me checkbox* using the * form.custom.widget*, or I should create my own checkbox? On Tuesday, August 14, 2012 10:51:12 PM UTC-7, shartha wrote: > > Hel

[web2py] Field.Lazy attaching unbound Class method

2012-08-25 Thread Marek Mollin
Hello, I have a problem with a construct like that: db.define_table('test', Field('name'), ) class Test(object): def get(row): return row.name def get_hello(row, greeting): return '%s %s' % (greeting, row.name) db.test.get = Field.Lazy(Test.get) db.test.get_hello =

[web2py] Re: SQLFORM.grid redirects and access

2012-08-25 Thread lyn2py
Figured it out. I need to put user_signature=True in all the links as well. Sorry for the noise. On Saturday, August 25, 2012 9:52:17 PM UTC+8, lyn2py wrote: > > Hi Massimo, > > I picked Option(1). > They both have @auth.requires_membership('Admin') and user_signature=True > (the default sett

Re: [web2py] Re: get rid of 'verify password' in register?

2012-08-25 Thread Alec Taylor
Hmm, that worked this time... not sure what happened last-time. Maybe I had put the code in the wrong section of the file? On Sat, Aug 25, 2012 at 11:48 PM, Anthony wrote: > Are you saying you don't want the verify password field on the register form > (i.e., requiring users to enter the password

[web2py] Re: SQLFORM.grid redirects and access

2012-08-25 Thread lyn2py
Hi Massimo, I picked Option(1). They both have @auth.requires_membership('Admin') and user_signature=True (the default setting) I used a logged-in account that has access to both functions. Both pages can be accessed individually, but cannot be accessed when either link is used. I am using th

[web2py] Re: get rid of 'verify password' in register?

2012-08-25 Thread Anthony
Are you saying you don't want the verify password field on the register form (i.e., requiring users to enter the password twice when registering)? If so, just do this after defining auth: auth.settings.register_verify_password = False Anthony On Saturday, August 25, 2012 12:02:08 AM UTC-4, Ale

[web2py] Re: SQLFORM id

2012-08-25 Thread Anthony
Can you show your code? It should be in form.vars.id after submission. Anthony On Saturday, August 25, 2012 9:16:42 AM UTC-4, pylix wrote: > > I'm having trouble getting the server to access the id field upon > submission of my SQLFORM > I did not define my own id field in the model, i have no i

[web2py] SQLFORM id

2012-08-25 Thread pylix
I'm having trouble getting the server to access the id field upon submission of my SQLFORM I did not define my own id field in the model, i have no issue with the auto-created one except that I can't figure out how to store the id in a variable for view use. all other fields are accessible usin

[web2py] Re: SQLFORM.grid redirects and access

2012-08-25 Thread Massimo Di Pierro
You have two options: 1) decorate your functions with @auth.requires_login() and user_signature = True (default) 2) leave the functions as they are and user_signature = False (no protection) You cannot have a per user signature and at same time not require a logged in user. On Saturday, 25

Re: [web2py] Re: NoSQL Question Again!!!

2012-08-25 Thread Massimo Di Pierro
This is what is missing. A good coding example... You may still use models in the web2py sense of "code that gets executed before every action" to define for example Auth and other things. appadmin would become useless. SQLFORM only you force a schema. Massimo On Saturday, 25 August 2012 05:14

[web2py] Re: Upload from git repro - GitCommandError

2012-08-25 Thread Niphlod
Yes, you'd need the python-git module installed. I just sent a patch to Massimo to let the user know this without raising a ticket. On Saturday, August 25, 2012 10:54:19 AM UTC+2, mweissen wrote: > > Sorry, I wanted to write: > > I have found that a packed application "can be a git repo" and I t

Re: [web2py] Re: About the Scheduler

2012-08-25 Thread Niphlod
On Saturday, August 25, 2012 10:59:44 AM UTC+2, mweissen wrote: > > I have added a new record using the admin application. > In the meantime I have written a function to insert a new task - same > result, the worker does not pick it up. > Please attach the csv for the scheduler_task table, in o

[web2py] SQLFORM.grid redirects and access

2012-08-25 Thread lyn2py
I have 2 SQLFORM.grids, they are: ##MODELS db.define_table('company', #each staff can only see the customers under their account Field('company_name', 'string',length=255,requires=IS_NOT_EMPTY()), Field('description','text'), format='%(company_name)s' ) db.define_table('employees', #

Re: [web2py] Re: NoSQL Question Again!!!

2012-08-25 Thread apps in tables
> 1) The document itself if it needs to be schema free can go in a mongodb > and there is no need for the DAL apis. > > >> Let us go schema-free (mongodb), what will be the structure of the application ? controller , view , (no model) ? sequence of screens ? --

Re: [web2py] Re: About the Scheduler

2012-08-25 Thread Martin Weissenboeck
Thank you very much these details. 2012/8/24 Niphlod > >>- Then I have tried to add a scheduler to an existing application. >>The worker shows it's heartbeat, but does not pick up any task, What could >>be wrong? >> >> Depends on many factors...let's start to say: how did you add the

[web2py] Re: Upload from git repro - GitCommandError

2012-08-25 Thread Martin Weissenboeck
Sorry, I wanted to write: I have found that a packed application "can be a git repo" and I tried it with https://github.com/niphlod/w2p_scheduler_tests.git The result: global name 'GitCommandError' is not defined 2012/8/25 Martin Weissenboeck > I have found, that the url to upload a packed

Re: [web2py] Re: Bootstrap replacement for div class="flash"?

2012-08-25 Thread Alec Taylor
On Sat, Aug 25, 2012 at 2:33 PM, Massimo Di Pierro wrote: > As I said. I always liked this but some users did not and complained about > it. Yet times have changed. > For web2py 2.0 we have to freeze all layout changes because they take too > long to be tested. > > For example I had to revert your