Re: [web2py] Init Script in Web2Py

2012-08-13 Thread Mandar Vaze

>
> You can put something like that in models somewhere.
>

Putting this in models directory will make it execute every single time.
I suggest you put it in a separate scripts folder (which is what I have 
done) and execute it when you need it using :

python web2py.py -S  -M -R applications/
/scripts/.py

-Mandar

-- 





Re: [web2py] Connecting with database that has tables in it

2012-08-13 Thread hasan alnator
Dear ALL ,

So i can use sql server without defining tables , and if i want to use it
 , after i make the connection string i can use db.executesql("RAW SQL")
 ?? is that true ??


best regards,




On Mon, Aug 13, 2012 at 4:16 AM, pbreit  wrote:

> In order to use DAL query syntax, you have to define the tables.
>
> --
>
>
>
>

-- 





[web2py] Re: DAL belongs() fails on App Engine

2012-08-13 Thread howesc
we do special query handling on the key field, so i suspect the multiple 
filters on key is wonky.  i'll try and look at this in the next couple of 
days

thanks for reporting, and thanks for your patience guiding us through it. :)

christian

On Sunday, August 12, 2012 8:01:29 PM UTC-7, spiffytech wrote:
>
> Yes, I've verified that this can be done. The below query works in the App 
> Engine Datastore Viewer (note that it only worked once I manually created 
> the index in index.yaml and deployed it; web2py did not automatically 
> create the appropriate index:
>
> SELECT * FROM posts WHERE __key__ IN (KEY('posts', 3), KEY('posts', 4), 
> KEY('posts', 1003)) and post_date <= DATETIME('2012-08-12 00:00:00') ORDER 
> BY post_date DESC
>
>
> On Sunday, August 12, 2012 9:56:20 PM UTC-4, Anthony wrote:
>>
>> How would you do the query in GQL? Have you confirmed that it can be done?
>>
>> Anthony
>>
>> On Sunday, August 12, 2012 9:23:39 PM UTC-4, spiffytech wrote:
>>>
>>> I tested with your suggested orderby, but the outcome was the same.
>>>
>>> I tested with the query as you wrote it below, with no common_filter, 
>>> and the query still failed. Since that's a pretty straightforward query 
>>> that should work, this seems like a bug to me, so I filed a web2py bug 
>>> report: http://code.google.com/p/web2py/issues/detail?id=930
>>>
>>>
>>> On Thursday, August 9, 2012 5:39:14 PM UTC-4, howesc wrote:

 i had to look up common_filters.based on your experience i would 
 assume that this is being implemented as a query filter rather than 
 getting 
 results from the DB and then filtering them.  so what is must be causing 
 in 
 your case is:

 posts = db((db.posts.id.belongs(post_ids)) & 
 (db.posts.post_date<=request.now)).select(db.posts.ALL,orderby=db.posts.post_date,
  cache
 =(cache.ram, 60))

 it *might* work if you put an orderby on that is 
 db.posts.id|db.posts.post_date  
 i'm not sure.  you might have to remove the common filter for this query 
 and then filter the results. (i don't have experience with common filters 
 and how they are implemented)

 GAE has a restriction on IN queries (web2py belongs queries) that they 
 have no more than 30 items in the list.  "because i said so" says google.



 On Thursday, August 9, 2012 1:57:13 PM UTC-7, spiffytech wrote:
>
> I've narrowed the problem down further- the exception is caused by a 
> common_filter attached to my posts table:
>
> common_filter = lambda query: db.posts.post_date <= request.now
>
> I'm not sure why that would trigger the orderby error, though. 
>
> Also, is there some significance to limiting the belongs lists to 30 
> items?
>
>
>
> On Thursday, August 9, 2012 4:24:13 PM UTC-4, howesc wrote:
>>
>> the query and the error message do not match.  your query has no 
>> orderby, yet the error message suggests there is an orderby property 
>> set.  
>> this confuses me.
>>
>> i do:
>>
>> db(db.table.id.belongs([list of items not more than 30 
>> long])).select()
>>
>> all the time on GAE and it works for me (latest stable web2py, and 
>> the last time i checked trunk though that was a few weeks ago)
>>
>> note that cache does nothing on selects on GAE due to the inability 
>> to serialize Rows objects to memcache (at least i think that is the 
>> limitation)
>>
>> cfh
>>
>> On Thursday, August 9, 2012 10:40:33 AM UTC-7, spiffytech wrote:
>>>
>>> I'm trying to use the DAL belongs clause on App Engine and am 
>>> getting an error. 
>>>
>>> posts = db(db.posts.id.belongs(post_ids)).select(db.posts.ALL, cache
>>> =(cache.ram, 60))
>>>
>>> Produces:
>>>
>>> BadArgumentError: First ordering property must be the same as 
>>> inequality filter property, if specified for this query; received 
>>> __key__, 
>>> expected post_date
>>>
>>> Some Googling suggests this can be due to not providing a sort key. 
>>> I tried orderby=db.posts.post_date with no success. What could be 
>>> going wrong?
>>>
>>> I'm using the latest trunk web2py, but tested all the way back to 
>>> 1.99.3.
>>>
>>

-- 





[web2py] Re: KeyError: 'name' when inserting/updating via appadmin

2012-08-13 Thread Mandar Vaze
Done. 
http://code.google.com/p/web2py/issues/detail?id=931

-Mandar

On Saturday, August 11, 2012 2:58:57 AM UTC+5:30, Massimo Di Pierro wrote:
>
> Can you please open a ticket?
>
> On Wednesday, 8 August 2012 12:08:53 UTC-5, Mandar Vaze wrote:
>>
>> I'm using web2py version : Version 2.0.0 (2012-07-26 06:06:10) dev
>>
>> I have tables defined as follows : 
>>
>> name = db.Table(db, 'name',   
>>
>> Field('name', 'string', length=128, notnull=True, unique=True))  
>> 
>> name_desc = db.Table(db, 'base',
>> name,
>> Field('description', 'text', default='')) 
>>   
>> db.define_table('mother', 
>> name_desc,
>> format='%(name)s')
>> db.define_table('father', 
>> name_desc,
>> format='%(name)s')
>> db.define_table('child', 
>>  
>> name_desc,   
>>
>> Field('mother', db.mother),   
>> 
>> Field('father', db.father),   
>>
>> format='%(name)s')
>>
>> I am able to insert data in "mother" table via script (like 
>> db.mother.insert(name="Alice"))
>> But when I use appadmin to insert new record into mother table, I get the 
>> following error :
>>
>> Traceback (most recent call last):
>>   File "/home/mandar/web2py/gluon/restricted.py", line 205, in restricted
>> exec ccode in environment
>>   File "/home/mandar/web2py/applications/test1/controllers/appadmin.py", 
>> line 432, in 
>>   File "/home/mandar/web2py/gluon/globals.py", line 182, in 
>> self._caller = lambda f: f()
>>   File "/home/mandar/web2py/applications/test1/controllers/appadmin.py", 
>> line 127, in insert
>> if form.accepts(request.vars, session):
>>   File "/home/mandar/web2py/gluon/sqlhtml.py", line 1146, in accepts
>> hideerror=hideerror,
>>   File "/home/mandar/web2py/gluon/html.py", line 1870, in accepts
>> status = self._traverse(status,hideerror)
>>   File "/home/mandar/web2py/gluon/html.py", line 793, in _traverse
>> newstatus = c._traverse(status,hideerror) and newstatus
>>   File "/home/mandar/web2py/gluon/html.py", line 793, in _traverse
>> newstatus = c._traverse(status,hideerror) and newstatus
>>   File "/home/mandar/web2py/gluon/html.py", line 793, in _traverse
>> newstatus = c._traverse(status,hideerror) and newstatus
>>   File "/home/mandar/web2py/gluon/html.py", line 793, in _traverse
>> newstatus = c._traverse(status,hideerror) and newstatus
>>   File "/home/mandar/web2py/gluon/html.py", line 800, in _traverse
>> newstatus = self._validate()
>>   File "/home/mandar/web2py/gluon/html.py", line 1625, in _validate
>> (value, errors) = validator(value)
>>   File "/home/mandar/web2py/gluon/validators.py", line 554, in __call__
>> table = self.dbset.db[tablename]
>>   File "/home/mandar/web2py/gluon/dal.py", line 6877, in __getitem__
>> return dict.__getitem__(self, str(key))
>> KeyError: 'name'
>>
>> Similarly, after populating mother/father and child tables via script 
>> when I try to update "child" record - In the dropdown I see mother's names 
>> instead of ID (as expected) but when I select different "mother" and submit 
>> I get same error (traceback may be slightly different - but same 
>> KeyError:'name' )
>>
>> What is wrong with the table definitions ?
>>
>> Thanks,
>> -Mandar
>>
>>

-- 





[web2py] how to use Not belongs

2012-08-13 Thread Pradeesh
In my control I have an array with so many values. 
I want to write a dal query to update a table rows which having ID not in 
this array.

I want something like this.
db(db.table1.field1.notbelongs(array)).update(field2=False)

I have tried like this
db(db.table1.field1 not in(array)).update(field2=False) 
but this is not working fine. It is throwing an error as  raise RuntimeError, 
"No table selected"

I would greatly appreciate any suggestions. 

-- 





Re: [web2py] web2py 2.0 almost done

2012-08-13 Thread Marin Pranjić
Installing new app in admin via URL is not working for me (trunk)

On Tue, Aug 7, 2012 at 6:33 AM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> Web2py 2.0 is almost done.
> Please try the nightly build.
> Let us know if it breaks anything.
>
> massimo
>
> --
>
>
>
>

-- 





[web2py] Re: GAE SDK: Getting ImportError for gluon.contrib.populate import populate

2012-08-13 Thread Jaymin Oh
I just found by myself.

populate method in db.py doesn't support in GAE.

On Thursday, September 29, 2011 6:52:16 PM UTC+9, glomde wrote:
>
> Hi, 
>
> I am trying to use GAE but I get import error on populate in 
> db_wizard_populate.py. 
>
> It seems to do with the restricted environment. Do anybody know how to 
> fix this? 
>
> The traceback is: 
>
> Traceback (most recent call last): 
>   File "/home/g/web2py/gluon/restricted.py", line 192, in restricted 
> exec ccode in environment 
>   File "/home/g/web2py/applications/myapp2/models/ 
> db_wizard_populate.py", line 3, in  
> from gluon.contrib.populate import populate 
>   File "/home/g/web2py/gluon/custom_import.py", line 280, in __call__ 
> fromlist, level) 
>   File "/home/g/web2py/gluon/custom_import.py", line 74, in __call__ 
> level) 
> ImportError: No module named populate 
>

-- 





[web2py] Re: how to use Not belongs

2012-08-13 Thread lyn2py
I can't test it here, but did you use 
db.table1.field2

instead of 
field2

?

On Monday, August 13, 2012 4:21:28 PM UTC+8, Pradeesh wrote:
>
> In my control I have an array with so many values. 
> I want to write a dal query to update a table rows which having ID not in 
> this array.
>
> I want something like this.
> db(db.table1.field1.notbelongs(array)).update(field2=False)
>
> I have tried like this
> db(db.table1.field1 not in(array)).update(field2=False) 
> but this is not working fine. It is throwing an error as  raise 
> RuntimeError, "No table selected"
>
> I would greatly appreciate any suggestions. 
>

-- 





Re: [web2py] how to use Not belongs

2012-08-13 Thread Bruno Rocha
use the unary ~ operator

db(~db.table1.field1.belongs(array)).update(field2=False)

Bruno Rocha
www.rochacbruno.com.br
Em 13/08/2012 05:21, "Pradeesh"  escreveu:

> In my control I have an array with so many values.
> I want to write a dal query to update a table rows which having ID not in
> this array.
>
> I want something like this.
> db(db.table1.field1.notbelongs(array)).update(field2=False)
>
> I have tried like this
> db(db.table1.field1 not in(array)).update(field2=False)
> but this is not working fine. It is throwing an error as  raise
> RuntimeError, "No table selected"
>
> I would greatly appreciate any suggestions.
>
> --
>
>
>
>

-- 





Re: [web2py] Connecting with database that has tables in it

2012-08-13 Thread Khalil KHAMLICHI
right, but you will miss the beauty of the DAL.
try creating the tables, it takes only a few minutes.

On Mon, Aug 13, 2012 at 7:15 AM, hasan alnator
wrote:

> Dear ALL ,
>
> So i can use sql server without defining tables , and if i want to use it
>  , after i make the connection string i can use db.executesql("RAW SQL")
>  ?? is that true ??
>
>
> best regards,
>
>
>
>
> On Mon, Aug 13, 2012 at 4:16 AM, pbreit  wrote:
>
>> In order to use DAL query syntax, you have to define the tables.
>>
>> --
>>
>>
>>
>>
>  --
>
>
>
>

-- 





Re: [web2py] Connecting with database that has tables in it

2012-08-13 Thread hasan alnator
you mean to redefine the tables in the dal like they are in the database ?






On Mon, Aug 13, 2012 at 2:43 PM, Khalil KHAMLICHI <
khamlichi.kha...@gmail.com> wrote:

> right, but you will miss the beauty of the DAL.
> try creating the tables, it takes only a few minutes.
>
> On Mon, Aug 13, 2012 at 7:15 AM, hasan alnator  > wrote:
>
>> Dear ALL ,
>>
>> So i can use sql server without defining tables , and if i want to use it
>>  , after i make the connection string i can use db.executesql("RAW SQL")
>>  ?? is that true ??
>>
>>
>> best regards,
>>
>>
>>
>>
>> On Mon, Aug 13, 2012 at 4:16 AM, pbreit  wrote:
>>
>>> In order to use DAL query syntax, you have to define the tables.
>>>
>>> --
>>>
>>>
>>>
>>>
>>  --
>>
>>
>>
>>
>
>  --
>
>
>
>

-- 





Re: [web2py] Re: Appengine CPU cycles

2012-08-13 Thread Khalil KHAMLICHI
I know, & when I wrote that,  I only meant to express my hope that this
subject be included in web2py's roadmap. cloud hosting is the future and
cpu cycles are its  units for payment, web2py is so beautiful to work with,
let's let this beauty fly to the clouds.


On Mon, Aug 13, 2012 at 1:41 AM, Anthony  wrote:

> I have only made very little tests on gae, but I could clearly see that
>> web2py was too heavy to be profitable on gae,
>>  it just consumes too much resources, running models.py on every request
>> looks like a crazy thing to me..
>>
>
> Which is why this discussion has largely been about ways to avoid running
> all models on every request if they're not needed.
>
> --
>
>
>
>

-- 





Re: [web2py] how to use Not belongs

2012-08-13 Thread Cliff Kachinske
Bruno's method is correct.

With Postgres and psycopg2, make sure the array variable is not empty or 
wrap it in a try...except block.

On Monday, August 13, 2012 7:34:55 AM UTC-4, rochacbruno wrote:
>
> use the unary ~ operator
>
> db(~db.table1.field1.belongs(array)).update(field2=False) 
>
> Bruno Rocha
> www.rochacbruno.com.br
> Em 13/08/2012 05:21, "Pradeesh" > 
> escreveu:
>
>> In my control I have an array with so many values. 
>> I want to write a dal query to update a table rows which having ID not in 
>> this array.
>>
>> I want something like this.
>> db(db.table1.field1.notbelongs(array)).update(field2=False)
>>
>> I have tried like this
>> db(db.table1.field1 not in(array)).update(field2=False) 
>> but this is not working fine. It is throwing an error as  raise 
>> RuntimeError, "No table selected"
>>
>> I would greatly appreciate any suggestions. 
>>
>> -- 
>>  
>>  
>>  
>>
>

-- 





[web2py] howto subset a select element

2012-08-13 Thread lucas
hello one and all,

lets say i have a model like:

db.define_table('courses',
Field('user_id', db.auth_user, requires=IS_IN_DB(db, '%s.id' % 
db.auth_user, '%(last_name)s, %(first_name)s (%(id)s)')),


db.define_table('classes',
Field('course_id', db.courses, requires=IS_IN_DB(db, db.courses.id, 
'%(title)s (%(id)s)'), writable=False, readable=False),


or, when a teacher is setting up a class, under the classes table, i only 
want the courses, from the courses table, showing that have his/her 
user_id, which is known from auth.user_id at the time of login.

so how do you present only a subset of values for the select element of a 
form under some kind of boolean test condition?

thanx in advance, lucas

-- 





[web2py] Re: howto subset a select element

2012-08-13 Thread Anthony
The first argument to IS_IN_DB and IS_NOT_IN_DB can be a Set object rather 
than the entire db:

IS_IN_DB(db(db.courses.teacher = auth.user_id), db.courses.id, '%(title)s 
(%(id)s)')

See http://web2py.com/books/default/chapter/29/7#Database-validators.

Anthony

On Monday, August 13, 2012 8:21:44 AM UTC-4, lucas wrote:
>
> hello one and all,
>
> lets say i have a model like:
>
> db.define_table('courses',
> Field('user_id', db.auth_user, requires=IS_IN_DB(db, '%s.id' % 
> db.auth_user, '%(last_name)s, %(first_name)s (%(id)s)')),
> 
>
> db.define_table('classes',
> Field('course_id', db.courses, requires=IS_IN_DB(db, db.courses.id, 
> '%(title)s (%(id)s)'), writable=False, readable=False),
> 
>
> or, when a teacher is setting up a class, under the classes table, i only 
> want the courses, from the courses table, showing that have his/her 
> user_id, which is known from auth.user_id at the time of login, in the 
> select element of a SQLForm or crud form.
>
> so how do you present only a subset of values for the select element of a 
> form under some kind of boolean test condition?
>
> thanx in advance, lucas
>

-- 





[web2py] Re: Trouble adding lxml module to application

2012-08-13 Thread Anthony

>
> Are you sure? I searched on this list and seemed that there had been some 
> problems.


Shouldn't be any problems. 2.5 is the *oldest* version of Python with which 
web2py will work (used to be 2.4), but it works fine with 2.6 and 2.7.

Anthony 

-- 





Re: [web2py] Re: Appengine CPU cycles

2012-08-13 Thread Anthony

>
> I know, & when I wrote that,  I only meant to express my hope that this 
> subject be included in web2py's roadmap.
>

OK, that sounds more reasonable than "I could clearly see that web2py was 
too heavy to be profitable on gae." :-)

So, we already have conditional models as well as the option to put models 
in modules and import them where needed. There's also been some discussion 
of lazy model definitions. Do you have additional suggestions for the 
roadmap?

Anthony

-- 





[web2py] default tab key behavior change in fields

2012-08-13 Thread max
I want to add the enter key instead of tab keys to the forms.
is it possible to intergrate into web2py.

-- 





Re: [web2py] Connecting with database that has tables in it

2012-08-13 Thread Anthony
On Monday, August 13, 2012 7:47:52 AM UTC-4, Hassan Alnatour wrote:
>
> you mean to redefine the tables in the dal like they are in the database ?
>

Yes, in order to use the DAL with a database, the DAL needs to know what's 
in the database, which is the purpose of the table definitions. As 
mentioned, there is a script to introspect the database and automatically 
create the table definitions for you: 
http://code.google.com/p/web2py/source/browse/scripts/extract_pgsql_models.py
.

Anthony 

-- 





[web2py] Re: Trouble adding lxml module to application

2012-08-13 Thread Mike Girard
Thanks for the confirmation. Perhaps the official documentation should be 
updated. 

On Monday, August 13, 2012 9:17:51 AM UTC-4, Anthony wrote:
>
> Are you sure? I searched on this list and seemed that there had been some 
>> problems.
>
>
> Shouldn't be any problems. 2.5 is the *oldest* version of Python with 
> which web2py will work (used to be 2.4), but it works fine with 2.6 and 2.7.
>
> Anthony 
>

-- 





[web2py] Re: default tab key behavior change in fields

2012-08-13 Thread Anthony
On Monday, August 13, 2012 9:24:13 AM UTC-4, max wrote:
>
> I want to add the enter key instead of tab keys to the forms.
> is it possible to intergrate into web2py.
>

Sure, but this has to be handled on the client side via Javascript. Here's 
one solution: http://thinksimply.com/blog/jquery-enter-tab.

Anthony 

-- 





[web2py] Re: Trouble adding lxml module to application

2012-08-13 Thread Anthony
The book says:

web2py runs with CPython (the C implementation) and Jython (the Java 
implementation), on Python versions 2.4, 2.5, 2.6, and 2.7, although 
"officially" it only supports 2.5 so that we can guarantee backward 
compatibility for applications.

I guess that sounds a bit misleading, as 2.6 and 2.7 are also officially 
supported. It's just that the framework is written to target 2.5, so the 
framework code doesn't include any language features that were new in 2.6 
or 2.7 (of course, your app code can include such features if you're 
running 2.6 or 2.7). I think we may need to remove 2.4 from that list as 
well.

Anthony


On Monday, August 13, 2012 9:27:36 AM UTC-4, Mike Girard wrote:
>
> Thanks for the confirmation. Perhaps the official documentation should be 
> updated. 
>
> On Monday, August 13, 2012 9:17:51 AM UTC-4, Anthony wrote:
>>
>> Are you sure? I searched on this list and seemed that there had been some 
>>> problems.
>>
>>
>> Shouldn't be any problems. 2.5 is the *oldest* version of Python with 
>> which web2py will work (used to be 2.4), but it works fine with 2.6 and 2.7.
>>
>> Anthony 
>>
>

-- 





[web2py] Re: default tab key behavior change in fields

2012-08-13 Thread max
thank anthony.

Am Montag, 13. August 2012 15:30:24 UTC+2 schrieb Anthony:
>
> On Monday, August 13, 2012 9:24:13 AM UTC-4, max wrote:
>>
>> I want to add the enter key instead of tab keys to the forms.
>> is it possible to intergrate into web2py.
>>
>
> Sure, but this has to be handled on the client side via Javascript. Here's 
> one solution: http://thinksimply.com/blog/jquery-enter-tab.
>
> Anthony 
>

-- 





[web2py] Re: howto subset a select element

2012-08-13 Thread lucas
oh my, that is so perfect, i love that.  i learned a new word and i am 
going to use it everywhere.  thanx anthony.

p.s. hey, when is web2py v2.0 going to be stable and released full?  
doesn't it have angularjs built into it also?

-- 





[web2py] enter a 'comma' instead of dot for floating point numbers.

2012-08-13 Thread max
One of my users use german keyboard. is there any possibility for the dot 
in a floating point number identified as comma.
for me  global replacing is also o.k.

Example:
1223.12 as 122,23 for all the values in forms.




-- 





Re: [web2py] enter a 'comma' instead of dot for floating point numbers.

2012-08-13 Thread Bruno Rocha
take a look on custom validators
http://rochacbruno.com.br/custom-validator-for-web2py-forms/
 Em 13/08/2012 10:54, "max"  escreveu:

> One of my users use german keyboard. is there any possibility for the dot
> in a floating point number identified as comma.
> for me  global replacing is also o.k.
>
> Example:
> 1223.12 as 122,23 for all the values in forms.
>
>
>
>
>  --
>
>
>
>

-- 





[web2py] Re: howto subset a select element

2012-08-13 Thread Anthony

>
> p.s. hey, when is web2py v2.0 going to be stable and released full?


I think very soon, not sure exactly when.
 

>   doesn't it have angularjs built into it also?
>

No, where did you hear that?

Anthony 

-- 





Re: [web2py] enter a 'comma' instead of dot for floating point numbers.

2012-08-13 Thread max
thank a lot. helps me to do what i want.

Am Montag, 13. August 2012 16:00:17 UTC+2 schrieb rochacbruno:
>
> take a look on custom validators 
> http://rochacbruno.com.br/custom-validator-for-web2py-forms/ 
>  Em 13/08/2012 10:54, "max" > escreveu:
>
>> One of my users use german keyboard. is there any possibility for the dot 
>> in a floating point number identified as comma.
>> for me  global replacing is also o.k.
>>
>> Example:
>> 1223.12 as 122,23 for all the values in forms.
>>
>>
>>
>>
>>  -- 
>>  
>>  
>>  
>>
>

-- 





[web2py] Fw: Need CRM Administrator (Sales force)

2012-08-13 Thread Lokesh (Sriven Infosys,Inc)




 

Hi Folks,

Hope you are doing great.

Please let me know if you have any consultant for the following requirement.

Please forward the resumes lok...@sriveninfosys.net


CRM Administrator (Sales force)

1 Year

Austin, TX

Job Specific 

Job Specific Required education & experience

·   High School diploma or equivalent.  

·   3 years+ experience maintaining and configuring a CRM environment, 
specifically salesforce.com 

·   Salesforce.com Certification, specifically Salesforce Administrator or 
Salesforce Advanced Administrator

Required soft skills

·   Strong grasp of communication in English, both written and verbal

·   Strong team player with service oriented attitude and customer focus

·   Ability to manage stressful situations in a calm, courteous and 
efficient manner

·   Critical thinking

·   Excellent problem-solving methodology

·   Exceptional interpersonal and time management skills

·   Exceptional resourcefulness and the ability to retain information

·   Organize, prioritize and multi-task while managing users' expectations 

Additional preferred requirements

·   Experience balancing multiple salesforce.com implementations or merging 
implementations together

·   Experience in improving existing salesforce.com implementations

·   Experience in architecting a salesforce.com deployment

·   Bachelors degree in technical field

Thanks & Regards
--
Lokesh

IT Recruiter 
Sriveninfosys Inc 
(CELEBRATING 11th ANNIVERSARY 2000-2011)
Voice: 732-835-0098  Fax: 516-977-0618
E-mail : lok...@sriveninfosys.net || G-mail:lokesh.sriveninfo...@gmail.com || 


-- 





[web2py] Re: enter a 'comma' instead of dot for floating point numbers.

2012-08-13 Thread Anthony
Have you tried IS_DECIMAL_IN_RANGE(dot=T(','))? Also works for 
IS_FLOAT_IN_RANGE().

Anthony

On Monday, August 13, 2012 9:54:27 AM UTC-4, max wrote:
>
> One of my users use german keyboard. is there any possibility for the dot 
> in a floating point number identified as comma.
> for me  global replacing is also o.k.
>
> Example:
> 1223.12 as 122,23 for all the values in forms.
>
>
>
>
>

-- 





Re: [web2py] web2py 2.0 almost done

2012-08-13 Thread Massimo Di Pierro
Can you help looking into it?

On Monday, 13 August 2012 05:32:20 UTC-5, Marin Pranjić wrote:
>
> Installing new app in admin via URL is not working for me (trunk)
>
> On Tue, Aug 7, 2012 at 6:33 AM, Massimo Di Pierro 
> 
> > wrote:
>
>> Web2py 2.0 is almost done. 
>> Please try the nightly build.
>> Let us know if it breaks anything.
>>
>> massimo
>>
>> -- 
>>  
>>  
>>  
>>
>
>

-- 





[web2py] Re: Trouble adding lxml module to application

2012-08-13 Thread Massimo Di Pierro
The problem is what we mean by support. If somebody writes and app using 
2.7 syntax, it works but the app will not work on a different web2py 
installation running 2.5. I agree we should clarify web2py runs on 2.6 and 
2.6 but we should also discourage from using methods and syntax not 
supported in 2.5.

On Monday, 13 August 2012 08:36:35 UTC-5, Anthony wrote:
>
> The book says:
>
> web2py runs with CPython (the C implementation) and Jython (the Java 
> implementation), on Python versions 2.4, 2.5, 2.6, and 2.7, although 
> "officially" it only supports 2.5 so that we can guarantee backward 
> compatibility for applications.
>
> I guess that sounds a bit misleading, as 2.6 and 2.7 are also officially 
> supported. It's just that the framework is written to target 2.5, so the 
> framework code doesn't include any language features that were new in 2.6 
> or 2.7 (of course, your app code can include such features if you're 
> running 2.6 or 2.7). I think we may need to remove 2.4 from that list as 
> well.
>
> Anthony
>
>
> On Monday, August 13, 2012 9:27:36 AM UTC-4, Mike Girard wrote:
>>
>> Thanks for the confirmation. Perhaps the official documentation should be 
>> updated. 
>>
>> On Monday, August 13, 2012 9:17:51 AM UTC-4, Anthony wrote:
>>>
>>> Are you sure? I searched on this list and seemed that there had been 
 some problems.
>>>
>>>
>>> Shouldn't be any problems. 2.5 is the *oldest* version of Python with 
>>> which web2py will work (used to be 2.4), but it works fine with 2.6 and 2.7.
>>>
>>> Anthony 
>>>
>>

-- 





[web2py] Re: howto subset a select element

2012-08-13 Thread Massimo Di Pierro
I was hoping last week. Not I am hoping next week. We have closed most of 
the tickets we think were important but there are a couple more to deal 
with. 



On Monday, 13 August 2012 09:00:48 UTC-5, Anthony wrote:
>
> p.s. hey, when is web2py v2.0 going to be stable and released full?
>
>
> I think very soon, not sure exactly when.
>  
>
>>   doesn't it have angularjs built into it also?
>>
>
> No, where did you hear that?
>
> Anthony 
>

-- 





[web2py] Re: Trouble adding lxml module to application

2012-08-13 Thread Mike Girard
The book also provides this command for running web2py from source.

python2.5 web2py.py

it was this that made me think I had to use 2.5 along with presumably 
obsolete posts in this group about issues that came up with new Python 
versions. I suppose if I hadn't been skimming, I would have felt more 
confident that 2.6 was supported. 

Anyway, I'm good to go now. Thanks for the help. 





On Monday, August 13, 2012 9:36:35 AM UTC-4, Anthony wrote:
>
> The book says:
>
> web2py runs with CPython (the C implementation) and Jython (the Java 
> implementation), on Python versions 2.4, 2.5, 2.6, and 2.7, although 
> "officially" it only supports 2.5 so that we can guarantee backward 
> compatibility for applications.
>
> I guess that sounds a bit misleading, as 2.6 and 2.7 are also officially 
> supported. It's just that the framework is written to target 2.5, so the 
> framework code doesn't include any language features that were new in 2.6 
> or 2.7 (of course, your app code can include such features if you're 
> running 2.6 or 2.7). I think we may need to remove 2.4 from that list as 
> well.
>
> Anthony
>
>
> On Monday, August 13, 2012 9:27:36 AM UTC-4, Mike Girard wrote:
>>
>> Thanks for the confirmation. Perhaps the official documentation should be 
>> updated. 
>>
>> On Monday, August 13, 2012 9:17:51 AM UTC-4, Anthony wrote:
>>>
>>> Are you sure? I searched on this list and seemed that there had been 
 some problems.
>>>
>>>
>>> Shouldn't be any problems. 2.5 is the *oldest* version of Python with 
>>> which web2py will work (used to be 2.4), but it works fine with 2.6 and 2.7.
>>>
>>> Anthony 
>>>
>>

-- 





Re: [web2py] web2py 2.0 almost done

2012-08-13 Thread Marin Pranjić
Sure.
There is no upload logic for URLs.


It was removed with this revision:
http://code.google.com/p/web2py/source/diff?spec=svn33970ff5ac8470c8003290671a1352c29ec00e25&r=33970ff5ac8470c8003290671a1352c29ec00e25&format=side&path=/applications/admin/controllers/default.py


Application is retreived with urllib.urlopen but is not installed
(if-elif-else logic is wrong).


Marin

On Mon, Aug 13, 2012 at 4:31 PM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> Can you help looking into it?
>
>
> On Monday, 13 August 2012 05:32:20 UTC-5, Marin Pranjić wrote:
>
>> Installing new app in admin via URL is not working for me (trunk)
>>
>> On Tue, Aug 7, 2012 at 6:33 AM, Massimo Di Pierro 
>> wrote:
>>
>>> Web2py 2.0 is almost done.
>>> Please try the nightly build.
>>> Let us know if it breaks anything.
>>>
>>> massimo
>>>
>>> --
>>>
>>>
>>>
>>>
>>
>>  --
>
>
>
>

-- 





Re: [web2py] web2py 2.0 almost done

2012-08-13 Thread Massimo Di Pierro
ouch! sorry about that.

On Monday, 13 August 2012 09:46:51 UTC-5, Marin Pranjić wrote:
>
> Sure.
> There is no upload logic for URLs.
>
>
> It was removed with this revision:
>
> http://code.google.com/p/web2py/source/diff?spec=svn33970ff5ac8470c8003290671a1352c29ec00e25&r=33970ff5ac8470c8003290671a1352c29ec00e25&format=side&path=/applications/admin/controllers/default.py
>
>
> Application is retreived with urllib.urlopen but is not installed 
> (if-elif-else logic is wrong).
>
>
> Marin
>
> On Mon, Aug 13, 2012 at 4:31 PM, Massimo Di Pierro 
> 
> > wrote:
>
>> Can you help looking into it?
>>
>>
>> On Monday, 13 August 2012 05:32:20 UTC-5, Marin Pranjić wrote:
>>
>>> Installing new app in admin via URL is not working for me (trunk)
>>>
>>> On Tue, Aug 7, 2012 at 6:33 AM, Massimo Di Pierro >> > wrote:
>>>
 Web2py 2.0 is almost done. 
 Please try the nightly build.
 Let us know if it breaks anything.

 massimo

 -- 
  
  
  

>>>
>>>  -- 
>>  
>>  
>>  
>>
>
>

-- 





[web2py] Re: Enforcing - like gmail: first character of your username should be a letter (a-z) or number.

2012-08-13 Thread Rob_McC
Anthony:

Thanks for continued help.

I greated a new simple app, inserted the two line, where I hope they should 
go. (in bold, below is entire source)
This is the only thing chaned in the simple app.

*I Get The Same error:* 'tuple' object 
has no attribute 'insert'
*File: RAM_SIMPLE_INSERT/MODELS/DB.PY *

# -*- coding: utf-8 -*-

#
## This scaffolding model makes your app work on Google App Engine too
## File is released under public domain and you can use without limitations
#

## if SSL/HTTPS is properly configured and you want all HTTP requests to
## be redirected to HTTPS, uncomment the line below:
# request.requires_https()

if not request.env.web2py_runtime_gae:
## if NOT running on Google App Engine use SQLite or other DB
db = DAL('sqlite://storage.sqlite')
else:
## connect to Google BigTable (optional 'google:datastore://namespace')
db = DAL('google:datastore')
## store sessions and tickets there
session.connect(request, response, db = db)
## or store session in Memcache, Redis, etc.
## from gluon.contrib.memdb import MEMDB
## from google.appengine.api.memcache import Client
## session.connect(request, response, db = MEMDB(Client()))

## by default give a view/generic.extension to all actions from localhost
## none otherwise. a pattern can be 'controller/function.extension'
response.generic_patterns = ['*'] if request.is_local else []
## (optional) optimize handling of static files
# response.optimize_css = 'concat,minify,inline'
# response.optimize_js = 'concat,minify,inline'

#
## Here is sample code if you need for
## - email capabilities
## - authentication (registration, login, logout, ... )
## - authorization (role based authorization)
## - services (xml, csv, json, xmlrpc, jsonrpc, amf, rss)
## - old style crud actions
## (more options discussed in gluon/tools.py)
#

from gluon.tools import Auth, Crud, Service, PluginManager, prettydate
auth = Auth(db, hmac_key=Auth.get_or_create_key())
crud, service, plugins = Crud(db), Service(), PluginManager()

## create all tables needed by auth if not custom tables
#auth.define_tables()

*auth.define_tables(username=True)
db.auth_user.username.requires.insert(0,IS_MATCH("[a-z].*"))*

## configure email
mail=auth.settings.mailer
mail.settings.server = 'logging' or 'smtp.gmail.com:587'
mail.settings.sender = 'y...@gmail.com'
mail.settings.login = 'username:password'

## configure auth policy
auth.settings.registration_requires_verification = False
auth.settings.registration_requires_approval = False
auth.settings.reset_password_requires_verification = True

## if you need to use OpenID, Facebook, MySpace, Twitter, Linkedin, etc.
## register with janrain.com, write your domain:api_key in 
private/janrain.key
from gluon.contrib.login_methods.rpx_account import use_janrain
use_janrain(auth,filename='private/janrain.key')

#
## Define your tables below (or better in another model file) for example
##
## >>> db.define_table('mytable',Field('myfield','string'))
##
## Fields can be 'string','text','password','integer','double','boolean'
##   'date','time','datetime','blob','upload', 'reference TABLENAME'
## There is an implicit 'id integer autoincrement' field
## Consult manual for more options, validators, etc.
##
## More API examples for controllers:
##
## >>> db.mytable.insert(myfield='value')
## >>> rows=db(db.mytable.myfield=='value').select(db.mytable.ALL)
## >>> for row in rows: print row.id, row.myfield
#



-- 





[web2py] Re: Trouble adding lxml module to application

2012-08-13 Thread Anthony
Yes, I think that should be clarified as well.

Thanks.

Anthony

On Monday, August 13, 2012 10:38:40 AM UTC-4, Mike Girard wrote:
>
> The book also provides this command for running web2py from source.
>
> python2.5 web2py.py
>
> it was this that made me think I had to use 2.5 along with presumably 
> obsolete posts in this group about issues that came up with new Python 
> versions. I suppose if I hadn't been skimming, I would have felt more 
> confident that 2.6 was supported. 
>
> Anyway, I'm good to go now. Thanks for the help. 
>
>
>
>
>
> On Monday, August 13, 2012 9:36:35 AM UTC-4, Anthony wrote:
>>
>> The book says:
>>
>> web2py runs with CPython (the C implementation) and Jython (the Java 
>> implementation), on Python versions 2.4, 2.5, 2.6, and 2.7, although 
>> "officially" it only supports 2.5 so that we can guarantee backward 
>> compatibility for applications.
>>
>> I guess that sounds a bit misleading, as 2.6 and 2.7 are also officially 
>> supported. It's just that the framework is written to target 2.5, so the 
>> framework code doesn't include any language features that were new in 2.6 
>> or 2.7 (of course, your app code can include such features if you're 
>> running 2.6 or 2.7). I think we may need to remove 2.4 from that list as 
>> well.
>>
>> Anthony
>>
>>
>> On Monday, August 13, 2012 9:27:36 AM UTC-4, Mike Girard wrote:
>>>
>>> Thanks for the confirmation. Perhaps the official documentation should 
>>> be updated. 
>>>
>>> On Monday, August 13, 2012 9:17:51 AM UTC-4, Anthony wrote:

 Are you sure? I searched on this list and seemed that there had been 
> some problems.


 Shouldn't be any problems. 2.5 is the *oldest* version of Python with 
 which web2py will work (used to be 2.4), but it works fine with 2.6 and 
 2.7.

 Anthony 

>>>

-- 





[web2py] Re: LinkedIn Integration - my step by step tutorial

2012-08-13 Thread Carl
Can anyone recommend this code over that in contrib
/login_methods/linkedin_account.py ?

On Wednesday, 4 April 2012 06:49:46 UTC+1, Udi Milo wrote:
>
> It took a while to figure out, but this is my version on how to use 
> linkedIn in web2py,
> comments are much appreciated. (its very detailed and intended for people 
> that are just starting out like me)
>
> Enjoy!
>
> first thing, go to linkedIn.com and get your key and secret.
> after getting it:
>
> *1. add linkedIn.py and model.py to Modules from the python-linkedin lib*
> *2. add the linkedinAccount.py to modules. modify it to look like:*
>
> from gluon.http import HTTP
> try:
> import linkedin
> except ImportError:
> raise HTTP(400,"linkedin module not found")
>
> class LinkedInAccount(object):
> def __init__(self,request,session,key,secret,return_url):
> self.request = request
> self.session = session
>
> if self.session.linkedin is None:
> self.session.verified = False
> self.session.linkedin = 
> linkedin.LinkedIn(key,secret,return_url, gae=True)
> self.session.linkedin.request_token()
>
> def verify(self, verifier):
> self.session.verified = verifier and 
> self.session.linkedin.access_token(verifier = verifier)
> return self.session.verified
>
> def login_url(self, next="/"):
> return self.session.linkedin.get_authorize_url()
>
> def logout_url(self, next="/"):
> self.session.linkedin = None
> return next
>
> def get_user(self):
> if self.session.verified:
> profile = self.session.linkedin.get_profile(fields=['id', 
> 'first-name', 'last-name','picture-url','industry'])
> return dict(first_name = profile.first_name,
> last_name = profile.last_name,
> picture_url = profile.picture_url,
> industry = profile.industry,
> username = profile.id)
>
> *3. add the following to your dal.py*
>
> ## LinkedIn
>
> auth.settings.actions_disabled=['register','change_password','request_reset_password','retrieve_username']
> from linkedinAccount import LinkedInAccount
> auth.settings.login_form=LinkedInAccount(
> request,
> session,
> KEY,
> SECRET,
> 'http://' + request.env.http_host + '/user/verify')
>
> and just above "auth.define_tables()" add this:
>
> ## create custom field 'username' for linkedin authentication
> auth.settings.extra_fields['auth_user']= [
> Field('username', writable=False, readable=False),
> Field('picture_url', writable=False, readable=False),
> Field('industry', writable=False, readable=False),
> ]
>
> *4. add the following to your default.py, the user function (clear is a 
> debug tool, in case your session expires or you play with it and you need 
> to remove it)*
>
> def user():
> if len(request.args)>0 and request.args(0)=='verify':
> auth.settings.login_form.verify(request.vars.oauth_verifier)
> redirect(URL('user', 'login'))
>
> if request.args(0)=='clear':
> session.linkedin = None
> return 'clean'
>
>
>

-- 





[web2py] Re: Trouble adding lxml module to application

2012-08-13 Thread Anthony
On Monday, August 13, 2012 10:34:55 AM UTC-4, Massimo Di Pierro wrote:
>
> The problem is what we mean by support. If somebody writes and app using 
> 2.7 syntax, it works but the app will not work on a different web2py 
> installation running 2.5. I agree we should clarify web2py runs on 2.6 and 
> 2.6 but we should also discourage from using methods and syntax not 
> supported in 2.5.
>

I suppose it makes sense to encourage 2.5 for open source apps/plugins in 
order to maximize the places they will run, but for private apps, some 
users might care more about using newer 2.6/2.7 features than their ability 
to port to a 2.5 platform in the future. We should also clarify the 
difference between the binaries (which only support 2.5 because they come 
with a 2.5 interpreter) and source (which uses the system's interpreter).

Anthony

-- 





[web2py] Re: Enforcing - like gmail: first character of your username should be a letter (a-z) or number.

2012-08-13 Thread Anthony
Hmm, can you try with trunk? I just tried the same thing with trunk and 
don't get any error.

Anthony

On Monday, August 13, 2012 11:00:21 AM UTC-4, Rob_McC wrote:
>
> Anthony:
>
> Thanks for continued help.
>
> I greated a new simple app, inserted the two line, where I hope they 
> should go. (in bold, below is entire source)
> This is the only thing chaned in the simple app.
>
> *I Get The Same error:* 'tuple' object 
> has no attribute 'insert'
> *File: RAM_SIMPLE_INSERT/MODELS/DB.PY *
>
> # -*- coding: utf-8 -*-
>
> #
> ## This scaffolding model makes your app work on Google App Engine too
> ## File is released under public domain and you can use without limitations
> #
>
> ## if SSL/HTTPS is properly configured and you want all HTTP requests to
> ## be redirected to HTTPS, uncomment the line below:
> # request.requires_https()
>
> if not request.env.web2py_runtime_gae:
> ## if NOT running on Google App Engine use SQLite or other DB
> db = DAL('sqlite://storage.sqlite')
> else:
> ## connect to Google BigTable (optional 
> 'google:datastore://namespace')
> db = DAL('google:datastore')
> ## store sessions and tickets there
> session.connect(request, response, db = db)
> ## or store session in Memcache, Redis, etc.
> ## from gluon.contrib.memdb import MEMDB
> ## from google.appengine.api.memcache import Client
> ## session.connect(request, response, db = MEMDB(Client()))
>
> ## by default give a view/generic.extension to all actions from localhost
> ## none otherwise. a pattern can be 'controller/function.extension'
> response.generic_patterns = ['*'] if request.is_local else []
> ## (optional) optimize handling of static files
> # response.optimize_css = 'concat,minify,inline'
> # response.optimize_js = 'concat,minify,inline'
>
> #
> ## Here is sample code if you need for
> ## - email capabilities
> ## - authentication (registration, login, logout, ... )
> ## - authorization (role based authorization)
> ## - services (xml, csv, json, xmlrpc, jsonrpc, amf, rss)
> ## - old style crud actions
> ## (more options discussed in gluon/tools.py)
> #
>
> from gluon.tools import Auth, Crud, Service, PluginManager, prettydate
> auth = Auth(db, hmac_key=Auth.get_or_create_key())
> crud, service, plugins = Crud(db), Service(), PluginManager()
>
> ## create all tables needed by auth if not custom tables
> #auth.define_tables()
>
> *auth.define_tables(username=True)
> db.auth_user.username.requires.insert(0,IS_MATCH("[a-z].*"))*
>
> ## configure email
> mail=auth.settings.mailer
> mail.settings.server = 'logging' or 'smtp.gmail.com:587'
> mail.settings.sender = 'y...@gmail.com '
> mail.settings.login = 'username:password'
>
> ## configure auth policy
> auth.settings.registration_requires_verification = False
> auth.settings.registration_requires_approval = False
> auth.settings.reset_password_requires_verification = True
>
> ## if you need to use OpenID, Facebook, MySpace, Twitter, Linkedin, etc.
> ## register with janrain.com, write your domain:api_key in 
> private/janrain.key
> from gluon.contrib.login_methods.rpx_account import use_janrain
> use_janrain(auth,filename='private/janrain.key')
>
> #
> ## Define your tables below (or better in another model file) for example
> ##
> ## >>> db.define_table('mytable',Field('myfield','string'))
> ##
> ## Fields can be 'string','text','password','integer','double','boolean'
> ##   'date','time','datetime','blob','upload', 'reference TABLENAME'
> ## There is an implicit 'id integer autoincrement' field
> ## Consult manual for more options, validators, etc.
> ##
> ## More API examples for controllers:
> ##
> ## >>> db.mytable.insert(myfield='value')
> ## >>> rows=db(db.mytable.myfield=='value').select(db.mytable.ALL)
> ## >>> for row in rows: print row.id, row.myfield
> #
>
>
>
>

-- 





[web2py] Re: Enforcing - like gmail: first character of your username should be a letter (a-z) or number.

2012-08-13 Thread Anthony
Just looked at the 1.99.7 code, and it is a tuple there -- but it has been 
changed to a list in trunk, so should work in the upcoming 2.0 release.

Anthony

On Monday, August 13, 2012 11:16:07 AM UTC-4, Anthony wrote:
>
> Hmm, can you try with trunk? I just tried the same thing with trunk and 
> don't get any error.
>
> Anthony
>
> On Monday, August 13, 2012 11:00:21 AM UTC-4, Rob_McC wrote:
>>
>> Anthony:
>>
>> Thanks for continued help.
>>
>> I greated a new simple app, inserted the two line, where I hope they 
>> should go. (in bold, below is entire source)
>> This is the only thing chaned in the simple app.
>>
>> *I Get The Same error:* 'tuple' object 
>> has no attribute 'insert'
>> *File: RAM_SIMPLE_INSERT/MODELS/DB.PY *
>>
>> # -*- coding: utf-8 -*-
>>
>> #
>> ## This scaffolding model makes your app work on Google App Engine too
>> ## File is released under public domain and you can use without 
>> limitations
>> #
>>
>> ## if SSL/HTTPS is properly configured and you want all HTTP requests to
>> ## be redirected to HTTPS, uncomment the line below:
>> # request.requires_https()
>>
>> if not request.env.web2py_runtime_gae:
>> ## if NOT running on Google App Engine use SQLite or other DB
>> db = DAL('sqlite://storage.sqlite')
>> else:
>> ## connect to Google BigTable (optional 
>> 'google:datastore://namespace')
>> db = DAL('google:datastore')
>> ## store sessions and tickets there
>> session.connect(request, response, db = db)
>> ## or store session in Memcache, Redis, etc.
>> ## from gluon.contrib.memdb import MEMDB
>> ## from google.appengine.api.memcache import Client
>> ## session.connect(request, response, db = MEMDB(Client()))
>>
>> ## by default give a view/generic.extension to all actions from localhost
>> ## none otherwise. a pattern can be 'controller/function.extension'
>> response.generic_patterns = ['*'] if request.is_local else []
>> ## (optional) optimize handling of static files
>> # response.optimize_css = 'concat,minify,inline'
>> # response.optimize_js = 'concat,minify,inline'
>>
>> #
>> ## Here is sample code if you need for
>> ## - email capabilities
>> ## - authentication (registration, login, logout, ... )
>> ## - authorization (role based authorization)
>> ## - services (xml, csv, json, xmlrpc, jsonrpc, amf, rss)
>> ## - old style crud actions
>> ## (more options discussed in gluon/tools.py)
>> #
>>
>> from gluon.tools import Auth, Crud, Service, PluginManager, prettydate
>> auth = Auth(db, hmac_key=Auth.get_or_create_key())
>> crud, service, plugins = Crud(db), Service(), PluginManager()
>>
>> ## create all tables needed by auth if not custom tables
>> #auth.define_tables()
>>
>> *auth.define_tables(username=True)
>> db.auth_user.username.requires.insert(0,IS_MATCH("[a-z].*"))*
>>
>> ## configure email
>> mail=auth.settings.mailer
>> mail.settings.server = 'logging' or 'smtp.gmail.com:587'
>> mail.settings.sender = 'y...@gmail.com'
>> mail.settings.login = 'username:password'
>>
>> ## configure auth policy
>> auth.settings.registration_requires_verification = False
>> auth.settings.registration_requires_approval = False
>> auth.settings.reset_password_requires_verification = True
>>
>> ## if you need to use OpenID, Facebook, MySpace, Twitter, Linkedin, etc.
>> ## register with janrain.com, write your domain:api_key in 
>> private/janrain.key
>> from gluon.contrib.login_methods.rpx_account import use_janrain
>> use_janrain(auth,filename='private/janrain.key')
>>
>> #
>> ## Define your tables below (or better in another model file) for example
>> ##
>> ## >>> db.define_table('mytable',Field('myfield','string'))
>> ##
>> ## Fields can be 'string','text','password','integer','double','boolean'
>> ##   'date','time','datetime','blob','upload', 'reference TABLENAME'
>> ## There is an implicit 'id integer autoincrement' field
>> ## Consult manual for more options, validators, etc.
>> ##
>> ## More API examples for controllers:
>> ##
>> ## >>> db.mytable.insert(myfield='value')
>> ## >>> rows=db(db.mytable.myfield=='value').select(db.mytable.ALL)
>> ## >>> for row in rows: print row.id, row.myfield
>> #
>>
>>
>>
>>

-- 





[web2py] How to get started with web2py's Debug? - very basic questions

2012-08-13 Thread Rob_McC

I have used debuggers before, and I want to use web2py debug feature.


   1. I create a new simple app,
   2. bring up db.py file
   3. go to line 10, press *[toggle breakpoint]*  button
   4. get this error

Set Breakpoint on 
/Users/robxxx/Documents/r_web2py_1_99/web2py/web2py.app/Contents/Resources/applications/RAM_Simple_Insert/models/db.py
 
at line 10: Line 
/Users/robsss/Documents/signaturr_web2py_1_99/web2py/web2py.app/Contents/Resources/applications/RAM_Simple_Insert/models/db.py:10
 
does not exist

I've searched web2py forums lots of references to debug with other editors 
etc.
- but I just can't get started.

It will be helpful to my learning,  if I can observer variables in the 
Debug window. (WEB2PY ONLINE DEBUGGER

Found this, but it doesn't talk about how to debug in web2py
http://stackoverflow.com/questions/315165/how-to-debug-web2py-applications

Thanks!
Rob



-- 





Re: [web2py] Re: Enforcing - like gmail: first character of your username should be a letter (a-z) or number.

2012-08-13 Thread Jonathan Lundell
In any case, while tuples are immutable, they can be concatenated and replaced. 
 Just don't use insert or append. 

On Aug 13, 2012, at 8:19 AM, Anthony  wrote:

> Just looked at the 1.99.7 code, and it is a tuple there -- but it has been 
> changed to a list in trunk, so should work in the upcoming 2.0 release.
> 
> Anthony
> 
> On Monday, August 13, 2012 11:16:07 AM UTC-4, Anthony wrote:
> Hmm, can you try with trunk? I just tried the same thing with trunk and don't 
> get any error.
> 
> Anthony
> 
> On Monday, August 13, 2012 11:00:21 AM UTC-4, Rob_McC wrote:
> Anthony:
> 
> Thanks for continued help.
> 
> I greated a new simple app, inserted the two line, where I hope they should 
> go. (in bold, below is entire source)
> This is the only thing chaned in the simple app.
> 
> I Get The Same error:
>  'tuple' object has no attribute 'insert'
> 
> File: RAM_SIMPLE_INSERT/MODELS/DB.PY 
> 
> # -*- coding: utf-8 -*-
> 
> #
> ## This scaffolding model makes your app work on Google App Engine too
> ## File is released under public domain and you can use without limitations
> #
> 
> ## if SSL/HTTPS is properly configured and you want all HTTP requests to
> ## be redirected to HTTPS, uncomment the line below:
> # request.requires_https()
> 
> if not request.env.web2py_runtime_gae:
> ## if NOT running on Google App Engine use SQLite or other DB
> db = DAL('sqlite://storage.sqlite')
> else:
> ## connect to Google BigTable (optional 'google:datastore://namespace')
> db = DAL('google:datastore')
> ## store sessions and tickets there
> session.connect(request, response, db = db)
> ## or store session in Memcache, Redis, etc.
> ## from gluon.contrib.memdb import MEMDB
> ## from google.appengine.api.memcache import Client
> ## session.connect(request, response, db = MEMDB(Client()))
> 
> ## by default give a view/generic.extension to all actions from localhost
> ## none otherwise. a pattern can be 'controller/function.extension'
> response.generic_patterns = ['*'] if request.is_local else []
> ## (optional) optimize handling of static files
> # response.optimize_css = 'concat,minify,inline'
> # response.optimize_js = 'concat,minify,inline'
> 
> #
> ## Here is sample code if you need for
> ## - email capabilities
> ## - authentication (registration, login, logout, ... )
> ## - authorization (role based authorization)
> ## - services (xml, csv, json, xmlrpc, jsonrpc, amf, rss)
> ## - old style crud actions
> ## (more options discussed in gluon/tools.py)
> #
> 
> from gluon.tools import Auth, Crud, Service, PluginManager, prettydate
> auth = Auth(db, hmac_key=Auth.get_or_create_key())
> crud, service, plugins = Crud(db), Service(), PluginManager()
> 
> ## create all tables needed by auth if not custom tables
> #auth.define_tables()
> 
> auth.define_tables(username=True)
> db.auth_user.username.requires.insert(0,IS_MATCH("[a-z].*"))
> 
> ## configure email
> mail=auth.settings.mailer
> mail.settings.server = 'logging' or 'smtp.gmail.com:587'
> mail.settings.sender = 'y...@gmail.com'
> mail.settings.login = 'username:password'
> 
> ## configure auth policy
> auth.settings.registration_requires_verification = False
> auth.settings.registration_requires_approval = False
> auth.settings.reset_password_requires_verification = True
> 
> ## if you need to use OpenID, Facebook, MySpace, Twitter, Linkedin, etc.
> ## register with janrain.com, write your domain:api_key in private/janrain.key
> from gluon.contrib.login_methods.rpx_account import use_janrain
> use_janrain(auth,filename='private/janrain.key')
> 
> #
> ## Define your tables below (or better in another model file) for example
> ##
> ## >>> db.define_table('mytable',Field('myfield','string'))
> ##
> ## Fields can be 'string','text','password','integer','double','boolean'
> ##   'date','time','datetime','blob','upload', 'reference TABLENAME'
> ## There is an implicit 'id integer autoincrement' field
> ## Consult manual for more options, validators, etc.
> ##
> ## More API examples for controllers:
> ##
> ## >>> db.mytable.insert(myfield='value')
> ## >>> rows=db(db.mytable.myfield=='value').select(db.mytable.ALL)
> ## >>> for row in rows: print row.id, row.myfield
> #
> 
> 
> 
> -- 
>  
>  
>  

-- 





Re: [web2py] Re: GAE Cloud SQL local dev server problem

2012-08-13 Thread Alexei Vinidiktov
It gives me the error:

self.folder = thread.folder.split('/applications/',1)[1]

IndexError: list index out of range

Full traceback:

ERROR2012-08-13 15:36:00,799 dal.py:6586] DEBUG: connect attempt 0,
connection error:
Traceback (most recent call last):
  File "C:\Users\alexei\Dev\web2py\web2py.googlecode.com\gluon\dal.py",
line 6573, in __init__
self._adapter = ADAPTERS[self._dbname](*args)
  File "C:\Users\alexei\Dev\web2py\web2py.googlecode.com\gluon\dal.py",
line 3845, in __init__
self.folder = thread.folder.split('/applications/',1)[1]
IndexError: list index out of range


On Mon, Aug 13, 2012 at 11:06 AM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> Can you try replace
>
> self.folder = folder or '$HOME/'+thread.folder.split('**
> /applications/',1)[1]
>
> with
>
> self.folder = thread.folder.split('**/applications/',1)[1]
>
>
>
>
>
> On Wednesday, 8 August 2012 18:11:04 UTC-5, Alexei Vinidiktov wrote:
>
>> Ok. I've managed to connect to MySQL from GAE local dev server on Windows
>> if I change line 3845 in dal.py to this:
>>
>> self.folder = ""
>>
>> instead of (self.folder = folder or '$HOME/'+thread.folder.split('**
>> /applications/',1)[1])
>>
>> I don't know if it breaks anything though.
>>
>> On Thu, Aug 9, 2012 at 6:03 AM, Alexei Vinidiktov 
>> wrote:
>>
>>> The problem is still not resolved in trunk.
>>>
>>>
>>> On Mon, Aug 6, 2012 at 12:56 PM, Alexei Vinidiktov <
>>> alexei.v...@gmail.com> wrote:
>>>
 Here it is: db = DAL('google:sql://**vocabilisproject:vocabilis/**
 vocabilis')

 I pass the password and the user name via App Launcher parameters as
 suggested in the GAE SDK docs: --mysql_user=root --mysql_password=xx
 --mysql_host=localhost --mysql_port=3306


 On Mon, Aug 6, 2012 at 7:59 AM, Massimo Di Pierro <
 massimo@gmail.com> wrote:

>  Can you show your complete connection string (masking any password of
> course)?
>
>
> On Saturday, 4 August 2012 02:11:30 UTC-5, Alexei Vinidiktov wrote:
>
>>
>>
>> On Sat, Aug 4, 2012 at 1:56 PM, Alexei Vinidiktov <
>> alexei.v...@gmail.com> wrote:
>>
>>> Hello,
>>>
>>> I'm need hep figuring out how to set up a local GAE development
>>> server with MySQL.
>>>
>>> MySQL connection parameters are specified via App Launcher
>>> application settings: --mysql_user=root --mysql_password=xx
>>> --mysql_host=localhost --mysql_port=3306
>>>
>>> When I launch my web2py app with GAE Launcher on my local Windows
>>> box I get this erorr message:
>>>
>>> 
>>> ERROR2012-08-04 06:28:43,515 dal.py:5962] DEBUG: connect attempt
>>> 0, connection error:
>>> Traceback (most recent call last):
>>>   File 
>>> "C:\Users\alexei\Dev\web2py\vocabilis.net\gluon\dal.py",
>>> line 5955, in __init__
>>> self._adapter = ADAPTERS[self._dbname](*args)
>>>   File 
>>> "C:\Users\alexei\Dev\web2py\vocabilis.net\gluon\dal.py",
>>> line 3310, in __init__
>>> self.folder = folder or '$HOME/'+thread.folder.split('
>>> /applications/',1)[1]
>>> IndexError: list index out of range
>>> #
>>>
>>> What does the following line do?
>>>
>>> self.folder = folder or '$HOME/'+thread.folder.split('
>>> /applications/',1)[1]
>>>
>>> If I comment out "or 
>>> '$HOME/'+thread.folder.split('/applications/',1)[1]"
>>> in DAL.py and relaunch the dev server, the application appears to be 
>>> able
>>> to connect to MySQL but then I get a different error message:
>>>
>>> 
>>> INFO 2012-08-04 06:42:35,142 rdbms_mysqldb.py:102] Connecting to
>>> MySQL with kwargs {'passwd': 'xx', 'unix_socket': '', 'host':
>>> 'localhost', 'port': 3306, 'user': 'root'}
>>> ERROR2012-08-04 06:42:35,153 warnings.py:29]
>>> C:\Users\alexei\Dev\web2py\vocabilis.net 
>>> \gluon\dal.py:1386:
>>> Warning: Can't create database 'vocabilis'; database exists
>>>   ret = self.cursor.execute(*a, **b)
>>>
>>> ERROR2012-08-04 06:42:35,575 restricted.py:155] Traceback (most
>>> recent call last):
>>>   File 
>>> "C:\Users\alexei\Dev\web2py\vocabilis.net\gluon\main.py",
>>> line 510, in wsgibase
>>> session._try_store_in_db(**reque**st, response)
>>>   File 
>>> "C:\Users\alexei\Dev\web2py\vocabilis.net\gluon\globals.py",
>>> line 561, in _try_store_in_db
>>> record_id = table.insert(**dd)
>>>   File 
>>> "C:\Users\alexei\Dev\web2py\vocabilis.net\gluon\dal.py",
>>> line 6829, in insert
>>> return self._db._adapter.insert(self,self._listify(fields))
>>>   File 
>>> "C:\Users\alexei\Dev\web2py\vocabilis.net

Re: [web2py] Re: GAE Cloud SQL local dev server problem

2012-08-13 Thread Massimo Di Pierro
any way you can log what is in thread.folder?

On Monday, 13 August 2012 10:38:48 UTC-5, Alexei Vinidiktov wrote:
>
> It gives me the error:
>
> self.folder = thread.folder.split('/applications/',1)[1] 
>
> IndexError: list index out of range
>
> Full traceback:
>
> ERROR2012-08-13 15:36:00,799 dal.py:6586] DEBUG: connect attempt 0, 
> connection error:
> Traceback (most recent call last):
>   File "C:\Users\alexei\Dev\web2py\web2py.googlecode.com\gluon\dal.py", 
> line 6573, in __init__
> self._adapter = ADAPTERS[self._dbname](*args)
>   File "C:\Users\alexei\Dev\web2py\web2py.googlecode.com\gluon\dal.py", 
> line 3845, in __init__
> self.folder = thread.folder.split('/applications/',1)[1] 
> IndexError: list index out of range
>
>
> On Mon, Aug 13, 2012 at 11:06 AM, Massimo Di Pierro 
> 
> > wrote:
>
>> Can you try replace
>>
>> self.folder = folder or '$HOME/'+thread.folder.split('**
>> /applications/',1)[1]
>>
>> with
>>
>> self.folder = thread.folder.split('**/applications/',1)[1]
>>
>>
>>
>>
>>
>> On Wednesday, 8 August 2012 18:11:04 UTC-5, Alexei Vinidiktov wrote:
>>
>>> Ok. I've managed to connect to MySQL from GAE local dev server on 
>>> Windows if I change line 3845 in dal.py to this:
>>>
>>> self.folder = ""
>>>
>>> instead of (self.folder = folder or '$HOME/'+thread.folder.split('**
>>> /applications/',1)[1])
>>>
>>> I don't know if it breaks anything though.
>>>
>>> On Thu, Aug 9, 2012 at 6:03 AM, Alexei Vinidiktov >> > wrote:
>>>
 The problem is still not resolved in trunk.


 On Mon, Aug 6, 2012 at 12:56 PM, Alexei Vinidiktov <
 alexei.v...@gmail.com> wrote:

> Here it is: db = DAL('google:sql://**vocabilisproject:vocabilis/**
> vocabilis')
>
> I pass the password and the user name via App Launcher parameters as 
> suggested in the GAE SDK docs: --mysql_user=root --mysql_password=xx 
> --mysql_host=localhost --mysql_port=3306 
>  
>
> On Mon, Aug 6, 2012 at 7:59 AM, Massimo Di Pierro <
> massimo@gmail.com> wrote:
>
>>  Can you show your complete connection string (masking any password 
>> of course)?
>>
>>
>> On Saturday, 4 August 2012 02:11:30 UTC-5, Alexei Vinidiktov wrote:
>>
>>>
>>>
>>> On Sat, Aug 4, 2012 at 1:56 PM, Alexei Vinidiktov <
>>> alexei.v...@gmail.com> wrote:
>>>
 Hello,

 I'm need hep figuring out how to set up a local GAE development 
 server with MySQL.

 MySQL connection parameters are specified via App Launcher 
 application settings: --mysql_user=root --mysql_password=xx 
 --mysql_host=localhost --mysql_port=3306 

 When I launch my web2py app with GAE Launcher on my local Windows 
 box I get this erorr message:

 
 ERROR2012-08-04 06:28:43,515 dal.py:5962] DEBUG: connect 
 attempt 0, connection error:
 Traceback (most recent call last):
   File 
 "C:\Users\alexei\Dev\web2py\vocabilis.net\gluon\dal.py",
  
 line 5955, in __init__
 self._adapter = ADAPTERS[self._dbname](*args)
   File 
 "C:\Users\alexei\Dev\web2py\vocabilis.net\gluon\dal.py",
  
 line 3310, in __init__
 self.folder = folder or '$HOME/'+thread.folder.split('
 /applications/',1)[1]
 IndexError: list index out of range
 #

 What does the following line do? 

 self.folder = folder or '$HOME/'+thread.folder.split('
 /applications/',1)[1]

 If I comment out "or 
 '$HOME/'+thread.folder.split('/applications/',1)[1]" 
 in DAL.py and relaunch the dev server, the application appears to be 
 able 
 to connect to MySQL but then I get a different error message:

 
 INFO 2012-08-04 06:42:35,142 rdbms_mysqldb.py:102] Connecting 
 to MySQL with kwargs {'passwd': 'xx', 'unix_socket': '', 'host': 
 'localhost', 'port': 3306, 'user': 'root'}
 ERROR2012-08-04 06:42:35,153 warnings.py:29] 
 C:\Users\alexei\Dev\web2py\vocabilis.net 
 \gluon\dal.py:1386: 
 Warning: Can't create database 'vocabilis'; database exists
   ret = self.cursor.execute(*a, **b)

 ERROR2012-08-04 06:42:35,575 restricted.py:155] Traceback (most 
 recent call last):
   File 
 "C:\Users\alexei\Dev\web2py\vocabilis.net\gluon\main.py",
  
 line 510, in wsgibase
 session._try_store_in_db(**reque**st, response)
   File 
 "C:\Users\alexei\Dev\web2py\vocabilis.net\gluon\globals.py",
  
 line 561, in _try_store_in_db
 record_id 

Re: [web2py] Re: GAE Cloud SQL local dev server problem

2012-08-13 Thread Alexei Vinidiktov
The contents of thread.folder: C:\Users\alexei\Dev\web2py\
web2py.googlecode.com\applications\vocabilis\databases

On Mon, Aug 13, 2012 at 11:11 PM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> any way you can log what is in thread.folder?
>
>
> On Monday, 13 August 2012 10:38:48 UTC-5, Alexei Vinidiktov wrote:
>
>> It gives me the error:
>>
>> self.folder = thread.folder.split('/**applications/',1)[1]
>>
>> IndexError: list index out of range
>>
>> Full traceback:
>>
>> ERROR2012-08-13 15:36:00,799 dal.py:6586] DEBUG: connect attempt 0,
>> connection error:
>> Traceback (most recent call last):
>>   File 
>> "C:\Users\alexei\Dev\web2py\we**b2py.googlecode.com
>> \gluon\dal.**py", line 6573, in __init__
>> self._adapter = ADAPTERS[self._dbname](*args)
>>   File 
>> "C:\Users\alexei\Dev\web2py\we**b2py.googlecode.com
>> \gluon\dal.**py", line 3845, in __init__
>>  self.folder = thread.folder.split('/**applications/',1)[1]
>> IndexError: list index out of range
>>
>>
>> On Mon, Aug 13, 2012 at 11:06 AM, Massimo Di Pierro <
>> massimo@gmail.com> wrote:
>>
>>> Can you try replace
>>>
>>> self.folder = folder or '$HOME/'+thread.folder.split('
>>> /applications/',1)[1]
>>>
>>> with
>>>
>>> self.folder = thread.folder.split('**/**applications/',1)[1]
>>>
>>>
>>>
>>>
>>>
>>> On Wednesday, 8 August 2012 18:11:04 UTC-5, Alexei Vinidiktov wrote:
>>>
 Ok. I've managed to connect to MySQL from GAE local dev server on
 Windows if I change line 3845 in dal.py to this:

 self.folder = ""

 instead of (self.folder = folder or '$HOME/'+thread.folder.split('
 /applications/',1)[1])

 I don't know if it breaks anything though.

 On Thu, Aug 9, 2012 at 6:03 AM, Alexei Vinidiktov <
 alexei.v...@gmail.com> wrote:

> The problem is still not resolved in trunk.
>
>
> On Mon, Aug 6, 2012 at 12:56 PM, Alexei Vinidiktov <
> alexei.v...@gmail.com> wrote:
>
>> Here it is: db = DAL('google:sql://**vocabilispro**ject:vocabilis/**
>> vocabilis')
>>
>> I pass the password and the user name via App Launcher parameters as
>> suggested in the GAE SDK docs: --mysql_user=root --mysql_password=xx
>> --mysql_host=localhost --mysql_port=3306
>>
>>
>> On Mon, Aug 6, 2012 at 7:59 AM, Massimo Di Pierro <
>> massimo@gmail.com> wrote:
>>
>>>  Can you show your complete connection string (masking any password
>>> of course)?
>>>
>>>
>>> On Saturday, 4 August 2012 02:11:30 UTC-5, Alexei Vinidiktov wrote:
>>>


 On Sat, Aug 4, 2012 at 1:56 PM, Alexei Vinidiktov <
 alexei.v...@gmail.com> wrote:

> Hello,
>
> I'm need hep figuring out how to set up a local GAE development
> server with MySQL.
>
> MySQL connection parameters are specified via App Launcher
> application settings: --mysql_user=root --mysql_password=xx
> --mysql_host=localhost --mysql_port=3306
>
> When I launch my web2py app with GAE Launcher on my local Windows
> box I get this erorr message:
>
> 
> ERROR2012-08-04 06:28:43,515 dal.py:5962] DEBUG: connect
> attempt 0, connection error:
> Traceback (most recent call last):
>   File 
> "C:\Users\alexei\Dev\web2py\vo**cabilis.net\gluon\dal.py",
> line 5955, in __init__
>  self._adapter = ADAPTERS[self._dbname](*args)
>   File 
> "C:\Users\alexei\Dev\web2py\vo**cabilis.net\gluon\dal.py",
> line 3310, in __init__
> self.folder = folder or '$HOME/'+thread.folder.split('**
> /applications/',1)[1]
> IndexError: list index out of range
> #
>
> What does the following line do?
>
> self.folder = folder or '$HOME/'+thread.folder.split('**
> /applications/',1)[1]
>
> If I comment out "or 
> '$HOME/'+thread.folder.split('**/applications/',1)[1]"
> in DAL.py and relaunch the dev server, the application appears to be 
> able
> to connect to MySQL but then I get a different error message:
>
> 
> INFO 2012-08-04 06:42:35,142 rdbms_mysqldb.py:102] Connecting
> to MySQL with kwargs {'passwd': 'xx', 'unix_socket': '', 'host':
> 'localhost', 'port': 3306, 'user': 'root'}
> ERROR2012-08-04 06:42:35,153 warnings.py:29]
> C:\Users\alexei\Dev\web2py\voc**abilis.net\gluon\dal.py:1386:
> Warning: Can't create database 'vocabilis'; database exists
>   ret = self.cursor.execute(*a, **b)
>
> ERROR2012-08-04 06:42:35,575 restricted.py:155] Traceback
>

[web2py] Re: How to get started with web2py's Debug? - very basic questions

2012-08-13 Thread Anthony
Does the problem exist in trunk? If so, maybe submit an issue -- looks like 
a bug.

Anthon

On Monday, August 13, 2012 11:31:31 AM UTC-4, Rob_McC wrote:
>
>
> I have used debuggers before, and I want to use web2py debug feature.
>
>
>1. I create a new simple app,
>2. bring up db.py file
>3. go to line 10, press *[toggle breakpoint]*  button
>4. get this error
>
> Set Breakpoint on 
> /Users/robxxx/Documents/r_web2py_1_99/web2py/web2py.app/Contents/Resources/applications/RAM_Simple_Insert/models/db.py
>  
> at line 10: Line 
> /Users/robsss/Documents/signaturr_web2py_1_99/web2py/web2py.app/Contents/Resources/applications/RAM_Simple_Insert/models/db.py:10
>  
> does not exist
>
> I've searched web2py forums lots of references to debug with other editors 
> etc.
> - but I just can't get started.
>
> It will be helpful to my learning,  if I can observer variables in the 
> Debug window. (WEB2PY ONLINE DEBUGGER
>
> Found this, but it doesn't talk about how to debug in web2py
> http://stackoverflow.com/questions/315165/how-to-debug-web2py-applications
>
> Thanks!
> Rob
>
>
>
>

-- 





Re: [web2py] Re: GAE Cloud SQL local dev server problem

2012-08-13 Thread Jonathan Lundell
Change '/applications/' to os.sep + 'applications' + os.sep

On Aug 13, 2012, at 10:40 AM, Alexei Vinidiktov  
wrote:

> The contents of thread.folder: 
> C:\Users\alexei\Dev\web2py\web2py.googlecode.com\applications\vocabilis\databases
>  
> 
> On Mon, Aug 13, 2012 at 11:11 PM, Massimo Di Pierro 
>  wrote:
> any way you can log what is in thread.folder?
> 
> 
> On Monday, 13 August 2012 10:38:48 UTC-5, Alexei Vinidiktov wrote:
> It gives me the error:
> 
> self.folder = thread.folder.split('/applications/',1)[1] 
> 
> IndexError: list index out of range
> 
> Full traceback:
> 
> ERROR2012-08-13 15:36:00,799 dal.py:6586] DEBUG: connect attempt 0, 
> connection error:
> Traceback (most recent call last):
>   File "C:\Users\alexei\Dev\web2py\web2py.googlecode.com\gluon\dal.py", line 
> 6573, in __init__
> self._adapter = ADAPTERS[self._dbname](*args)
>   File "C:\Users\alexei\Dev\web2py\web2py.googlecode.com\gluon\dal.py", line 
> 3845, in __init__
> self.folder = thread.folder.split('/applications/',1)[1] 
> IndexError: list index out of range
> 
> 
> On Mon, Aug 13, 2012 at 11:06 AM, Massimo Di Pierro  
> wrote:
> Can you try replace
> 
> self.folder = folder or '$HOME/'+thread.folder.split('/applications/',1)[1]
> 
> with
> 
> self.folder = thread.folder.split('/applications/',1)[1]
> 
> 
> 
> 
> 
> On Wednesday, 8 August 2012 18:11:04 UTC-5, Alexei Vinidiktov wrote:
> Ok. I've managed to connect to MySQL from GAE local dev server on Windows if 
> I change line 3845 in dal.py to this:
> 
> self.folder = ""
> 
> instead of (self.folder = folder or 
> '$HOME/'+thread.folder.split('/applications/',1)[1])
> 
> I don't know if it breaks anything though.
> 
> On Thu, Aug 9, 2012 at 6:03 AM, Alexei Vinidiktov  
> wrote:
> The problem is still not resolved in trunk.
> 
> 
> On Mon, Aug 6, 2012 at 12:56 PM, Alexei Vinidiktov  
> wrote:
> Here it is: db = DAL('google:sql://vocabilisproject:vocabilis/vocabilis')
> 
> I pass the password and the user name via App Launcher parameters as 
> suggested in the GAE SDK docs: --mysql_user=root --mysql_password=xx 
> --mysql_host=localhost --mysql_port=3306 
> 
> 
> On Mon, Aug 6, 2012 at 7:59 AM, Massimo Di Pierro  
> wrote:
> Can you show your complete connection string (masking any password of course)?
> 
> 
> On Saturday, 4 August 2012 02:11:30 UTC-5, Alexei Vinidiktov wrote:
> 
> 
> On Sat, Aug 4, 2012 at 1:56 PM, Alexei Vinidiktov  
> wrote:
> Hello,
> 
> I'm need hep figuring out how to set up a local GAE development server with 
> MySQL.
> 
> MySQL connection parameters are specified via App Launcher application 
> settings: --mysql_user=root --mysql_password=xx --mysql_host=localhost 
> --mysql_port=3306
> 
> When I launch my web2py app with GAE Launcher on my local Windows box I get 
> this erorr message:
> 
> 
> ERROR2012-08-04 06:28:43,515 dal.py:5962] DEBUG: connect attempt 0, 
> connection error:
> Traceback (most recent call last):
>   File "C:\Users\alexei\Dev\web2py\vocabilis.net\gluon\dal.py", line 5955, in 
> __init__
> self._adapter = ADAPTERS[self._dbname](*args)
>   File "C:\Users\alexei\Dev\web2py\vocabilis.net\gluon\dal.py", line 3310, in 
> __init__
> self.folder = folder or 
> '$HOME/'+thread.folder.split('/applications/',1)[1]
> IndexError: list index out of range
> #
> 
> What does the following line do? 
> 
> self.folder = folder or '$HOME/'+thread.folder.split('/applications/',1)[1]
> 
> If I comment out "or '$HOME/'+thread.folder.split('/applications/',1)[1]" in 
> DAL.py and relaunch the dev server, the application appears to be able to 
> connect to MySQL but then I get a different error message:
> 
> 
> INFO 2012-08-04 06:42:35,142 rdbms_mysqldb.py:102] Connecting to MySQL 
> with kwargs {'passwd': 'xx', 'unix_socket': '', 'host': 'localhost', 
> 'port': 3306, 'user': 'root'}
> ERROR2012-08-04 06:42:35,153 warnings.py:29] 
> C:\Users\alexei\Dev\web2py\vocabilis.net\gluon\dal.py:1386: Warning: Can't 
> create database 'vocabilis'; database exists
>   ret = self.cursor.execute(*a, **b)
> 
> ERROR2012-08-04 06:42:35,575 restricted.py:155] Traceback (most recent 
> call last):
>   File "C:\Users\alexei\Dev\web2py\vocabilis.net\gluon\main.py", line 510, in 
> wsgibase
> session._try_store_in_db(request, response)
>   File "C:\Users\alexei\Dev\web2py\vocabilis.net\gluon\globals.py", line 561, 
> in _try_store_in_db
> record_id = table.insert(**dd)
>   File "C:\Users\alexei\Dev\web2py\vocabilis.net\gluon\dal.py", line 6829, in 
> insert
> return self._db._adapter.insert(self,self._listify(fields))
>   File "C:\Users\alexei\Dev\web2py\vocabilis.net\gluon\dal.py", line 928, in 
> insert
> raise e
> ProgrammingError: (1146, "Table 'vocabilis.web2py_session_vocabilis' doesn't 
> exist")
> #
> 
> The vocabilis database does exist. It was created earlier when I connected to 
> MySQL from a non GAE environment.
> 
> If I specify a different non-existent

[web2py] Re: How to get started with web2py's Debug? - very basic questions

2012-08-13 Thread Massimo Di Pierro
Do you have this file:
/Users/robsss/Documents/signaturr_web2py_1_99/web2py/
web2py.app/Contents/Resources/applications/RAM_Simple_Insert/models/db.py




On Monday, 13 August 2012 10:31:31 UTC-5, Rob_McC wrote:
>
>
> I have used debuggers before, and I want to use web2py debug feature.
>
>
>1. I create a new simple app,
>2. bring up db.py file
>3. go to line 10, press *[toggle breakpoint]*  button
>4. get this error
>
> Set Breakpoint on 
> /Users/robxxx/Documents/r_web2py_1_99/web2py/web2py.app/Contents/Resources/applications/RAM_Simple_Insert/models/db.py
>  
> at line 10: Line 
> /Users/robsss/Documents/signaturr_web2py_1_99/web2py/web2py.app/Contents/Resources/applications/RAM_Simple_Insert/models/db.py:10
>  
> does not exist
>
> I've searched web2py forums lots of references to debug with other editors 
> etc.
> - but I just can't get started.
>
> It will be helpful to my learning,  if I can observer variables in the 
> Debug window. (WEB2PY ONLINE DEBUGGER
>
> Found this, but it doesn't talk about how to debug in web2py
> http://stackoverflow.com/questions/315165/how-to-debug-web2py-applications
>
> Thanks!
> Rob
>
>
>
>

-- 





Re: [web2py] Re: GAE Cloud SQL local dev server problem

2012-08-13 Thread Massimo Di Pierro
Ok. this is in trunk. Still need testing, there may be other issues. The 
$HOME in that line assumes this is running on GAE (or linux) and not on 
Windows.

On Monday, 13 August 2012 13:10:03 UTC-5, Jonathan Lundell wrote:
>
> Change '/applications/' to os.sep + 'applications' + os.sep
>
> On Aug 13, 2012, at 10:40 AM, Alexei Vinidiktov 
> > 
> wrote:
>
> The contents of thread.folder: C:\Users\alexei\Dev\web2py\
> web2py.googlecode.com\applications\vocabilis\databases 
>
> On Mon, Aug 13, 2012 at 11:11 PM, Massimo Di Pierro 
> 
> > wrote:
>
>> any way you can log what is in thread.folder?
>>
>>
>> On Monday, 13 August 2012 10:38:48 UTC-5, Alexei Vinidiktov wrote:
>>
>>> It gives me the error:
>>>
>>> self.folder = thread.folder.split('/**applications/',1)[1] 
>>>
>>> IndexError: list index out of range
>>>
>>> Full traceback:
>>>
>>> ERROR2012-08-13 15:36:00,799 dal.py:6586] DEBUG: connect attempt 0, 
>>> connection error:
>>> Traceback (most recent call last):
>>>   File 
>>> "C:\Users\alexei\Dev\web2py\we**b2py.googlecode.com
>>> \gluon\dal.**py", line 6573, in __init__
>>> self._adapter = ADAPTERS[self._dbname](*args)
>>>   File 
>>> "C:\Users\alexei\Dev\web2py\we**b2py.googlecode.com
>>> \gluon\dal.**py", line 3845, in __init__
>>>  self.folder = thread.folder.split('/**applications/',1)[1] 
>>> IndexError: list index out of range
>>>
>>>
>>> On Mon, Aug 13, 2012 at 11:06 AM, Massimo Di Pierro <
>>> massimo@gmail.com> wrote:
>>>
 Can you try replace

 self.folder = folder or '$HOME/'+thread.folder.split('
 /applications/',1)[1]

 with

 self.folder = thread.folder.split('**/**applications/',1)[1]





 On Wednesday, 8 August 2012 18:11:04 UTC-5, Alexei Vinidiktov wrote:

> Ok. I've managed to connect to MySQL from GAE local dev server on 
> Windows if I change line 3845 in dal.py to this:
>
> self.folder = ""
>
> instead of (self.folder = folder or '$HOME/'+thread.folder.split('
> /applications/',1)[1])
>
> I don't know if it breaks anything though.
>
> On Thu, Aug 9, 2012 at 6:03 AM, Alexei Vinidiktov <
> alexei.v...@gmail.com> wrote:
>
>> The problem is still not resolved in trunk.
>>
>>
>> On Mon, Aug 6, 2012 at 12:56 PM, Alexei Vinidiktov <
>> alexei.v...@gmail.com> wrote:
>>
>>> Here it is: db = DAL('google:sql://**vocabilispro**ject:vocabilis/**
>>> vocabilis')
>>>
>>> I pass the password and the user name via App Launcher parameters as 
>>> suggested in the GAE SDK docs: --mysql_user=root 
>>> --mysql_password=xx 
>>> --mysql_host=localhost --mysql_port=3306 
>>>  
>>>
>>> On Mon, Aug 6, 2012 at 7:59 AM, Massimo Di Pierro <
>>> massimo@gmail.com> wrote:
>>>
  Can you show your complete connection string (masking any password 
 of course)?


 On Saturday, 4 August 2012 02:11:30 UTC-5, Alexei Vinidiktov wrote:

>
>
> On Sat, Aug 4, 2012 at 1:56 PM, Alexei Vinidiktov <
> alexei.v...@gmail.com> wrote:
>
>> Hello,
>>
>> I'm need hep figuring out how to set up a local GAE development 
>> server with MySQL.
>>
>> MySQL connection parameters are specified via App Launcher 
>> application settings: --mysql_user=root --mysql_password=xx 
>> --mysql_host=localhost --mysql_port=3306 
>>
>> When I launch my web2py app with GAE Launcher on my local Windows 
>> box I get this erorr message:
>>
>> 
>> ERROR2012-08-04 06:28:43,515 dal.py:5962] DEBUG: connect 
>> attempt 0, connection error:
>> Traceback (most recent call last):
>>   File 
>> "C:\Users\alexei\Dev\web2py\vo**cabilis.net\gluon\dal.py",
>>  
>> line 5955, in __init__
>>  self._adapter = ADAPTERS[self._dbname](*args)
>>   File 
>> "C:\Users\alexei\Dev\web2py\vo**cabilis.net\gluon\dal.py",
>>  
>> line 3310, in __init__
>> self.folder = folder or '$HOME/'+thread.folder.split('**
>> /applications/',1)[1]
>> IndexError: list index out of range
>> #
>>
>> What does the following line do? 
>>
>> self.folder = folder or '$HOME/'+thread.folder.split('**
>> /applications/',1)[1]
>>
>> If I comment out "or 
>> '$HOME/'+thread.folder.split('**/applications/',1)[1]" 
>> in DAL.py and relaunch the dev server, the application appears to be 
>> able 
>> to connect to MySQL but then I get a different error message:
>>
>> 
>> INFO 2012-08-04 06:42:35,142 rd

[web2py] Re: autoincremente field with a specific first value

2012-08-13 Thread Cliff Kachinske
In MySQL there is 

ALTER TABLE mytable AUTO_INCREMENT = 500

Is that what you want to do?

On Friday, August 10, 2012 11:46:54 AM UTC-4, tigmmi wrote:
>
> Is there a way to add an autoincremente field with a specific first value. 
> Compute won't work with id + number.

-- 





[web2py] Re: How to get started with web2py's Debug? - very basic questions

2012-08-13 Thread Anthony
It sounds like he actually opened that file in the admin editor and hit the 
toggle breakpoint button, which yielded the error.

On Monday, August 13, 2012 2:27:42 PM UTC-4, Massimo Di Pierro wrote:
>
> Do you have this file:
> /Users/robsss/Documents/signaturr_web2py_1_99/web2py/
> web2py.app/Contents/Resources/applications/RAM_Simple_Insert/models/db.py
>
>
>
>
> On Monday, 13 August 2012 10:31:31 UTC-5, Rob_McC wrote:
>>
>>
>> I have used debuggers before, and I want to use web2py debug feature.
>>
>>
>>1. I create a new simple app,
>>2. bring up db.py file
>>3. go to line 10, press *[toggle breakpoint]*  button
>>4. get this error
>>
>> Set Breakpoint on 
>> /Users/robxxx/Documents/r_web2py_1_99/web2py/web2py.app/Contents/Resources/applications/RAM_Simple_Insert/models/db.py
>>  
>> at line 10: Line 
>> /Users/robsss/Documents/signaturr_web2py_1_99/web2py/web2py.app/Contents/Resources/applications/RAM_Simple_Insert/models/db.py:10
>>  
>> does not exist
>>
>> I've searched web2py forums lots of references to debug with other 
>> editors etc.
>> - but I just can't get started.
>>
>> It will be helpful to my learning,  if I can observer variables in the 
>> Debug window. (WEB2PY ONLINE DEBUGGER
>>
>> Found this, but it doesn't talk about how to debug in web2py
>> http://stackoverflow.com/questions/315165/how-to-debug-web2py-applications
>>
>> Thanks!
>> Rob
>>
>>
>>
>>

-- 





[web2py] Re: How to get started with web2py's Debug? - very basic questions

2012-08-13 Thread Rob_McC

Q:
>Do you have this file?

A:
. Sure, it is just the default file when I created the simple app to learn 
how to use debug-
   Here it  is, also *attached*.

Thanks for looking at this.
R

# -*- coding: utf-8 -*-
# this file is released under public domain and you can use without 
limitations

#
## This is a samples controller
## - index is the default action of any application
## - user is required for authentication and authorization
## - download is for downloading files uploaded in the db (does streaming)
## - call exposes all registered services (none by default)
#

def index():
"""
example action using the internationalization operator T and flash
rendered by views/default/index.html or views/generic.html
"""
response.flash = "Welcome to web2py!"
return dict(message=T('Hello World'))

def user():
"""
exposes:
http:///[app]/default/user/login
http:///[app]/default/user/logout
http:///[app]/default/user/register
http:///[app]/default/user/profile
http:///[app]/default/user/retrieve_password
http:///[app]/default/user/change_password
use @auth.requires_login()
@auth.requires_membership('group name')
@auth.requires_permission('read','table name',record_id)
to decorate functions that need access control
"""
return dict(form=auth())


def download():
"""
allows downloading of uploaded files
http:///[app]/default/download/[filename]
"""
return response.download(request,db)


def call():
"""
exposes services. for example:
http:///[app]/default/call/jsonrpc
decorate with @services.jsonrpc the functions to expose
supports xml, json, xmlrpc, jsonrpc, amfrpc, rss, csv
"""
return service()


@auth.requires_signature()
def data():
"""
http:///[app]/default/data/tables
http:///[app]/default/data/create/[table]
http:///[app]/default/data/read/[table]/[id]
http:///[app]/default/data/update/[table]/[id]
http:///[app]/default/data/delete/[table]/[id]
http:///[app]/default/data/select/[table]
http:///[app]/default/data/search/[table]
but URLs must be signed, i.e. linked with
  A('table',_href=URL('data/tables',user_signature=True))
or with the signed load operator
  
LOAD('default','data.load',args='tables',ajax=True,user_signature=True)
"""
return dict(form=crud())







On Monday, August 13, 2012 2:27:42 PM UTC-4, Massimo Di Pierro wrote:
>
> Do you have this file:
> /Users/robsss/Documents/signaturr_web2py_1_99/web2py/
> web2py.app/Contents/Resources/applications/RAM_Simple_Insert/models/db.py
>
>
>>  

-- 



# -*- coding: utf-8 -*-
# this file is released under public domain and you can use without limitations

#
## This is a samples controller
## - index is the default action of any application
## - user is required for authentication and authorization
## - download is for downloading files uploaded in the db (does streaming)
## - call exposes all registered services (none by default)
#

def index():
"""
example action using the internationalization operator T and flash
rendered by views/default/index.html or views/generic.html
"""
response.flash = "Welcome to web2py!"
return dict(message=T('Hello World'))

def user():
"""
exposes:
http:///[app]/default/user/login
http:///[app]/default/user/logout
http:///[app]/default/user/register
http:///[app]/default/user/profile
http:///[app]/default/user/retrieve_password
http:///[app]/default/user/change_password
use @auth.requires_login()
@auth.requires_membership('group name')
@auth.requires_permission('read','table name',record_id)
to decorate functions that need access control
"""
return dict(form=auth())


def download():
"""
allows downloading of uploaded files
http:///[app]/default/download/[filename]
"""
return response.download(request,db)


def call():
"""
exposes services. for example:
http:///[app]/default/call/jsonrpc
decorate with @services.jsonrpc the functions to expose
supports xml, json, xmlrpc, jsonrpc, amfrpc, rss, csv
"""
return service()


@auth.requires_signature()
def data():
"""
http:///[app]/default/data/tables
http:///[app]/default/data/create/[table]
http:///[app]/default/data/read/[table]/[id]
http:///[app]/default/data/update/[table]/[id]
http:///[app]/default/data/delete/[table]/[id]
http:///[app]/default/data/select/[table]
http:///[app]/default/data/search/[table]
but URLs must be 

[web2py] Re: NoSQL Question Again!!!

2012-08-13 Thread Pystar
how do we test it. I am interested in doing that


On Monday, August 13, 2012 5:08:04 AM UTC+1, Massimo Di Pierro wrote:
>
> We think web2py supports mongo well but we need more people to help 
> testing it.  We will mention in the 2.0 release as experimental because of 
> lack of testers.
>
> On Friday, 10 August 2012 11:16:30 UTC-5, gm01 wrote:
>>
>> Has there been any update with DAL supporting Mongo?  I haven't seen any 
>> "official" mention in w2p docs.  Any information would be appreciated.
>> Thanks,
>> gm
>>
>> On Thursday, July 15, 2010 4:07:04 PM UTC-4, Pystar wrote:
>>>
>>> Hi guys, 
>>> I am one of the proponents that web2py's DAL should support NoSQL 
>>> datastores like Couchdb, Mongodb et al but since the DAL rewrite isn't 
>>> quite completer yet, I would like to know how to use web2py and a 
>>> NoSQL datastore without DAL and without loosing stuff like auto-gen 
>>> forms and validation. 
>>> Thanks Pystar
>>
>>

-- 





Re: [web2py] retrieve data from many to many relation

2012-08-13 Thread Mike Girard
I am sure that this answer is exactly what I am looking for to solve a 
problem I am having. However, I don't quite understand the particulars. 
Vincenzo, could you please provide an example of the queries used here to 
get the movie linked up with the genre. Maybe some code? 

On Saturday, July 28, 2012 5:25:33 PM UTC-4, Vincenzo Ampolo wrote:
>
> On 07/28/2012 03:38 AM, Alec Taylor wrote: 
> > Vincenzo: Have you looked at: https://github.com/niphlod/w2p_tvseries 
>
> What is that ? I can't figure out from the "objectives" section what 
> that application does... 
>
> On 07/28/2012 05:37 AM, Cliff Kachinske wrote:> You need to define a set 
> that includes all three tables in the relation. 
> > 
> > ((db.genres.id==db.movies_genres.genres_id) & 
> > (db.movies_genres.movie_id==db.movies.id)) 
> > 
> > To get the set of genres for a specific movie, do 
> > 
> > | 
> > ((db.genres.id==db.movies_genres.genres_id)& 
> > (db.movies_genres.movie_id==db.movies.id)& 
> > (db.movies.id==1))# or whatever variable you like 
> > | 
> > 
> > 
> > Notice this query allows you to retrieve information from all three 
> > tables at one time. 
>
> Which is exactly like the web2py books suggests. Btw to retrieve all the 
> information of a movie in one shot (so join movie with genres with casts 
> with pictures) may be really database intense (3 joins!) So after a bit 
> of hacking I figured out a simply way to accomplish the same goal: 
>
> web2py automatically add the many-to-many sets to an instance with the 
> same name of the relation table. In my case I've movie.movies_genres for 
> each movie. Given so I can easily get the genres of a movie in a 
> template just doing. 
>
> In [36]: for m in movie.movies_genres.select(): print m.genre.name 
> Thriller 
>
> Best Regards, 
>
> -- 
> Vincenzo Ampolo 
> http://vincenzo-ampolo.net 
> http://goshawknest.wordpress.com 
>

-- 





[web2py] Re: CAS Auth redirect loop

2012-08-13 Thread H. Das
I have the same problem too. I'm using custom auth_user table, as well as a 
custom decorator. After a new user registration, the browser returns a 310 
error. I have to remove this custom decorator from *every *controller 
function for the problem to disappear during new registrations. This is 
very frustrating. Please help.

On Wednesday, August 17, 2011 2:36:45 PM UTC-4, Bruno Codeman wrote:
>
> Hi again, everyone. Does anyone know why a CAS auth could be entering a 
> loop redirect?
>
> -- 
> Bruno de Oliva Bemfica
> *Engenheiro de Software*
> MSN: brunoc...@live.com 
> Mobile: +55 11 8457-0978
> http://www.devfranca.com.br
> http://www.brunobemfica.net
> http://www.codigofree.net
>

-- 





[web2py] Re: Enforcing - like gmail: first character of your username should be a letter (a-z) or number.

2012-08-13 Thread Rob_McC
Just tried with web2py *2.0* release. It *worked* .

auth.define_tables(username=True)
db.auth_user.username.requires.insert(0,IS_MATCH("[a-z].*"))

So, thanks everyone, this certainly answered my first post about the error.

I'll posts my working username code, that behaves the way Google usernames 
do, once I'm done.

Much appreciated everyone,
Rob



-- 





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

2012-08-13 Thread Niphlod
Ok, done (the "save output for TIMEOUTted tasks").
Small issue, but quite manageable: when a task "timeouts" the output now is 
saved, and you have the traceback to see "where" it stopped.
e.g. queue function1 with a timeout of 5 seconds

def function1():
time.sleep(3)
print "first print"
time.sleep(5)
print "second print"



The scheduler_run records will report:

   1. status = TIMEOUT
   2. output = first print
   3. traceback = 

/web2py/gluon/scheduler.py", line 203, in executor
result = dumps(_function(*args,**vars))
  File "applications/w2p_scheduler_tests/models/scheduler.py", line 21, in 
function1
time.sleep(15)
  File "/home/niphlod/Scrivania/web2py_source/web2py/gluon/scheduler.py", 
line 446, in 
signal.signal(signal.SIGTERM, lambda signum, stack_frame: sys.exit(1))
SystemExit: 1



Is that ok ? The "small issue" here is that the traceback is "full", 
starting from where the process is stopped after 5 seconds (the executor 
function), to the "where" it really stopped (line 21, function1, in 
models/scheduler.py) that is the useful information. 
Should the scheduler report only the output and not the traceback for 
TIMEOUTted tasks?

On Wednesday, August 8, 2012 3:25:13 PM UTC+2, Daniel Haag wrote:
>
> Hi Niphlod,
>
> thanks for the great work with the scheduler, I'm using it in a project 
> where it handles lots of big data imports into a database and the migration 
> to your version was without any problems.
>
> On thing catched my eye in the old version and it still seems to be a 
> "problem/missing feature" in the new one. When a long running process gets 
> executed and produces output (print etc.) this output is written to the 
> database only after the task was run (and finished). It would be really 
> great if the output gets written into the task table while the task runs as 
> this would be a possible feedback mechanism (and we would not need another 
> table etc. just for that) just thinking of a progress meter for example.
>
> What I really miss though is the output of the task when it produces a 
> timeout - nothing in the task table about the output...
>
> Daniel
>
>

-- 





Re: [web2py] Connecting with database that has tables in it

2012-08-13 Thread Khalil KHAMLICHI
yes, but don't forget to add this option to each table definition :
migrate=False


On Mon, Aug 13, 2012 at 11:47 AM, hasan alnator
wrote:

> you mean to redefine the tables in the dal like they are in the database ?
>
>
>
>
>
>
> On Mon, Aug 13, 2012 at 2:43 PM, Khalil KHAMLICHI <
> khamlichi.kha...@gmail.com> wrote:
>
>> right, but you will miss the beauty of the DAL.
>> try creating the tables, it takes only a few minutes.
>>
>> On Mon, Aug 13, 2012 at 7:15 AM, hasan alnator <
>> halna...@gardeniatelco.com> wrote:
>>
>>> Dear ALL ,
>>>
>>> So i can use sql server without defining tables , and if i want to use
>>> it  , after i make the connection string i can use db.executesql("RAW
>>> SQL")  ?? is that true ??
>>>
>>>
>>> best regards,
>>>
>>>
>>>
>>>
>>> On Mon, Aug 13, 2012 at 4:16 AM, pbreit  wrote:
>>>
 In order to use DAL query syntax, you have to define the tables.

 --




>>>  --
>>>
>>>
>>>
>>>
>>
>>  --
>>
>>
>>
>>
>
>  --
>
>
>
>

-- 





Re: [web2py] Re: Enforcing - like gmail: first character of your username should be a letter (a-z) or number.

2012-08-13 Thread Jonathan Lundell
On 13 Aug 2012, at 1:28 PM, Rob_McC  wrote:
> Just tried with web2py 2.0 release. It worked .
> 
> auth.define_tables(username=True)
> db.auth_user.username.requires.insert(0,IS_MATCH("[a-z].*"))
> 
> So, thanks everyone, this certainly answered my first post about the error.
> 
> I'll posts my working username code, that behaves the way Google usernames 
> do, once I'm done.
> 
> Much appreciated everyone,

Good. BTW, are you deliberately forbidding upper-case letters?

-- 





[web2py] Re: How to get started with web2py's Debug? - very basic questions

2012-08-13 Thread Rob_McC
Anthony:

*>It sounds like he actually opened that file in the admin editor and hit 
the toggle breakpoint button, which yielded the error.
*
. Yes, that is what I did- 
  Note:
  Tried in 
Version 1.99.7  and
Version 2.0.0 (2012-08-09 04:44:17) dev
thanks.

Rob

-- 





[web2py] Re: NoSQL Question Again!!!

2012-08-13 Thread Massimo Di Pierro
Just install mongo, pymongo and use

db=DAL('mongodb://127.0.0.1:5984/db')

(the port may be different). Everything else should work as usual..

On Monday, 13 August 2012 14:45:15 UTC-5, Pystar wrote:
>
> how do we test it. I am interested in doing that
>
>
> On Monday, August 13, 2012 5:08:04 AM UTC+1, Massimo Di Pierro wrote:
>>
>> We think web2py supports mongo well but we need more people to help 
>> testing it.  We will mention in the 2.0 release as experimental because of 
>> lack of testers.
>>
>> On Friday, 10 August 2012 11:16:30 UTC-5, gm01 wrote:
>>>
>>> Has there been any update with DAL supporting Mongo?  I haven't seen any 
>>> "official" mention in w2p docs.  Any information would be appreciated.
>>> Thanks,
>>> gm
>>>
>>> On Thursday, July 15, 2010 4:07:04 PM UTC-4, Pystar wrote:

 Hi guys, 
 I am one of the proponents that web2py's DAL should support NoSQL 
 datastores like Couchdb, Mongodb et al but since the DAL rewrite isn't 
 quite completer yet, I would like to know how to use web2py and a 
 NoSQL datastore without DAL and without loosing stuff like auto-gen 
 forms and validation. 
 Thanks Pystar
>>>
>>>

-- 





Re: [web2py] Connecting with database that has tables in it

2012-08-13 Thread Anthony
On Monday, August 13, 2012 4:32:25 PM UTC-4, Khalil KHAMLICHI wrote:
>
> yes, but don't forget to add this option to each table definition : 
> migrate=False 
>

You don't have to add that to each table definition -- instead, you have 
two options:

DAL(..., migrate=False)

will set the default value of "migrate" to False for any table that doesn't 
explicitly set the "migrate" argument (so can be overridden for specific 
tables).

DAL(..., migrate_enabled=False)

will disable all migrations, regardless of whether the "migrate" argument 
is set in any given table. See 
http://web2py.com/books/default/chapter/29/6#Migrations.

Anthony

-- 





[web2py] some explanations needed on "prettydate"

2012-08-13 Thread Pystar
Hi guys, 
I am storing my timestamp in my database using the datetime.datetime.now() 
directive. And on display I want to use prettydate in my views, 
I am doing this in my views {{=prettydate(row.timestamp, T)}} but it fails 
silently by not displaying anything. I have tried it in the web2py shell 
and it works but doesnt work in my views, 
what am I doing wrong?
Need replies ASAP

-- 





[web2py] Web2Py Forum anywhere?

2012-08-13 Thread Brood
Apart from google Groups is there a nice community/forum for web2py users?

Cheers

-- 





[web2py] Edit files on GAE?

2012-08-13 Thread Brood
Ok I am new to web2py, python and GAE. I uploaded a simple site made in web2py 
and now I want to edit a spelling mistake I have made..
However since I can not use FTP  how on earth do I edit files?

Do I have to edit the file first locally and then upload it somehow?

I know probably a stupid question but I am not smart =)

-- 





[web2py] Re: some explanations needed on "prettydate"

2012-08-13 Thread Anthony
prettydate() does this:

 try:
 dt = datetime.datetime.now() - d
 except:
 return ''

In the view, maybe try:

{{import datetime}}
{{=datetime.datetime.now() - row.timestamp}}

and see what error is generated to help figure out the problem.

Anthony

On Monday, August 13, 2012 5:11:00 PM UTC-4, Pystar wrote:
>
> Hi guys, 
> I am storing my timestamp in my database using the datetime.datetime.now() 
> directive. And on display I want to use prettydate in my views, 
> I am doing this in my views {{=prettydate(row.timestamp, T)}} but it fails 
> silently by not displaying anything. I have tried it in the web2py shell 
> and it works but doesnt work in my views, 
> what am I doing wrong?
> Need replies ASAP
>

-- 





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

2012-08-13 Thread Daniel Haag
Thanks for your response,

2012/8/12 Niphlod 

> Uhm, serializing part of the output to the table every n seconds - with
> the output being a stream - would require a buffer/read/flush to update the
> scheduler_run table that I'm not sure it's feasible: I'll look into that
> but ATM I'm more concerned with other small issues of the Scheduler.
>

I don't know if it would work this way but I would be glad if you could
give me some feedback (its actually just a proof of concept - but I did
already test it a little):

https://github.com/dhx/web2py/compare/scheduler_live_output



> I'll definitely add to the feature-list the possibility to "recover" the
> output from TIMEOUTted tasks.
> Aaanyway - for both issues - the logging module (and not some random
> prints) is the right tool for the job ^_^ .
>

Using the logging module is an option, but wouldn't I either end up writing
to a file or to another table?


> BTW: as of now I saw only a queue/task processor for node.js that reports
> the "percentage" (i.e. every small bit of change "intra-execution" of the
> task in the workers "bubbles" up to the queue manager). Could you pinpoint
> me to a queue/task messaging implementation with this feature, if you saw
> this feature implemented already ?
>

Well, actually I did not, but that doesn't mean a lot as I didn't have the
requirement of a scheduler in a web framework until recently...





>
> On Wednesday, August 8, 2012 3:25:13 PM UTC+2, Daniel Haag wrote:
>>
>> Hi Niphlod,
>>
>> thanks for the great work with the scheduler, I'm using it in a project
>> where it handles lots of big data imports into a database and the migration
>> to your version was without any problems.
>>
>> On thing catched my eye in the old version and it still seems to be a
>> "problem/missing feature" in the new one. When a long running process gets
>> executed and produces output (print etc.) this output is written to the
>> database only after the task was run (and finished). It would be really
>> great if the output gets written into the task table while the task runs as
>> this would be a possible feedback mechanism (and we would not need another
>> table etc. just for that) just thinking of a progress meter for example.
>>
>> What I really miss though is the output of the task when it produces a
>> timeout - nothing in the task table about the output...
>>
>> Daniel
>>
>>  --
>
>
>
>

-- 





[web2py] Re: Web2Py Forum anywhere?

2012-08-13 Thread Anthony
This isn't nice enough? ;-)

Actually, there is also 
http://www.web2pyslices.com, 
but Google Groups is the main forum for community discussion.

Anthony

On Monday, August 13, 2012 5:12:05 PM UTC-4, Brood wrote:
>
> Apart from google Groups is there a nice community/forum for web2py users?
>
> Cheers
>

-- 





[web2py] Re: Edit files on GAE?

2012-08-13 Thread Pystar
you have to edit the site locally and upload again with the python 
appcfg.py /path/to/web2py/folder containing the app.yaml file. simple

On Monday, August 13, 2012 10:10:09 PM UTC+1, Brood wrote:
>
> Ok I am new to web2py, python and GAE. I uploaded a simple site made in 
> web2py and now I want to edit a spelling mistake I have made..
> However since I can not use FTP  how on earth do I edit files?
>
> Do I have to edit the file first locally and then upload it somehow?
>
> I know probably a stupid question but I am not smart =)
>
>

-- 





[web2py] Re: Sending emails with background queue problem

2012-08-13 Thread Florian Letsch
Yes, I am using mysql.

I've accidentally posted this twice [0] on the group (sorry for that). 
Anthony asked:
> How are emails added to the database -- does that happen within the 
application, or also in a script?

Emails are added to the database from within the application (a controller 
function adds a confirmation email to the queue)

[0] https://groups.google.com/forum/?fromgroups#!topic/web2py/YT2jDMea6lU

On Sunday, 12 August 2012 07:17:39 UTC+12, Massimo Di Pierro wrote:
>
> Are you using mysql?
>
> On Friday, 10 August 2012 23:11:03 UTC-5, Florian Letsch wrote:
>>
>> I want to send emails using a background queue as described in the web2py 
>> book: 
>> http://web2py.com/books/default/chapter/29/8#Sending-messages-using-a-background-task
>>
>> However, the queue only sends emails that have been in the database when 
>> I start the script. Database entries added lateron don't get picked up by 
>> the script. The only way I can achieve that is to add another db.commit() 
>> before the select(). I am sure this is not supposed to be necessary. Does 
>> anyone know why this is happening?
>>
>> import time
>> while True:
>> db.commit() # Only works if I add this line
>> rows = db(db.queue.status=='pending').select()
>> for row in rows:
>> if mail.send(to=row.email,
>> subject=row.subject,
>> message=row.message):
>> row.update_record(status='sent')
>> else:
>> row.update_record(status='failed')
>> db.commit()
>> time.sleep(60) # check every minute
>>
>>

-- 





[web2py] Re: Sending email from background queue

2012-08-13 Thread Florian Letsch
I've accidentally posted this twice. Please have a look at the other 
thread: 
https://groups.google.com/forum/?fromgroups#!topic/web2py/u5R-vGcP580%5B1-25%5D
I answered your question there (emails are added from within the 
application).

On Sunday, 12 August 2012 06:17:15 UTC+12, Anthony wrote:
>
> How are emails added to the database -- does that happen within the 
> application, or also in a script?
>
> On Saturday, August 11, 2012 12:55:40 AM UTC-4, Florian Letsch wrote:
>>
>> *My first post somehow didn't make it to the group, I don't know where 
>> it got lost. Sorry if I submit this twice, I have never participated in a 
>> news group before.*
>>
>> I am trying to set up a background queue for sending email as described 
>> in the web2py book. 
>> http://web2py.com/books/default/chapter/29/8#Sending-messages-using-a-background-task
>>
>> However, emails are only sent when they have been in the database before 
>> starting the script. Emails I add to the database when the queue is running 
>> do not get picked up for some reason. I got it to work by adding an 
>> additional db.commit() before the select() in every loop run. I assume this 
>> should not be needed. Does anyone have an idea why this is not working 
>> without that additional commit?
>>
>> import time
>> while True: 
>> db.commit() # not working without this line 
>> rows = db(db.queue.status=='pending').select()
>> for row in rows:
>> if mail.send(to=row.email,
>> subject=row.subject,
>> message=row.message):
>> row.update_record(status='sent')
>> else:
>> row.update_record(status='failed')
>> db.commit()
>> time.sleep(60) # check every minute
>>
>>
>>

-- 





Re: [web2py] Re: Electronic voting anybody?

2012-08-13 Thread António Ramos
No, its not private i post all code. No problem.
First, study Asterisk. Its all around 2 files
extensions.conf, where you define calling rules
sip.conf where you define your phone line users

in extensions.conf i have

exten => 700,1,Answer()
same => n,Read(TMP,vm-enter-num-to-call,1,,1,3)
same => n,AGI(script4.py,${TMP})
same => n,Hangup()

it means that when someone call 700 ( like you see in my youtube video)
asterisk will answer the call and plays the predefined sound ("
vm-enter-num-to-call").
As soon as the caller presses a button , asterisk places that button in
temp and calls a python script with temp as argument.
The python script calls a webservice in web2py that uses tornado messages
to update the browser.
Simple ?
Yes its that simple. Use a softphone to test it. To use a regular phone you
have to interface asterisk with the phone line.
Use Linksys SPA 3102 voip gateway. This could be a litle hard to configure
but if i can do it so can you(all).

Best regards
António



2012/8/13 Massimo Di Pierro 

> Nice. Is this posted somewhere or private?
>
>
> On Sunday, 12 August 2012 08:15:09 UTC-5, Ramos wrote:
>
>> i have a phone voting system with web2py and asterisk
>>
>> http://www.youtube.com/watch?v=vCNoAyKN86o
>>
>>
>>
>> 2012/8/12 Alan Etkin 
>>
>> I like it. I'd consider as a new feature (if not implemented yet) the
>>> option of submitting a new vote replacing the previous before deadline.
>>>
>>> El viernes, 10 de agosto de 2012 18:24:10 UTC-3, Massimo Di Pierro
>>> escribió:
>>>
 Demo service:

https://tests.web2py.com/evote/default/index

 Source:

https://github.com/mdipierro/evote

 I could use some help checking it. Specifically usability and security.

 Massimo

>>> --
>>>
>>>
>>>
>>>
>>
>>  --
>
>
>
>

-- 





[web2py] Helper for many-to-many result sets?

2012-08-13 Thread Mike Girard
 

I have a movie table that has a many-to-many relationship with a person 
table expressed through a star table.

A simplified version of my model:

db.define_table('movie',

Field('title','string'),

 db.define_table('person', 

 Field('name', 'string', unique=True),

db.define_table('star', 

 Field('movie_id', db.movie),

 Field('person_id', db.person),

I am able to create a select that joins the three tables and produces a 
result with all the data I need.

It's easy to iterate through the result and produce something akin to this:

Movie Title  Star 1

Movie Title  Star 2

Movie Title  Star 3


What I want is:

Movie Title 1

Star 1, Star 2, Star 3


Movie Title 2

Star 1, Star 2, Star 3


Programmatically, I'd like something like:

for each movie in rows

move.title

 

  for each star in movie.stars

  star.name


Before I write a function to pre-process the result, can someone tell me if 
there is a helper for producing a result of this kind? 

This thread addresses the same issue - 

https://groups.google.com/forum/?fromgroups#!topic/web2py/GQsMt4qvqSs

- but I was unable to discern the solution the question asker had produced 
for himself, the key to which was this:

"web2py automatically add the many-to-many sets to an instance with the 

same name of the relation table"

I do not know what that means. 

-- 





[web2py] Problem with download function

2012-08-13 Thread Martin Weissenboeck
Hi,

I have a table with texts and uploaded files, something like


db.define_table('mails',
Field('description'),
Field('attach','upload'),
Field('receiver')
)


and a function to send record 1 as an email:

def mymail():
r=db.mails(1)
file=URL('download', args=r.attach)
mail.send(r.receiver, r.description, attachments=Mail.Attachment(file))



I got:

 [Errno 2] No such file or directory:
'/myapp/default/download/mails.attach.8f17405ced65b662.66617669636f6e2833292e69636f.ico'

and that is the content of the variable "file".

I think, I have not understood the upload function. I have read about it in
the book and tried to write my function like these examples  - but without
success.

A workaroung is a line like.

file=request.folder+'\\uploads\\'+r.attach


It does the job - but is it a good programming style?

Any hints?
Regards, Martin

-- 





[web2py] Re: Sending emails with background queue problem

2012-08-13 Thread Niphlod
The most probable cause is the transaction isolation "problem" with mysql 
as explained in 
https://groups.google.com/d/msg/web2py/qLHP3iYz8Lo/Ly2wqK4qZZgJ

I'm starting to think that it's the only adapter behaving differently.

On Monday, August 13, 2012 11:46:11 PM UTC+2, Florian Letsch wrote:
>
> Yes, I am using mysql.
>
> I've accidentally posted this twice [0] on the group (sorry for that). 
> Anthony asked:
> > How are emails added to the database -- does that happen within the 
> application, or also in a script?
>
> Emails are added to the database from within the application (a controller 
> function adds a confirmation email to the queue)
>
> [0] https://groups.google.com/forum/?fromgroups#!topic/web2py/YT2jDMea6lU
>
> On Sunday, 12 August 2012 07:17:39 UTC+12, Massimo Di Pierro wrote:
>>
>> Are you using mysql?
>>
>> On Friday, 10 August 2012 23:11:03 UTC-5, Florian Letsch wrote:
>>>
>>> I want to send emails using a background queue as described in the 
>>> web2py book: 
>>> http://web2py.com/books/default/chapter/29/8#Sending-messages-using-a-background-task
>>>
>>> However, the queue only sends emails that have been in the database when 
>>> I start the script. Database entries added lateron don't get picked up by 
>>> the script. The only way I can achieve that is to add another db.commit() 
>>> before the select(). I am sure this is not supposed to be necessary. Does 
>>> anyone know why this is happening?
>>>
>>> import time
>>> while True:
>>> db.commit() # Only works if I add this line
>>> rows = db(db.queue.status=='pending').select()
>>> for row in rows:
>>> if mail.send(to=row.email,
>>> subject=row.subject,
>>> message=row.message):
>>> row.update_record(status='sent')
>>> else:
>>> row.update_record(status='failed')
>>> db.commit()
>>> time.sleep(60) # check every minute
>>>
>>>

-- 





Re: [web2py] Connecting with database that has tables in it

2012-08-13 Thread Khalil KHAMLICHI
cool

On Mon, Aug 13, 2012 at 8:55 PM, Anthony  wrote:

> On Monday, August 13, 2012 4:32:25 PM UTC-4, Khalil KHAMLICHI wrote:
>>
>> yes, but don't forget to add this option to each table definition :
>> migrate=False
>>
>
> You don't have to add that to each table definition -- instead, you have
> two options:
>
> DAL(..., migrate=False)
>
> will set the default value of "migrate" to False for any table that
> doesn't explicitly set the "migrate" argument (so can be overridden for
> specific tables).
>
> DAL(..., migrate_enabled=False)
>
> will disable all migrations, regardless of whether the "migrate" argument
> is set in any given table. See
> http://web2py.com/books/default/chapter/29/6#Migrations.
>
> Anthony
>
> --
>
>
>
>

-- 





Re: [web2py] Re: Appengine CPU cycles

2012-08-13 Thread Khalil KHAMLICHI
I suppose a static file that is run once on server start-up and never again
would be a good thing.

On Mon, Aug 13, 2012 at 1:22 PM, Anthony  wrote:

> I know, & when I wrote that,  I only meant to express my hope that this
>> subject be included in web2py's roadmap.
>>
>
> OK, that sounds more reasonable than "I could clearly see that web2py was
> too heavy to be profitable on gae." :-)
>
> So, we already have conditional models as well as the option to put models
> in modules and import them where needed. There's also been some discussion
> of lazy model definitions. Do you have additional suggestions for the
> roadmap?
>
> Anthony
>
> --
>
>
>
>

-- 





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

2012-08-13 Thread Niphlod

On Monday, August 13, 2012 4:44:18 PM UTC+2, Daniel Haag wrote:
>
> I don't know if it would work this way but I would be glad if you could 
> give me some feedback (its actually just a proof of concept - but I did 
> already test it a little):
>
> https://github.com/dhx/web2py/compare/scheduler_live_output
>
>  
TY for the code (smart), I'll definitely check your implementation ASAP 

 
>
>> I'll definitely add to the feature-list the possibility to "recover" the 
>> output from TIMEOUTted tasks.
>> Aaanyway - for both issues - the logging module (and not some random 
>> prints) is the right tool for the job ^_^ .
>>
>
> Using the logging module is an option, but wouldn't I either end up 
> writing to a file or to another table?
>
>  
Yep, I was implying that the "burden" of updating the scheduler_run table 
just to record its output is maybe a "non-wanted" feature for all the ones 
that don't need that. However, if it turns out it's not heavy at all, I see 
no problems implementing it.


> Well, actually I did not, but that doesn't mean a lot as I didn't have the 
> requirement of a scheduler in a web framework until recently...
>
>
Ok, it's just that if - luckily - there is some code around the web noone 
is forced to reinvent the wheel.

 

-- 





Re: [web2py] Helper for many-to-many result sets?

2012-08-13 Thread Alec Taylor
It sounds like you want to reduce the fields shown in the results, since
you already know some of the information.

However the additional queries, though smaller, will require more resources
than a simple join. So I recommend just sticking with the join, and
displaying in your view what you'd like.

As for the wrapper to give things easier to work with names, just specify
said information in your controller.
On 14/08/2012 8:04 AM, "Mike Girard"  wrote:

> I have a movie table that has a many-to-many relationship with a person
> table expressed through a star table.
>
> A simplified version of my model:
>
> db.define_table('movie',
>
> Field('title','string'),
>
>  db.define_table('person',
>
>  Field('name', 'string', unique=True),
>
> db.define_table('star',
>
>  Field('movie_id', db.movie),
>
>  Field('person_id', db.person),
>
> I am able to create a select that joins the three tables and produces a
> result with all the data I need.
>
> It's easy to iterate through the result and produce something akin to this:
>
> Movie Title  Star 1
>
> Movie Title  Star 2
>
> Movie Title  Star 3
>
>
> What I want is:
>
> Movie Title 1
>
> Star 1, Star 2, Star 3
>
>
> Movie Title 2
>
> Star 1, Star 2, Star 3
>
>
> Programmatically, I'd like something like:
>
> for each movie in rows
>
> move.title
>
>  
>
>   for each star in movie.stars
>
>   star.name
>
>
> Before I write a function to pre-process the result, can someone tell me
> if there is a helper for producing a result of this kind?
>
> This thread addresses the same issue -
>
> https://groups.google.com/forum/?fromgroups#!topic/web2py/GQsMt4qvqSs
>
> - but I was unable to discern the solution the question asker had produced
> for himself, the key to which was this:
>
> "web2py automatically add the many-to-many sets to an instance with the
>
> same name of the relation table"
>
> I do not know what that means.
>
> --
>
>
>
>

-- 





Re: [web2py] Re: Web2Py Forum anywhere?

2012-08-13 Thread Alec Taylor
Stackoverflow also has a web2py tag, but most of the answers to those
questions direct people here :P
On 14/08/2012 7:34 AM, "Anthony"  wrote:

> This isn't nice enough? ;-)
>
> Actually, there is also 
> http://www.web2pyslices.com,
> but Google Groups is the main forum for community discussion.
>
> Anthony
>
> On Monday, August 13, 2012 5:12:05 PM UTC-4, Brood wrote:
>>
>> Apart from google Groups is there a nice community/forum for web2py users?
>>
>> Cheers
>>
>  --
>
>
>
>

-- 





Re: [web2py] Helper for many-to-many result sets?

2012-08-13 Thread Mike Girard
I don't think you have understood my question.

My concern is not that I have too many fields nor my field names. 

I am asking if there is an easy way to produce a data structure that lends 
itself to the output I want:

Foreach movie in movies
print movie.title
foreach stars in movie.stars
   print star.name



On Monday, August 13, 2012 6:47:13 PM UTC-4, Alec Taylor wrote:
>
> It sounds like you want to reduce the fields shown in the results, since 
> you already know some of the information.
>
> However the additional queries, though smaller, will require more 
> resources than a simple join. So I recommend just sticking with the join, 
> and displaying in your view what you'd like.
>
> As for the wrapper to give things easier to work with names, just specify 
> said information in your controller.
> On 14/08/2012 8:04 AM, "Mike Girard" > 
> wrote:
>
>> I have a movie table that has a many-to-many relationship with a person 
>> table expressed through a star table.
>>
>> A simplified version of my model:
>>
>> db.define_table('movie',
>>
>> Field('title','string'),
>>
>>  db.define_table('person', 
>>
>>  Field('name', 'string', unique=True),
>>
>> db.define_table('star', 
>>
>>  Field('movie_id', db.movie),
>>
>>  Field('person_id', db.person),
>>
>> I am able to create a select that joins the three tables and produces a 
>> result with all the data I need.
>>
>> It's easy to iterate through the result and produce something akin to 
>> this:
>>
>> Movie Title  Star 1
>>
>> Movie Title  Star 2
>>
>> Movie Title  Star 3
>>
>>
>> What I want is:
>>
>> Movie Title 1
>>
>> Star 1, Star 2, Star 3
>>
>>
>> Movie Title 2
>>
>> Star 1, Star 2, Star 3
>>
>>
>> Programmatically, I'd like something like:
>>
>> for each movie in rows
>>
>> move.title
>>
>>  
>>
>>   for each star in movie.stars
>>
>>   star.name
>>
>>
>> Before I write a function to pre-process the result, can someone tell me 
>> if there is a helper for producing a result of this kind? 
>>
>> This thread addresses the same issue - 
>>
>> https://groups.google.com/forum/?fromgroups#!topic/web2py/GQsMt4qvqSs
>>
>> - but I was unable to discern the solution the question asker had 
>> produced for himself, the key to which was this:
>>
>> "web2py automatically add the many-to-many sets to an instance with the 
>>
>> same name of the relation table"
>>
>> I do not know what that means. 
>>
>> -- 
>>  
>>  
>>  
>>
>

-- 





Re: [web2py] Helper for many-to-many result sets?

2012-08-13 Thread Alec Taylor
Just use a dictionary to do that.

Examples are in the book.

On Tue, Aug 14, 2012 at 8:59 AM, Mike Girard  wrote:
> I don't think you have understood my question.
>
> My concern is not that I have too many fields nor my field names.
>
> I am asking if there is an easy way to produce a data structure that lends
> itself to the output I want:
>
> Foreach movie in movies
> print movie.title
> foreach stars in movie.stars
>print star.name
>
>
>
> On Monday, August 13, 2012 6:47:13 PM UTC-4, Alec Taylor wrote:
>>
>> It sounds like you want to reduce the fields shown in the results, since
>> you already know some of the information.
>>
>> However the additional queries, though smaller, will require more
>> resources than a simple join. So I recommend just sticking with the join,
>> and displaying in your view what you'd like.
>>
>> As for the wrapper to give things easier to work with names, just specify
>> said information in your controller.
>>
>> On 14/08/2012 8:04 AM, "Mike Girard"  wrote:
>>>
>>> I have a movie table that has a many-to-many relationship with a person
>>> table expressed through a star table.
>>>
>>> A simplified version of my model:
>>>
>>> db.define_table('movie',
>>>
>>> Field('title','string'),
>>>
>>>  db.define_table('person',
>>>
>>>  Field('name', 'string', unique=True),
>>>
>>> db.define_table('star',
>>>
>>>  Field('movie_id', db.movie),
>>>
>>>  Field('person_id', db.person),
>>>
>>> I am able to create a select that joins the three tables and produces a
>>> result with all the data I need.
>>>
>>> It's easy to iterate through the result and produce something akin to
>>> this:
>>>
>>> Movie Title  Star 1
>>>
>>> Movie Title  Star 2
>>>
>>> Movie Title  Star 3
>>>
>>>
>>> What I want is:
>>>
>>> Movie Title 1
>>>
>>> Star 1, Star 2, Star 3
>>>
>>>
>>> Movie Title 2
>>>
>>> Star 1, Star 2, Star 3
>>>
>>>
>>> Programmatically, I'd like something like:
>>>
>>> for each movie in rows
>>>
>>> move.title
>>>
>>>  
>>>
>>>   for each star in movie.stars
>>>
>>>   star.name
>>>
>>>
>>> Before I write a function to pre-process the result, can someone tell me
>>> if there is a helper for producing a result of this kind?
>>>
>>> This thread addresses the same issue -
>>>
>>> https://groups.google.com/forum/?fromgroups#!topic/web2py/GQsMt4qvqSs
>>>
>>> - but I was unable to discern the solution the question asker had
>>> produced for himself, the key to which was this:
>>>
>>> "web2py automatically add the many-to-many sets to an instance with the
>>>
>>> same name of the relation table"
>>>
>>> I do not know what that means.
>>>
>>> --
>>>
>>>
>>>
>
> --
>
>
>

-- 





Re: [web2py] some explanations needed on "prettydate"

2012-08-13 Thread Bruno Rocha
It also happens for me, I did not found a better way to solve, but I think
prettydate needs to be rewritten for accurate responses.




On Mon, Aug 13, 2012 at 6:11 PM, Pystar  wrote:

> Hi guys,
> I am storing my timestamp in my database using the datetime.datetime.now()
> directive. And on display I want to use prettydate in my views,
> I am doing this in my views {{=prettydate(row.timestamp, T)}} but it fails
> silently by not displaying anything. I have tried it in the web2py shell
> and it works but doesnt work in my views,
> what am I doing wrong?
> Need replies ASAP
>
> --
>
>
>
>

-- 





Re: [web2py] Helper for many-to-many result sets?

2012-08-13 Thread Mike Girard
Yes, that was my plan, failing to locate something quicker and simpler. 
 The other thread I linked to suggested there was something.

I was unable to find a suitable example in the book. 

On Monday, August 13, 2012 7:10:29 PM UTC-4, Alec Taylor wrote:
>
> Just use a dictionary to do that. 
>
> Examples are in the book. 
>
> On Tue, Aug 14, 2012 at 8:59 AM, Mike Girard 
> > 
> wrote: 
> > I don't think you have understood my question. 
> > 
> > My concern is not that I have too many fields nor my field names. 
> > 
> > I am asking if there is an easy way to produce a data structure that 
> lends 
> > itself to the output I want: 
> > 
> > Foreach movie in movies 
> > print movie.title 
> > foreach stars in movie.stars 
> >print star.name 
> > 
> > 
> > 
> > On Monday, August 13, 2012 6:47:13 PM UTC-4, Alec Taylor wrote: 
> >> 
> >> It sounds like you want to reduce the fields shown in the results, 
> since 
> >> you already know some of the information. 
> >> 
> >> However the additional queries, though smaller, will require more 
> >> resources than a simple join. So I recommend just sticking with the 
> join, 
> >> and displaying in your view what you'd like. 
> >> 
> >> As for the wrapper to give things easier to work with names, just 
> specify 
> >> said information in your controller. 
> >> 
> >> On 14/08/2012 8:04 AM, "Mike Girard"  wrote: 
> >>> 
> >>> I have a movie table that has a many-to-many relationship with a 
> person 
> >>> table expressed through a star table. 
> >>> 
> >>> A simplified version of my model: 
> >>> 
> >>> db.define_table('movie', 
> >>> 
> >>> Field('title','string'), 
> >>> 
> >>>  db.define_table('person', 
> >>> 
> >>>  Field('name', 'string', unique=True), 
> >>> 
> >>> db.define_table('star', 
> >>> 
> >>>  Field('movie_id', db.movie), 
> >>> 
> >>>  Field('person_id', db.person), 
> >>> 
> >>> I am able to create a select that joins the three tables and produces 
> a 
> >>> result with all the data I need. 
> >>> 
> >>> It's easy to iterate through the result and produce something akin to 
> >>> this: 
> >>> 
> >>> Movie Title  Star 1 
> >>> 
> >>> Movie Title  Star 2 
> >>> 
> >>> Movie Title  Star 3 
> >>> 
> >>> 
> >>> What I want is: 
> >>> 
> >>> Movie Title 1 
> >>> 
> >>> Star 1, Star 2, Star 3 
> >>> 
> >>> 
> >>> Movie Title 2 
> >>> 
> >>> Star 1, Star 2, Star 3 
> >>> 
> >>> 
> >>> Programmatically, I'd like something like: 
> >>> 
> >>> for each movie in rows 
> >>> 
> >>> move.title 
> >>> 
> >>>   
> >>> 
> >>>   for each star in movie.stars 
> >>> 
> >>>   star.name 
> >>> 
> >>> 
> >>> Before I write a function to pre-process the result, can someone tell 
> me 
> >>> if there is a helper for producing a result of this kind? 
> >>> 
> >>> This thread addresses the same issue - 
> >>> 
> >>> https://groups.google.com/forum/?fromgroups#!topic/web2py/GQsMt4qvqSs 
> >>> 
> >>> - but I was unable to discern the solution the question asker had 
> >>> produced for himself, the key to which was this: 
> >>> 
> >>> "web2py automatically add the many-to-many sets to an instance with 
> the 
> >>> 
> >>> same name of the relation table" 
> >>> 
> >>> I do not know what that means. 
> >>> 
> >>> -- 
> >>> 
> >>> 
> >>> 
> > 
> > -- 
> > 
> > 
> > 
>

-- 





[web2py] cherokee alive

2012-08-13 Thread Michele Comitini
https://github.com/cherokee/webserver

Good to see new commits lately.

mic

-- 





[web2py] Functions in Views

2012-08-13 Thread Kevin Miller
Hi All,

Can I call custom functions in views? Functions that I have created in my
controller/default.py.



Thanks.

-- 





Re: [web2py] Functions in Views

2012-08-13 Thread Bruno Rocha
You only can call functions that are in global scope.

if you define function in /models/ so you can call those functions in
controllers and views.

If you defined in controller, so you have to return it to the view.

controller/default.py
---

def foo():
return "bar"

def index():
name = "Bruno"
form = FORM()
return dict(form=form, name=name, foo=foo)

--




 *Bruno Cezar Rocha** - @rochacbruno*
rochacbr...@gmail.com | Mobile: +55 (11) 99210-8821
www.CursoDePython.com.br | www.rochacbruno.com.br
Blog: Loading html elements dynamically with web2py and ajax

  Get a signature like this.

Click
here.



On Mon, Aug 13, 2012 at 9:34 PM, Kevin Miller wrote:

>
> Hi All,
>
> Can I call custom functions in views? Functions that I have created in my
> controller/default.py.
>
>
>
> Thanks.
>
> --
>
>
>
>

-- 





Re: [web2py] Functions in Views

2012-08-13 Thread Kevin Miller
Thank you very much Bruno.
Just found out that I can return it in view.

Thanks a lot for your reply.

On Mon, Aug 13, 2012 at 7:48 PM, Bruno Rocha  wrote:

> You only can call functions that are in global scope.
>
> if you define function in /models/ so you can call those functions in
> controllers and views.
>
> If you defined in controller, so you have to return it to the view.
>
> controller/default.py
> ---
>
> def foo():
> return "bar"
>
> def index():
> name = "Bruno"
> form = FORM()
> return dict(form=form, name=name, foo=foo)
>
> --
>
>
>
>
>  *Bruno Cezar Rocha** - @rochacbruno*
> rochacbr...@gmail.com | Mobile: +55 (11) 99210-8821
> www.CursoDePython.com.br | www.rochacbruno.com.br
> Blog: Loading html elements dynamically with web2py and ajax
> 
>   Get a signature like this.
> 
>  Click
> here.
>
>
>
> On Mon, Aug 13, 2012 at 9:34 PM, Kevin Miller wrote:
>
>>
>> Hi All,
>>
>> Can I call custom functions in views? Functions that I have created in my
>> controller/default.py.
>>
>>
>>
>> Thanks.
>>
>> --
>>
>>
>>
>>
>
>  --
>
>
>
>

-- 





Re: [web2py] cherokee alive

2012-08-13 Thread Bruno Rocha
Its Great!

I would like to use Cherokee again! (I used it with Pylons on the past)


On Mon, Aug 13, 2012 at 9:23 PM, Michele Comitini <
michele.comit...@gmail.com> wrote:

> https://github.com/cherokee/webserver
>
> Good to see new commits lately.
>
> mic
>
> --
>
>
>
>

-- 





[web2py] Re: Functions in Views

2012-08-13 Thread Anthony
The view does not see objects created in the controller unless they are 
returned in the dict from the controller function that was called. So, you 
can do:

def view_func(arg1, arg2):
[do something]
return something

def index():
return dict(message='Hello World', func=view_func)

And in the view, you could call:

{{=func(arg1='this', arg2='that')}}

Note, functions defined in controllers are by default exposed for access 
via HTTP requests unless they take arguments or start with a double 
underscore, so be careful not to expose a function intended only for 
internal purposes.

Another option is to define the function in a model file, in which case it 
will be available in all views without needing to be passed from the 
controller. You could also define the function in a module and import it in 
the view.

Anthony

On Monday, August 13, 2012 8:34:41 PM UTC-4, dundee wrote:
>
>
> Hi All,
>
> Can I call custom functions in views? Functions that I have created in my 
> controller/default.py.
>
>
>
> Thanks.
>

-- 





[web2py] Re: Helper for many-to-many result sets?

2012-08-13 Thread Cliff Kachinske
There may be a more elegant way to do this, but it does work.

Be sure to select the movie id in your query.

Then you can do something like this:

rows = db(query).select(.) #whatever you're doing

trows = []
stars = []
for i, r in enumerate rows:
  stars.extend([r.stars.name, BR()])
  if r.movie.id != rows[i+1].movie.id or i+1==len(rows):
trows.append(TR(
  TD(r.movie.name),
  TD(stars), # Other stuff from the row follows
  
 )
)
stars=[] # Reset the stars list
return(TABLE(*trows))



 

On Monday, August 13, 2012 6:04:44 PM UTC-4, Mike Girard wrote:
>
> I have a movie table that has a many-to-many relationship with a person 
> table expressed through a star table.
>
> A simplified version of my model:
>
> db.define_table('movie',
>
> Field('title','string'),
>
>  db.define_table('person', 
>
>  Field('name', 'string', unique=True),
>
> db.define_table('star', 
>
>  Field('movie_id', db.movie),
>
>  Field('person_id', db.person),
>
> I am able to create a select that joins the three tables and produces a 
> result with all the data I need.
>
> It's easy to iterate through the result and produce something akin to this:
>
> Movie Title  Star 1
>
> Movie Title  Star 2
>
> Movie Title  Star 3
>
>
> What I want is:
>
> Movie Title 1
>
> Star 1, Star 2, Star 3
>
>
> Movie Title 2
>
> Star 1, Star 2, Star 3
>
>
> Programmatically, I'd like something like:
>
> for each movie in rows
>
> move.title
>
>  
>
>   for each star in movie.stars
>
>   star.name
>
>
> Before I write a function to pre-process the result, can someone tell me 
> if there is a helper for producing a result of this kind? 
>
> This thread addresses the same issue - 
>
> https://groups.google.com/forum/?fromgroups#!topic/web2py/GQsMt4qvqSs
>
> - but I was unable to discern the solution the question asker had produced 
> for himself, the key to which was this:
>
> "web2py automatically add the many-to-many sets to an instance with the 
>
> same name of the relation table"
>
> I do not know what that means. 
>

-- 





Re: [web2py] Re: Appengine CPU cycles

2012-08-13 Thread Anthony

>
> I suppose a static file that is run once on server start-up and never 
> again would be a good thing.
>

Are you talking about for model definitions? I think there was some 
discussion of something like this in the past (there would be some 
limitations, as some model code does in fact depend on the request and must 
be run each request). Anyway, although that would be convenient, do you 
expect it would perform any better than importing from modules (which are 
only imported once as well)?

Anthony

-- 





[web2py] Re: Problem with download function

2012-08-13 Thread Anthony

>
> I think, I have not understood the upload function. I have read about it 
> in the book and tried to write my function like these examples  - but 
> without success. 
>

The misunderstanding is not with upload/download, but with Mail.Attachment 
-- you have given it the URL for the file (which is how you would access 
the file via an HTTP request from the internet) rather than the file path 
(which is how you access the file internally on the file system). What you 
call a workaround is actually the appropriate way to do it
 

> file=request.folder+'\\uploads\\'+r.attach
>
>
Note, when generating file paths, this is better:

import os
file = os.path.join(request.folder, 'uploads', r.attach)

That will ensure the appropriate path separator is used for the current OS.

Anthony

-- 





[web2py] Book clarification regarding verify_email & reset_password

2012-08-13 Thread JoeCodeswell
Dear web2py folks,

In the book it says in /chapter/29/9#Authentication:


In Auth, by default, email verification is disabled. To enable email, 
> append the following lines in the model where auth is defined:
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
>
> auth.settings.registration_requires_verification = False
> auth.settings.registration_requires_approval = False
> auth.settings.reset_password_requires_verification = True
> auth.messages.verify_email = 'Click on the link http://' + \
> request.env.http_host + \
> URL(r=request,c='default',f='user',args=['verify_email']) + \
> '/%(key)s to verify your email'
> auth.messages.reset_password = 'Click on the link http://' + \
> request.env.http_host + \
> URL(r=request,c='default',f='user',args=['reset_password']) + \
> '/%(key)s to reset your password'
>
> You need to replace the string 
>
> 1.
>
> 'Click on the link ...'
>
> in auth.messages.verify_email with the proper complete URL of the action 
> verify_email. 




For both verify_email and reset_password:
 Should I replace 

'Click on the link http://'
With:
'Click on the link http://myserver.com/myapp/'
Or with:
'Click on the link http://myserver.com/myapp/default/user/verify_email'
My guess is the first, but because the book says "proper complete URL", I am 
not sure.

Thanks in advance for the help.

Love and peace,

Joe


 

-- 





[web2py] Re: Book clarification regarding verify_email & reset_password

2012-08-13 Thread Anthony
Actually, the book is a bit confusing there -- the example code appears to 
be complete as is.

Anthony

On Monday, August 13, 2012 9:09:46 PM UTC-4, JoeCodeswell wrote:
>
> Dear web2py folks,
>
> In the book it says in /chapter/29/9#Authentication:
>
>
> In Auth, by default, email verification is disabled. To enable email, 
>> append the following lines in the model where auth is defined:
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>> 7.
>> 8.
>> 9.
>> 10.
>> 11.
>>
>> auth.settings.registration_requires_verification = False
>> auth.settings.registration_requires_approval = False
>> auth.settings.reset_password_requires_verification = True
>> auth.messages.verify_email = 'Click on the link http://' + \
>> request.env.http_host + \
>> URL(r=request,c='default',f='user',args=['verify_email']) + \
>> '/%(key)s to verify your email'
>> auth.messages.reset_password = 'Click on the link http://' + \
>> request.env.http_host + \
>> URL(r=request,c='default',f='user',args=['reset_password']) + \
>> '/%(key)s to reset your password'
>>
>> You need to replace the string 
>>
>> 1.
>>
>> 'Click on the link ...'
>>
>> in auth.messages.verify_email with the proper complete URL of the action 
>> verify_email. 
>
>
>
>
> For both verify_email and reset_password:
>  Should I replace 
>
> 'Click on the link http://'
> With:
> 'Click on the link http://myserver.com/myapp/'
> Or with:
> 'Click on the link http://myserver.com/myapp/default/user/verify_email'
> My guess is the first, but because the book says "proper complete URL", I am 
> not sure.
>
> Thanks in advance for the help.
>
> Love and peace,
>
> Joe
>
>
>  
>
>

-- 





Re: [web2py] Re: Appengine CPU cycles

2012-08-13 Thread Bruno Rocha
The easy way is

/models/
. nothing here ...

/modules/mymodels.py

from gluon import current
from gluon.dal import DAL, Field

def define_my_tables(*table_list):
db = DAL("")
tables_definitions = {
"owner": {"fields": [Field("name"), Field("gender")], "format":
"%(name)s", "migrate": True}
"car": {"fields": [Field("name"), Field("owner", "reference
owner)], "format": "%(name)s", "migrate": True}
}

   if not table_list:
   table_list = tables_definitions.keys()

   for tablename in table_list:
   fields = tables_definitions.get(tablename, {}).get("fields", [])
   format = tables_definitions.get(tablename, {}).get("format")
   migrate = tables_definitions.get(tablename, {}).get("migrate")

   db.define_table(tablename, *fields, **dict(migrate=migrate,
format=format))

   return db


/controllers/default.py

def list_owners():
from mymodels import define_my_tables
db = define_my_tables("owner")
rows = db(db.owner).select()
return dict(rows=rows)

def list_cars():
from mymodels import define_my_tables
db = define_my_tables("car")
rows = db(db.owner).select()
return dict(rows=rows)

def list_cars_and_owners():
from mymodels import define_my_tables
db = define_my_tables("owner", "car")  # owner comes first because of
reference
owners = db(db.owner).select()
cars = db(db.car).select()
return dict(owners=owners, cars=cars)


Do not testes, but should work, and does not have a lot of class based
code. (but you can be more DRY and wise if put it in to a class based
scheme)

-- 





Re: [web2py] Re: Appengine CPU cycles

2012-08-13 Thread Bruno Rocha
Thinking again...

It could be better if "define_my_tables" run once on the very first request
and table keeps defined forever from there

-- 





Re: [web2py] Re: Book clarification regarding verify_email & reset_password

2012-08-13 Thread Bruno Rocha
Why not:


auth.messages.verify_email = 'Click on the link
http://%(env)s/%(url)s/%(key)s to verify your email' \

  % dict(env=request.env.http_host,
url=URL(...), key= lambda : lazy_get_the_key())

Should this works? being lazy_get_the_key() a function which selects
the current user to interpolate.





*Bruno Cezar Rocha** - @rochacbruno*
rochacbr...@gmail.com | Mobile: +55 (11) 99210-8821
www.CursoDePython.com.br | www.rochacbruno.com.br
Blog: Loading html elements dynamically with web2py and ajax

  Get a signature like this.

Click
here.



On Mon, Aug 13, 2012 at 10:31 PM, Anthony  wrote:

> Actually, the book is a bit confusing there -- the example code appears to
> be complete as is.
>
> Anthony
>
>
> On Monday, August 13, 2012 9:09:46 PM UTC-4, JoeCodeswell wrote:
>>
>> Dear web2py folks,
>>
>> In the book it says in /chapter/29/9#Authentication:
>>
>>
>> In Auth, by default, email verification is disabled. To enable email,
>>> append the following lines in the model where auth is defined:
>>>
>>>
>>> 1.
>>> 2.
>>> 3.
>>> 4.
>>> 5.
>>> 6.
>>> 7.
>>> 8.
>>> 9.
>>> 10.
>>> 11.
>>>
>>>
>>> auth.settings.registration_**requires_verification = False
>>> auth.settings.registration_**requires_approval = False
>>> auth.settings.reset_password_**requires_verification = True
>>> auth.messages.verify_email = 'Click on the link http://' + \
>>>
>>> request.env.http_host + \
>>> URL(r=request,c='default',f='**user',args=['verify_email']) + \
>>>
>>> '/%(key)s to verify your email'
>>> auth.messages.reset_password = 'Click on the link http://' + \
>>>
>>> request.env.http_host + \
>>> URL(r=request,c='default',f='**user',args=['reset_password']) + \
>>>
>>> '/%(key)s to reset your password'
>>>
>>> You need to replace the string
>>>
>>>
>>> 1.
>>>
>>> 'Click on the link ...'
>>>
>>> in auth.messages.verify_email with the proper complete URL of the
>>> action verify_email.
>>
>>
>>
>>
>> For both verify_email and reset_password:
>>  Should I replace
>>
>> 'Click on the link http://'
>> With:
>> 'Click on the link http://myserver.com/myapp/'
>> Or with:
>> 'Click on the link http://myserver.com/myapp/defa**ult/user/verify_email'
>> My guess is the first, but because the book says "proper complete URL", I am 
>> not sure.
>>
>> Thanks in advance for the help.
>>
>> Love and peace,
>>
>> Joe
>>
>>
>>
>>
>>  --
>
>
>
>

-- 





  1   2   >