Re: [web2py] Re: Translatable string inside jquery selector

2014-01-09 Thread Ruud Schroen
In layout.html, and yes it has been executed several times. I even tried
putting it outside the jquery and executing it, still no luck..


On Fri, Jan 10, 2014 at 4:42 AM, Anthony  wrote:

> In what view file is that line, and has that view file been executed since
> adding that line?
>
>
> On Thursday, January 9, 2014 6:31:40 PM UTC-5, Ruud Schroen wrote:
>>
>> I have a translatable string inside a jquery selector. I properly escaped
>> the single quotes cause i don't get an error from jquery.
>>
>> $("#resultemail").removeClass().addClass('error').text('{{=T("Sorry, we
>>> don\\'t know you...")}}').fadeTo(900,1);
>>>
>>
>> But the string is not showing up in my language file, why?
>>
>> Note: not sure if it matters, but the string is inside a ajax function
>> (the error part)
>>
>>
>>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/vIyRDdnXk1A/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Learning Management System survey

2014-01-09 Thread weheh
I missed this thread when it first came out. It would be interesting to 
have this as a plugin of sorts for web2py, maybe like grid.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: !! NEW ADMIN !!

2014-01-09 Thread Jayadevan M
Hi,
I tried this in my 'test' app which has  just 2 tables (blog_post, emp). It 
worked great. Thanks. 
When I try in this my actual app with 50+ tables, the list of tables 
displayed in " 
127.0.0.1:8000//plugin_admin_plus/index"
 
is just the 6 auth tables. What could be the reason? I gave 
plus_admin_plus_superuser permission to one user.

On Tuesday, January 7, 2014 2:49:54 AM UTC+5:30, samuel bonill wrote:
>
>
> Admin
>  
> Plus(A-Plus) is a web2py plugin that provides an easy-to-use interface for 
> managing your data
>
> link: https://github.com/pyner/admin_plus
>
> install
>
> 1. Download and install the plugin
> 2. go to "127.0.0.1:8000//plugin_admin_plus/install"
>  3. Get the permissions " plugin_admin_plus_superuser " in "
> 127.0.0.1:8000//appadmin/insert/db/auth_membership"
> 4. !! ready! Now you can log in...  " 127.0.0.1:8000/
> /plugin_admin_plus/index"
>
> NOTE:  is  replaced by the name of your application
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] DAL auth_user usage problem

2014-01-09 Thread Alexey Khramtsov
Hello!

I'm trying to use the current user with DAL.

db.define_table('tickets',
Field('title', required=IS_NOT_EMPTY, label='ticket_title'),
Field('description', 'text', required=IS_NOT_EMPTY, 
label='ticket_description'),

Field('created_by', 'reference auth_user'),
Field('created_on', 'datetime', default=request.now),

format = '%(title)s',
)

Get the error:

return ogetattr(self, str(key))
AttributeError: 'Table' object has no attribute '('username', '')'

(self=,
 key=('username', ''))



   query = self._build_query(key)
return self._db(query).select(limitby=(0,1), 
orderby_on_limitby=False).first()
elif str(key).isdigit() or 'google' in DRIVERS and isinstance(key, 
Key):
return self._db(self._id == key).select(limitby=(0,1), 
orderby_on_limitby=False).first()
elif key:
return ogetattr(self, str(key))



Function argument list

(self=,
 
key=('username', ''))


def __call__(self, key=DEFAULT, **kwargs):
for_update = kwargs.get('_for_update',False)
if '_for_update' in kwargs: del kwargs['_for_update']

What am I doing wrong?


  

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: auth.enable_record_versioning

2014-01-09 Thread Jayadevan M
Great. You guys have thought about everything, huh? :)

On Friday, January 10, 2014 1:50:36 AM UTC+5:30, Niphlod wrote:
>
> make your own "versioning" with database callbacks.
>
> http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#before-and-after-callbacks
>
> That way you can customize to whatever degree you like what happens when a 
> row gets deleted/updated/inserted at any step.
>
> On Thursday, January 9, 2014 3:46:27 AM UTC+1, Jayadevan M wrote:
>>
>> A question about record versioning.  Is it possible to have this ON and 
>> still *not keep* deleted versions of the record in the original table? 2 
>> reasons - 
>> 1) When there are tables with a number of deletes, the table will become 
>> huge 
>> 2) If we are using hand-written SQLs in many places, we have to remember 
>> to add the filter to fetch only the valid records ( I am assuming when we 
>> write our SQLs, web2py will not automatically add a filter).
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Translatable string inside jquery selector

2014-01-09 Thread Anthony
In what view file is that line, and has that view file been executed since 
adding that line?

On Thursday, January 9, 2014 6:31:40 PM UTC-5, Ruud Schroen wrote:
>
> I have a translatable string inside a jquery selector. I properly escaped 
> the single quotes cause i don't get an error from jquery. 
>
> $("#resultemail").removeClass().addClass('error').text('{{=T("Sorry, we 
>> don\\'t know you...")}}').fadeTo(900,1);
>>
>
> But the string is not showing up in my language file, why?
>
> Note: not sure if it matters, but the string is inside a ajax function 
> (the error part) 
>  
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Translatable string inside jquery selector

2014-01-09 Thread weheh
I believe you will have to execute the jquery selector at least once before 
your string will appear in the language file.

On Friday, January 10, 2014 7:31:40 AM UTC+8, Ruud Schroen wrote:
>
> I have a translatable string inside a jquery selector. I properly escaped 
> the single quotes cause i don't get an error from jquery. 
>
> $("#resultemail").removeClass().addClass('error').text('{{=T("Sorry, we 
>> don\\'t know you...")}}').fadeTo(900,1);
>>
>
> But the string is not showing up in my language file, why?
>
> Note: not sure if it matters, but the string is inside a ajax function 
> (the error part) 
>  
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Scheduler: Error retrieving status?

2014-01-09 Thread User
I'm just getting started with the scheduler and I'm getting an error when I 
start it on windows 7:

C:\www\web2py>python web2py.py -K my_app
web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2014
Version 2.8.2-stable+timestamp.2013.12.09.17.54.55
Database drivers available: SQLite(sqlite3), MySQL(pymysql), PostgreSQL(
psycopg2
), PostgreSQL(pg8000), MSSQL(pyodbc), DB2(pyodbc), Teradata(pyodbc), Ingres(
pyod
bc), IMAP(imaplib)
starting single-scheduler for "my_app"...
ERROR:web2py.scheduler.mycomputer#10144:Error retrieving status
ERROR:web2py.scheduler.mycomputer#10144:Error retrieving status


This error just continually repeats until I ctrl-c.
Here is my scheduler.py:

# coding: utf8
def doit():
print 'hello world'

tasks = dict(
doit=doit,
)
from gluon.scheduler import Scheduler
scheduler = Scheduler(db, tasks)


I created a single row in the scheduler_task table. What is causing this 
error? How do I begin to debug this? (Note when browsing my site there are 
no errors).

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Give ID/class to custom form field

2014-01-09 Thread Anthony
login.custom.email['_class'] = 'myclass'
etc.


On Thursday, January 9, 2014 4:42:20 PM UTC-5, Ruud Schroen wrote:
>
> {{=login.custom.begin}}
>>
>> {{=login.custom.email}}
>>
>> {{=login.custom.password}}
>>
>> {{=login.custom.submit}}
>>
>> {{=login.custom.end}}
>>
>>
> How do i give the custom email, password and submit an ID/class? 
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Translatable string inside jquery selector

2014-01-09 Thread Ruud Schroen
I have a translatable string inside a jquery selector. I properly escaped 
the single quotes cause i don't get an error from jquery. 

$("#resultemail").removeClass().addClass('error').text('{{=T("Sorry, we 
> don\\'t know you...")}}').fadeTo(900,1);
>

But the string is not showing up in my language file, why?

Note: not sure if it matters, but the string is inside a ajax function (the 
error part) 
 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Error with virtual field (was: Re: [web2py] [ANN] Started development on web2admin)

2014-01-09 Thread Manuele Pesenti
Il 10/09/12 15:49, rif ha scritto:
> I started the development of a new django-like admin interface.
>
> You can find it here: https://github.com/rif/web2admin 
>
> It is very basic but still usable because it uses SQLFORM.smartgrid.
>
> I am announcing it early because I need your feedback and feature
> requests so that I can find out if grid will be able to support all
> the desired features.
>
> For quick start you can create a w2a_root group and add your user to
> that group.
>
> -rif
> -- 
>  
>  
>  
Dear rif,
many compliments for the project!
I found a problem with virtual fields... but I don't know if it's
related to your plugin or directly to web2py.
I added a very simple virtual field like this one:

db.testtable.testfield = Field.Virtual(lambda row: 'foo')

and I obtain this error:

Traceback (most recent call last):
  File "/home/manuele/portali/web2py.git/gluon/restricted.py", line 217,
in restricted
exec ccode in environment
  File
"/home/manuele/portali/web2py.git/applications/paytorviewer/controllers/plugin_web2admin.py",
line 116, in 
  File "/home/manuele/portali/web2py.git/gluon/globals.py", line 372, in

self._caller = lambda f: f()
  File "/home/manuele/portali/web2py.git/gluon/tools.py", line 3239, in f
return action(*a, **b)
  File
"/home/manuele/portali/web2py.git/applications/paytorviewer/controllers/plugin_web2admin.py",
line 34, in view_table
showbuttontext = plugins.web2admin.showbuttontext,
  File "/home/manuele/portali/web2py.git/gluon/sqlhtml.py", line 2770,
in smartgrid
user_signature=user_signature, **kwargs)
  File "/home/manuele/portali/web2py.git/gluon/sqlhtml.py", line 2452,
in grid
value = row[str(field)]
  File "/home/manuele/portali/web2py.git/gluon/dal.py", line 7362, in
__getitem__
raise ae
AttributeError: 'Row' object has no attribute 'unknown'

any idea?

Thank you

Manuele

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: REF: update_or_insert() confirming update

2014-01-09 Thread Teddy Nyambe
Noted, thanx!
On 9 Jan 2014 16:52, "Anthony"  wrote:
>
> If it doesn't return an id, that means no new insert was done, which
means it did find a matching record and therefore updated it. Whether or
not any fields in the matching record were actually changed depends on your
inputs. Note, if more than one record matches the criteria, it will only
update the first matching record.
>
> Anthony
>
>
> On Thursday, January 9, 2014 1:23:49 AM UTC-5, software.ted wrote:
>>
>> wanted to find out how to confirm that an update really took place
>> when using update_or_insert(), insert atleast returns the auto id but
>> a successful update seems to return none/null.
>>
>> Any ideas?
>>
>> --
>>
...

>> Teddy Lubasi Nyambe
>> Opensource Zambia
>> Lusaka, ZAMBIA
>>
>> Cell: +260 97 7760473
>> website: http://www.opensource.org.zm
>>
>> ~/
>> Human Knowledge belongs to the world! - AntiTrust
>>
>> Man is a tool-using animal. Without tools he is nothing, with tools he
>> is all - Thomas Carlyle 1795-1881
>>
>> /~
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
"web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Multiple File Upload Form Works! - Need Help with validation for multiple files

2014-01-09 Thread Brando
Thanks to Calvin Morrison's excellent work here is a really simple solution 
to uploading multiple items.  I need help validating multiple files.  I can 
upload one .txt file without issue; however, if i choose more than one it 
will not pass validation.  Can someone tell me what kind of loop or 
function would help me validate files BEFORE they are uploaded?  Also, if 
there is a more elegant way to code the controller please let me know.

Model:
db.define_table('uploads',
Field('username', 'string'),
Field('filename', represent = lambda x, row: "None" if x == None else 
x[:45]),
Field('up_file', 'upload', uploadseparate=True, 
requires=IS_NOT_EMPTY()),
Field('up_date', 'datetime'), 
Field('up_size', 'integer', represent= lambda x, row: 
quikr_utils.sizeof_fmt(x) ), 
Field('notes', 'text'))

Controller:
def submit():
import datetime
form = FORM(LABEL("File(s):"), INPUT(_name='up_files', _type='file', 
_multiple=True, 
requires=IS_UPLOAD_FILENAME(extension='txt|config|log')),INPUT(_type='submit'))
if form.accepts(request.vars, formname="form"):
response.flash = 'form accepted'
files = request.vars['up_files']
if not isinstance(files, list):
files = [files]
for f in files:
up_file = db.uploads.up_file.store(f, f.filename)
i = db.uploads.insert(notes=request.vars.notes, 
up_file=up_file, filename=f.filename, up_date= datetime.datetime.now())
db.commit()
elif form.errors:
response.flash = 'form has errors'
else:
response.flash = 'please fill the form'
return dict(form=form)


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Multiple Uploads using jQuery-File-Upload: Javascript/CSS Conflict?

2014-01-09 Thread Brando
Calvin, I have a few other things I want to work out, but I'm going to 
start a new thread with a more relevant title.  

On Thursday, January 9, 2014 10:10:04 AM UTC-8, Calvin Morrison wrote:
>
> Brando, 
>
> Thanks for working this out! 
>
> it would be good to make a web2py slice or add it to the documentation/ 
> examples 
>
> Calvin 
>
> On 8 January 2014 14:35, Brando > wrote: 
> > This works, added the requires statement for form validation: 
> > 
> > def submit(): 
> > import datetime 
> > form = FORM(LABEL("File(s):"), INPUT(_name='up_files', _type='file', 
> > _multiple='', requires=IS_NOT_EMPTY()),  BR(),INPUT(_type='submit')) 
> > if form.accepts(request.vars, formname="form"): 
> > files = request.vars['up_files'] 
> > if not isinstance(files, list): 
> > files = [files] 
> > for f in files: 
> > print f.filename 
> > up_file = db.uploads.up_file.store(f, f.filename) 
> > i = db.uploads.insert(notes=request.vars.notes, 
> up_file=up_file, 
> > filename=f.filename, up_date= datetime.datetime.now()) 
> > db.commit() 
> > return "form submitted" #redirect(URL('data', 'index')) 
> > return dict(form=form) 
> > 
> > 
> > 
> > -- 
> > Resources: 
> > - http://web2py.com 
> > - http://web2py.com/book (Documentation) 
> > - http://github.com/web2py/web2py (Source code) 
> > - https://code.google.com/p/web2py/issues/list (Report Issues) 
> > --- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "web2py-users" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an 
> > email to web2py+un...@googlegroups.com . 
> > For more options, visit https://groups.google.com/groups/opt_out. 
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: GAE: insert using "key_name"

2014-01-09 Thread Alan Etkin
> But it works fine. I will definitally use this.

Ok. If you can, it would be useful if you could share your tests about 
supported features for records lacking id values and any issue you find 
with setters and getters using key names. Note that the Rows class supports 
defining objects using dictionaries to construct them. Finally, I belive a 
plugin to extended DAL class so it provides retrieving and setting records 
by key name would be also useful.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: "incomplete format" error when trying to insert ids

2014-01-09 Thread Apple Mason
Nevermind, I figured it out. My format string was wrong. After fixing that, 
everything works.

On Thursday, January 9, 2014 4:42:01 PM UTC-5, Apple Mason wrote:
>
> My many-to-many table is throwing an error every time I access that table 
> in the admin page:
>
>  incomplete format
>
> Traceback (most recent call last):
>   File "/home/apl/Desktop/web2py/gluon/restricted.py", line 217, in 
> restricted
> exec ccode in environment
>   File 
> "/home/apl/Desktop/web2py/applications/testapp/views/appadmin.html", line 
> 189, in 
> 
>   File "/home/apl/Desktop/web2py/gluon/sqlhtml.py", line 2917, in __init__
> r = A(represent(field, r, record), _href=str(href))
>   File "/home/apl/Desktop/web2py/gluon/sqlhtml.py", line 56, in represent
> return f(value)
>   File "/home/apl/Desktop/web2py/gluon/dal.py", line 6966, in repr_ref
> def repr_ref(id, row=None, r=referenced, f=ff): return f(r, id)
>   File "/home/apl/Desktop/web2py/gluon/dal.py", line 6939, in ff
> return r._format % row
> ValueError: incomplete format
>
> Here is the gist of what I'm trying to do:
>
> db.category.bulk_insert([ {'title':'category1'} ])
> db.subcategory.bulk_insert([ {'title':'subcategory1'} ])
>
> # This part will throw an error when visiting the admin page for this table
> db.category_subcategory.bulk_insert([ {'category_id':1L, 
> 'subcategory_id':1L} ])
>
> My db has these fields:
>
> category: name Field
> subcategory: name Field
> category_subcategory: category_id Field, subcategory_id Field.
>
> Why am I getting this error?
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Set Field Type Dynamically

2014-01-09 Thread MVolpes
Awesome thanks!!!

I know have a light weight but full featured grid!

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Give ID/class to custom form field

2014-01-09 Thread Ruud Schroen

>
> {{=login.custom.begin}}
>
> {{=login.custom.email}}
>
> {{=login.custom.password}}
>
> {{=login.custom.submit}}
>
> {{=login.custom.end}}
>
>
How do i give the custom email, password and submit an ID/class? 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] "incomplete format" error when trying to insert ids

2014-01-09 Thread Apple Mason
My many-to-many table is throwing an error every time I access that table 
in the admin page:

 incomplete format

Traceback (most recent call last):
  File "/home/apl/Desktop/web2py/gluon/restricted.py", line 217, in 
restricted
exec ccode in environment
  File "/home/apl/Desktop/web2py/applications/testapp/views/appadmin.html", 
line 189, in 

  File "/home/apl/Desktop/web2py/gluon/sqlhtml.py", line 2917, in __init__
r = A(represent(field, r, record), _href=str(href))
  File "/home/apl/Desktop/web2py/gluon/sqlhtml.py", line 56, in represent
return f(value)
  File "/home/apl/Desktop/web2py/gluon/dal.py", line 6966, in repr_ref
def repr_ref(id, row=None, r=referenced, f=ff): return f(r, id)
  File "/home/apl/Desktop/web2py/gluon/dal.py", line 6939, in ff
return r._format % row
ValueError: incomplete format

Here is the gist of what I'm trying to do:

db.category.bulk_insert([ {'title':'category1'} ])
db.subcategory.bulk_insert([ {'title':'subcategory1'} ])

# This part will throw an error when visiting the admin page for this table
db.category_subcategory.bulk_insert([ {'category_id':1L, 
'subcategory_id':1L} ])

My db has these fields:

category: name Field
subcategory: name Field
category_subcategory: category_id Field, subcategory_id Field.

Why am I getting this error?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: GAE: insert using "key_name"

2014-01-09 Thread Quint
Sorry for the confussion..
But it works fine. I will definitally use this.

(I posted something stupid and removed the stupid post but left some traces. 
;-))

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: GAE: insert using "key_name"

2014-01-09 Thread Alan Etkin
> Works great! 

>
> On Thursday, January 9, 2014 7:21:45 PM UTC+1, Quint wrote: 
> Excellent! 
>
>
> I already included it to try it out but how do i use it?


Your message is confusing, does it work or it does not? It worked for my 
environment (recent release of gae sdk and development server)

Specifically, what worked was:

>>> myvalues = db._insert(k=v, ...)
{k: }

Where db is a google app engine connection (DAL instance)

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Scheduler repeat time drift

2014-01-09 Thread Niphlod
ok, got the "issue". We check for last_run_time and add n = period seconds 
to it, that is different from what you'd like, i.e. adding n = period 
seconds * times_run to start_time.

The wording in the book is correct: you get your task queued to be executed 
n period seconds after the first execution.

The concept is subtle however... that actually means e.g. :
- today the task got queued to be executed at 9:00am...but has been picked 
up at 9:01am (e.g., that the worker was sleeping or busy processing other 
tasks) --> the task will be requeued for tomorrow at 9:01am.
- tomorrow, at 9:01am, scheduler "sees" the task that has to be executed, 
but once again the scheduler is processing another queued task and it gets 
actually executed at 9:02am...it will be scheduled for the next day at 
9:02am.

This "behaviour" was meant with a slightly different logic then the one you 
mean (yours is valid too, actually, and is making me think on how to solve 
it)... basically with the scheduler we "drifted" from a 
"millisecond-perfect cron replacement" to a different approach... Let's 
cut the story, here it goes for the summary of the current logic: 
- I want to schedule a task that polls a database/external service once 
every 5*60 seconds (5 minutes)
- I want to be sure that two consecutive executions will never take place 
unless 5*60 seconds passed 

This basically assures you that if your task was scheduled at 09:00 but the 
worker was caught up doing something else, you won't have a first execution 
at 09:03 and a second at 09:05 because it would mean "breaking" the 
assumption that at least 5*60 seconds pass before each execution, and 
that's good for a lot of cases, but not yours.

Yours is different: you have a task and you want it to start it after 
09:00, but every day at 09:00. 
Scheduler instead "assumes/figures out/calculates/interprets" your wishes 
as "you want your emails sent at 24hours intervals", hence the delay you're 
observing when a few days pass by.

To support your wishes, ATM you should then have a "cleanup" task that sets 
"future" next_run_time(s) to start_time(s) + n = period seconds (multiplied 
by times_run), or a task that queues once a day a single execution at 
09:00. 

We can figure out another "boolean" column for the scheduler_task table 
that's more or less named "cron_style" (default=False), that if set to True 
will calculate the next_run_time as the behaviour you want instead of the 
original one. Let me check with the developers and we'll see what can we do.

On Thursday, January 9, 2014 9:33:14 PM UTC+1, Niphlod wrote:
>
> okkey.then let me check the code and report back
>
> On Wednesday, January 8, 2014 10:14:45 PM UTC+1, Brian M wrote:
>>
>> I've got it scheduled to repeat every 86400 seconds (24*60*60) so once a 
>> day.  I thought that it was supposed to keep the same start time like the 
>> book says but it has definitely been drifting - part of the task that's 
>> queued logs to a DB and I can see the timestamps there consistently 
>> drifting ~20 seconds later each day.  I had another task originally setup 
>> to send out a daily email at 9AM and it's drifted to going out around 
>> 9:32AM over the last several months.
>>
>> On Wednesday, January 8, 2014 1:52:31 PM UTC-6, Niphlod wrote:
>>>
>>> I don't exactly get how you scheduled the tasks and how are you 
>>> expecting them to run.
>>> If you schedule a task to start at 10am and set a period of 24*60*60, 
>>> the task will be "requeued" to be executed at 10am.
>>> As the book says, 
>>>
>>> *The time period is not calculated between the END of the first round 
>>> and the START of the next, but from the START time of the first round to 
>>> the START time of the next cycle)*
>>>
>>>
>>>
>>> On Wednesday, January 8, 2014 5:10:38 PM UTC+1, Brian M wrote:

 Is there any way to keep the time at which recurring tasks run from 
 drifting? I've got several daily tasks that over time go from running at 
 say 10am to 10:30am - it seems like each consecutive run is 20 seconds or 
 so behind the previous day's. Is this simply a matter of the next 
 execution 
 time being set based on the ending time of the current run rather than the 
 starting time?  If I want to better enforce running at a certain time 
 daily 
 do I need to resort to having a maintenance task run say once a week and 
 reset the next run time of the daily tasks so they don't drift too far? I 
 suppose that this isn't too much of an issue for tasks that run on a more 
 regular basis like once a minute to process constantly updated queues, but 
 for things that you want to run at a certain set time it's a bit annoying.

 Thanks
 Brian

>>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subs

[web2py] Re: Scheduler repeat time drift

2014-01-09 Thread Niphlod
okkey.then let me check the code and report back

On Wednesday, January 8, 2014 10:14:45 PM UTC+1, Brian M wrote:
>
> I've got it scheduled to repeat every 86400 seconds (24*60*60) so once a 
> day.  I thought that it was supposed to keep the same start time like the 
> book says but it has definitely been drifting - part of the task that's 
> queued logs to a DB and I can see the timestamps there consistently 
> drifting ~20 seconds later each day.  I had another task originally setup 
> to send out a daily email at 9AM and it's drifted to going out around 
> 9:32AM over the last several months.
>
> On Wednesday, January 8, 2014 1:52:31 PM UTC-6, Niphlod wrote:
>>
>> I don't exactly get how you scheduled the tasks and how are you expecting 
>> them to run.
>> If you schedule a task to start at 10am and set a period of 24*60*60, the 
>> task will be "requeued" to be executed at 10am.
>> As the book says, 
>>
>> *The time period is not calculated between the END of the first round and 
>> the START of the next, but from the START time of the first round to the 
>> START time of the next cycle)*
>>
>>
>>
>> On Wednesday, January 8, 2014 5:10:38 PM UTC+1, Brian M wrote:
>>>
>>> Is there any way to keep the time at which recurring tasks run from 
>>> drifting? I've got several daily tasks that over time go from running at 
>>> say 10am to 10:30am - it seems like each consecutive run is 20 seconds or 
>>> so behind the previous day's. Is this simply a matter of the next execution 
>>> time being set based on the ending time of the current run rather than the 
>>> starting time?  If I want to better enforce running at a certain time daily 
>>> do I need to resort to having a maintenance task run say once a week and 
>>> reset the next run time of the daily tasks so they don't drift too far? I 
>>> suppose that this isn't too much of an issue for tasks that run on a more 
>>> regular basis like once a minute to process constantly updated queues, but 
>>> for things that you want to run at a certain set time it's a bit annoying.
>>>
>>> Thanks
>>> Brian
>>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Best practices with sessions

2014-01-09 Thread Niphlod


On Wednesday, January 8, 2014 10:41:49 PM UTC+1, Wonton wrote:
>
> Hello everyone,
>
> I'm trying to implement the web2py recipes to improve the efficiency and 
> security of my backend.  I'm beggining with sessions and I have a couple of 
> doubts:
>
> - My site is over SSL and has user authentication, so I guess I should 
> secure my sessions. The recipe sais "In your applications, if they require 
> authentication, you should make the session cookies secure 
> with:session.secure()", 
> but, where should I put that code?
>

 session.secure() just adds secure to the cookies. If all your site is 
behind ssl, then put session.secure() in a model, so every session will 
have this "flag" set.


> - The number of session files of my server is growing quickly so I should 
> use the sessions2trash.py script, but, how should I use that script? 
> Should I create a cron task in my server that execute each day something 
> like this "python web2py.py -S app -M -R scripts/sessions2trash.py -A -o 
> -x 3600 -f"?
>

this is a two-sided question: if your sessions are growing because they are 
never deleted then sure, use the script as a cron task (the setup with 
nginx does it for you for the welcome app automatically
https://github.com/web2py/web2py/blob/master/scripts/setup-web2py-nginx-uwsgi-ubuntu.sh#L145
using uwsgi cron facilities
) 
if instead they're growing because lots of different users access the 
application that needs them, you can't absolutely do nothing, except 
following some best practices on using separate=True to avoid having speed 
penalties from the underlying filesystem (for tenths of thousands of 
session files) or adopt the redis backend, that can handle millions of 
sessions very quickly. All of this is largely documented on the book at 
http://web2py.com/books/default/chapter/29/13/deployment-recipes
Please note that with your commandline you'll delete sessions older than an 
hour, regardless of the expiration: this means that your users will have to 
logon after 1 hour of no activity, and that **could** be seen as a bummer. 
 

>
> Thank you very much and kind regards!
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: auth.enable_record_versioning

2014-01-09 Thread Niphlod
make your own "versioning" with database callbacks.
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#before-and-after-callbacks

That way you can customize to whatever degree you like what happens when a 
row gets deleted/updated/inserted at any step.

On Thursday, January 9, 2014 3:46:27 AM UTC+1, Jayadevan M wrote:
>
> A question about record versioning.  Is it possible to have this ON and 
> still *not keep* deleted versions of the record in the original table? 2 
> reasons - 
> 1) When there are tables with a number of deletes, the table will become 
> huge 
> 2) If we are using hand-written SQLs in many places, we have to remember 
> to add the filter to fetch only the valid records ( I am assuming when we 
> write our SQLs, web2py will not automatically add a filter).
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Learning Management System survey

2014-01-09 Thread Jesus Alvaro
Good News! I am really interested.
Thanks

El jueves, 9 de enero de 2014 16:42:54 UTC+1, Rod Watkins escribió:
>
> Excellent. I was not even aware of this thread, but its potential is great.
> Rod
>
> On Thursday, January 9, 2014 6:30:25 AM UTC-8, Massimo Di Pierro wrote:
>>
>> I have something coming up soon.
>>
>> On Thursday, 9 January 2014 03:47:35 UTC-6, Jesus Alvaro wrote:
>>>
>>> Any news on progress?
>>>
>>> El sábado, 8 de enero de 2011 22:40:01 UTC+1, Anthony escribió:

 Looks like there's a lot of dissatisfaction with Blackboard (and 
 Moodle):
  

 http://www.reddit.com/r/programming/comments/eye4y/shame_on_you_blackboard/

>>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: GAE: insert using "key_name"

2014-01-09 Thread Quint
Please Ignore that.
I got it.

Works great!

On Thursday, January 9, 2014 7:21:45 PM UTC+1, Quint wrote:
>
> Excellent!
>
> I already included it to try it out but how do i use it?
>
> When I use your example I get:
>
> AttributeError: 'DAL' object has no attribute '_insert' 
> (obviously because there is no _select() in DAL)
>
> When i try:
> db._adapter._insert(props)
> I get:
>
>  File "C:\Users\Quint*\gluon\dal.py", line 5302, in 
> return dict((f.name,self.represent(v,f.type)) for f,v in fields)
> ValueError: too many values to unpack
>
> What do I need to supply to _select()?
>  It looks like I need to supply a collection of Fields.
>
> I'm missing something...
>
> On Thursday, January 9, 2014 2:00:08 PM UTC+1, Alan Etkin wrote:
>>
>> How about adding support in dal.py for the following:
>>>
>>> # processes the field input and add defaults, computes, etc. (does not 
>>> make actual insertion).
>>> >>> values = db._insert(spam="alot", ...)
>>> {"spam": "alot", ...}
>>>
>>
>> I made a pr about supporting _insert for processing values without 
>> applying changes to the database as proposed in the previous post
>>
>> https://github.com/web2py/web2py/pull/341
>>
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: GAE: insert using "key_name"

2014-01-09 Thread Quint
Excellent!

I already included it to try it out but how do i use it?

When I use your example I get:

AttributeError: 'DAL' object has no attribute '_insert' 
(obviously because there is no _select() in DAL)

When i try:
db._adapter._insert(props)
I get:

 File "C:\Users\Quint*\gluon\dal.py", line 5302, in 
return dict((f.name,self.represent(v,f.type)) for f,v in fields)
ValueError: too many values to unpack

What do I need to supply to _select()?
 It looks like I need to supply a collection of Fields.

I'm missing something...

On Thursday, January 9, 2014 2:00:08 PM UTC+1, Alan Etkin wrote:
>
> How about adding support in dal.py for the following:
>>
>> # processes the field input and add defaults, computes, etc. (does not 
>> make actual insertion).
>> >>> values = db._insert(spam="alot", ...)
>> {"spam": "alot", ...}
>>
>
> I made a pr about supporting _insert for processing values without 
> applying changes to the database as proposed in the previous post
>
> https://github.com/web2py/web2py/pull/341
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Multiple Uploads using jQuery-File-Upload: Javascript/CSS Conflict?

2014-01-09 Thread Calvin Morrison
Brando,

Thanks for working this out!

it would be good to make a web2py slice or add it to the documentation/ examples

Calvin

On 8 January 2014 14:35, Brando  wrote:
> This works, added the requires statement for form validation:
>
> def submit():
> import datetime
> form = FORM(LABEL("File(s):"), INPUT(_name='up_files', _type='file',
> _multiple='', requires=IS_NOT_EMPTY()),  BR(),INPUT(_type='submit'))
> if form.accepts(request.vars, formname="form"):
> files = request.vars['up_files']
> if not isinstance(files, list):
> files = [files]
> for f in files:
> print f.filename
> up_file = db.uploads.up_file.store(f, f.filename)
> i = db.uploads.insert(notes=request.vars.notes, up_file=up_file,
> filename=f.filename, up_date= datetime.datetime.now())
> db.commit()
> return "form submitted" #redirect(URL('data', 'index'))
> return dict(form=form)
>
>
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: REF: DAL Catching errors

2014-01-09 Thread Teddy Nyambe
Thanx Anthony,

I will use [try]
On 9 Jan 2014 15:52, "Anthony"  wrote:

> try:
> db.test.insert(...)
> except IntegrityError:
> [return friendly error message]
>
> Of course, if the inserts are done via form submission, you should instead
> add an IS_NOT_IN_DB validator, in which case, it will automatically check
> for duplicates and return the appropriate error message. Even if not using
> a form, you can make use of the validator by using the
> .validate_and_insert() method.
>
> Anthony
>
> On Thursday, January 9, 2014 2:31:00 AM UTC-5, software.ted wrote:
>>
>> Hi,
>>
>> I am trying to find out the best way to catch errors generated by
>> web2py especially those genereted by say DAL. Say forinstance if I
>> have a table:
>>
>> db.define_table('test', Field('xyz', 'integer', unique=True)
>>
>> If i insert a dublicate field will get the exception and ticket:
>>
>> IntegrityError: (1062, u"Duplicate entry 'X' for key 'xyz'")
>>
>> Now i want to catch such an error and send a better message to a user,
>> not the ticket etc.
>>
>> Any ideas?
>>
>> --
>> ...
>>
>> Teddy Lubasi Nyambe
>> Opensource Zambia
>> Lusaka, ZAMBIA
>>
>> Cell: +260 97 7760473
>> website: http://www.opensource.org.zm
>>
>> ~/
>> Human Knowledge belongs to the world! - AntiTrust
>>
>> Man is a tool-using animal. Without tools he is nothing, with tools he
>> is all - Thomas Carlyle 1795-1881
>>
>> /~
>>
>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Learning Management System survey

2014-01-09 Thread Rod Watkins
Excellent. I was not even aware of this thread, but its potential is great.
Rod

On Thursday, January 9, 2014 6:30:25 AM UTC-8, Massimo Di Pierro wrote:
>
> I have something coming up soon.
>
> On Thursday, 9 January 2014 03:47:35 UTC-6, Jesus Alvaro wrote:
>>
>> Any news on progress?
>>
>> El sábado, 8 de enero de 2011 22:40:01 UTC+1, Anthony escribió:
>>>
>>> Looks like there's a lot of dissatisfaction with Blackboard (and Moodle):
>>>  
>>>
>>> http://www.reddit.com/r/programming/comments/eye4y/shame_on_you_blackboard/
>>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: intercept closing session

2014-01-09 Thread Anthony
On Thursday, January 9, 2014 10:02:23 AM UTC-5, Giuseppe D'Amico wrote:
>
> I have to create the database, using the same model  for every user it is 
> not safe, so I use the session_id as name file for the model, I need to 
> intercept when a user's session ends, to delete its model  
>

It's not clear whether you are talking about models or databases. The model 
is defined during the request and exists only during the request. You don't 
have to change the name of the model or delete it at the end of the 
request. You could do:

db = DAL([connection string that is specific to this user], ...)

db.define_table('mytable', ...)

When User A makes a request, db will be a connection to that user's 
database, and db.mytable will therefore be a model of the "mytable" table 
in User A's database. When User B makes a request, db will be a connection 
to a different database, and db.mytable will be a model of the "mytable" 
table in that database. These objects will be created in different threads 
and exist only as long as the request lasts.

The question is, what happens with all of these databases? Do you really 
want one for every session, or just one for every registered user. If the 
latter, do you want the data to persist over time (i.e., beyond the 
session)? If so, don't use the session ID to name the database.

Note, it can be tricky to figure out when a session ends. Technically, the 
session cookie should last until the user closes their browser, but you 
can't know when that happens. As an alternative, you could define some time 
limit of inactivity and automatically expunge any data associated with a 
session that has been inactive for too long.

Anthony

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: intercept closing session

2014-01-09 Thread Giuseppe D'Amico
I have to create the database, using the same model  for every user it is
not safe, so I use the session_id as name file for the model, I need to
intercept when a user's session ends, to delete its model


2014/1/8 Anthony 

> On Wednesday, January 8, 2014 1:48:28 AM UTC-5, Giuseppe D'Amico wrote:
>>
>> I have to  connect to a database known only at runtime, I create the
>> model on the fly,
>>
>
> Do you have to create the database or a database table on the fly (or
> something else)?
>
>
>> but it is not thread safe,
>>
>
> Why is it not thread safe?
>
>
>> so I thought  that a possible
>> solution could be to give to the model the name of the session_id
>>
>
> Do you need a model per session or just per user? In any case, why does
> this require knowing when the user terminates the session -- do you have to
> destroy the data at that point?
>
> Anthony
>
>>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/rzS37obsTI4/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: REF: update_or_insert() confirming update

2014-01-09 Thread Anthony
If it doesn't return an id, that means no new insert was done, which means 
it did find a matching record and therefore updated it. Whether or not any 
fields in the matching record were actually changed depends on your inputs. 
Note, if more than one record matches the criteria, it will only update the 
first matching record.

Anthony

On Thursday, January 9, 2014 1:23:49 AM UTC-5, software.ted wrote:
>
> wanted to find out how to confirm that an update really took place 
> when using update_or_insert(), insert atleast returns the auto id but 
> a successful update seems to return none/null. 
>
> Any ideas? 
>
> -- 
> ...
>  
>
> Teddy Lubasi Nyambe 
> Opensource Zambia 
> Lusaka, ZAMBIA 
>
> Cell: +260 97 7760473 
> website: http://www.opensource.org.zm 
>
> ~/ 
> Human Knowledge belongs to the world! - AntiTrust 
>
> Man is a tool-using animal. Without tools he is nothing, with tools he 
> is all - Thomas Carlyle 1795-1881 
>
> /~ 
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: !! NEW ADMIN !!

2014-01-09 Thread samuel bonill
>
> Hello,
> How can I 'install' the plugin?
>

link :
http://web2py.com/books/default/chapter/29/12/components-and-plugins#Plugins

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Learning Management System survey

2014-01-09 Thread Massimo Di Pierro
I have something coming up soon.

On Thursday, 9 January 2014 03:47:35 UTC-6, Jesus Alvaro wrote:
>
> Any news on progress?
>
> El sábado, 8 de enero de 2011 22:40:01 UTC+1, Anthony escribió:
>>
>> Looks like there's a lot of dissatisfaction with Blackboard (and Moodle):
>>  
>>
>> http://www.reddit.com/r/programming/comments/eye4y/shame_on_you_blackboard/
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: REF: update_or_insert() confirming update

2014-01-09 Thread Massimo Di Pierro
update_or_insert returns the id of the new record or None if existing 
record was updated.

On Thursday, 9 January 2014 00:23:49 UTC-6, software.ted wrote:
>
> wanted to find out how to confirm that an update really took place 
> when using update_or_insert(), insert atleast returns the auto id but 
> a successful update seems to return none/null. 
>
> Any ideas? 
>
> -- 
> ...
>  
>
> Teddy Lubasi Nyambe 
> Opensource Zambia 
> Lusaka, ZAMBIA 
>
> Cell: +260 97 7760473 
> website: http://www.opensource.org.zm 
>
> ~/ 
> Human Knowledge belongs to the world! - AntiTrust 
>
> Man is a tool-using animal. Without tools he is nothing, with tools he 
> is all - Thomas Carlyle 1795-1881 
>
> /~ 
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: !! NEW ADMIN !!

2014-01-09 Thread Jayadevan M
Hello,
How can I 'install' the plugin? 

On Tuesday, January 7, 2014 2:49:54 AM UTC+5:30, samuel bonill wrote:
>
>
> Admin
>  
> Plus(A-Plus) is a web2py plugin that provides an easy-to-use interface for 
> managing your data
>
> link: https://github.com/pyner/admin_plus
>
> install
>
> 1. Download and install the plugin
> 2. go to "127.0.0.1:8000//plugin_admin_plus/install"
>  3. Get the permissions " plugin_admin_plus_superuser " in "
> 127.0.0.1:8000//appadmin/insert/db/auth_membership"
> 4. !! ready! Now you can log in...  " 127.0.0.1:8000/
> /plugin_admin_plus/index"
>
> NOTE:  is  replaced by the name of your application
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Web2py Integration with Sentry

2014-01-09 Thread Massimo Di Pierro
The problem is that it would not work. you can have exceptions at two 
levels: web2py apps, web2py itself. In other frameworks these two levels 
are mixed up so sentry will catch either exceptions. In web2py the two 
levels are well separated and web2py catches app exceptions before they 
propagate up and sentry would not catch them. sentry would only catch 
exceptions in web2py itself and that is pretty much useless. 

You can think about it in another way, web2py already has a mechanism to 
catch exceptions and log them. and you cannot do:

try:
try:
  do something
   exceptiion: 
  web2py ticket system
except:
   sentry logging system

and expect the second except to catch anything. Look instead into 
scritps/tickets2db.py and scripts/tickets2email.py and modify them to do 
what you need to do.


On Wednesday, 8 January 2014 23:27:46 UTC-6, James Q wrote:
>
> Interesting. I have never written wsgi middleware, any pointers on that? 
> As middleware, I would still need to have an understanding of how to detect 
> if an exception has been logged in the request, no?
>
> Thanks!
>
> -- J
>
> On Tuesday, January 7, 2014 8:24:14 PM UTC-5, Derek wrote:
>>
>> I haven't, but I've done something similar with a different piece of 
>> software. You'd usually just use it as a wsgi middleware around your app. 
>> So you'd need to run web2py as wsgi and wrap it with Sentry.
>>
>> On Monday, January 6, 2014 8:14:46 PM UTC-7, James Q wrote:
>>>
>>> Has anyone ever integrated web2py an Sentry (
>>> https://github.com/getsentry/sentry)? I would like it if all web2py 
>>> generated exceptions generate a ticket like usual, but also generates an 
>>> event to a sentry server. Has anyone ever done this? If not, could anyone 
>>> point to where I would need to patch web2py or how best this integration 
>>> would work?
>>>
>>> Thanks for any help!
>>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: REF: DAL Catching errors

2014-01-09 Thread Anthony
try:
db.test.insert(...)
except IntegrityError:
[return friendly error message]

Of course, if the inserts are done via form submission, you should instead 
add an IS_NOT_IN_DB validator, in which case, it will automatically check 
for duplicates and return the appropriate error message. Even if not using 
a form, you can make use of the validator by using the 
.validate_and_insert() method.

Anthony

On Thursday, January 9, 2014 2:31:00 AM UTC-5, software.ted wrote:
>
> Hi, 
>
> I am trying to find out the best way to catch errors generated by 
> web2py especially those genereted by say DAL. Say forinstance if I 
> have a table: 
>
> db.define_table('test', Field('xyz', 'integer', unique=True) 
>
> If i insert a dublicate field will get the exception and ticket: 
>
> IntegrityError: (1062, u"Duplicate entry 'X' for key 'xyz'") 
>
> Now i want to catch such an error and send a better message to a user, 
> not the ticket etc. 
>
> Any ideas? 
>
> -- 
> ...
>  
>
> Teddy Lubasi Nyambe 
> Opensource Zambia 
> Lusaka, ZAMBIA 
>
> Cell: +260 97 7760473 
> website: http://www.opensource.org.zm 
>
> ~/ 
> Human Knowledge belongs to the world! - AntiTrust 
>
> Man is a tool-using animal. Without tools he is nothing, with tools he 
> is all - Thomas Carlyle 1795-1881 
>
> /~ 
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Migrating a hude database from Spring to web2py

2014-01-09 Thread Anthony
Note, it is not necessary to bother with migrate=False if you are setting 
migrate_enabled=False -- the latter will prevent all migrations (the former 
is simply used to set the default value of the "migrate" argument for each 
.define_table in case it is not explicitly set, but that is ignored when 
migrate_enabled=False). There should be no need for fake_migrate if there 
are no plans to do any migrations at all.

Anthony

On Thursday, January 9, 2014 8:35:48 AM UTC-5, Paolo Valleri wrote:
>
> Then set the three variables Michele mentioned to false directly, it is 
> not necessary to create any metadata,
> the following code snippet print the station name from a remote database 
> (vpn address), the powerful thing is that the table station has several 
> fields but I defined only once :)
>
> db = DAL('postgres://web2py:web2py@10.8.0.26:5432/postgis',
> migrate=False,
> migrate_enabled=False,
> lazy_tables=True,
> pool_size=3
> )
>
> db.define_table('station',
> Field('name')
> )
>
> print db(db.station).select()
>
>
>  Paolo
>
>
> 2014/1/9 Tushar Tuteja >
>
>> No,
>> I don't want to alter the 5 tables schema.
>> But I want to perform CRUD operations.
>> And it would be great if somehow I can restrict web2py from altering 
>> table schemas all together as a J2EE application is running on the same the 
>> DB and DB is a remote DB.
>> thanks,
>> Tushar Tuteja
>>
>>
>> On 9 January 2014 18:45, Paolo Valleri 
>> > wrote:
>>
>>> Mind that DAL should be instantiated with fake_migrate_all; 
>>> run your app once, then you can set it to false. This operation will 
>>> create several files (one for each defined table) in the app/databases/ 
>>> directory
>>>
>>> moreover, do you need to alter the 5 tables you mentioned?
>>>
>>> Paolo
>>>
>>>
>>> On Thursday, January 9, 2014 12:59:18 PM UTC+1, Michele Comitini wrote:
>>>
 Instantiate the DAL with fake_migrate=True, 
 migrate=False,migrate_enable=False
 Define the tables with only the fields you are going to need in a model 
 file.
 This is going to create the metadata needed by web2py without touching 
 your legacy database schema.




 2014/1/9 Tushar Tuteja 

>  I have a J2EE application and a database which has 200 tables in it.
> I want to develop a new application using web2py, which would use only 
> 5 tables.
> I want to know how should I go about it. As I am not clear about how I 
> would use database without mapping all the 200 tables which is a huge 
> task.
> and I don't want web2py to make any changes on the database tables and 
> their schema.
> only crud operations on the records of the 5 tables.
>  
> Thanks,
> Regards,
> Tushar Tuteja
>  
> -- 
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> --- 
> You received this message because you are subscribed to the Google 
> Groups "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send 
> an email to web2py+un...@googlegroups.com.
>
> For more options, visit https://groups.google.com/groups/opt_out.
>

  -- 
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> - http://github.com/web2py/web2py (Source code)
>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>> --- 
>>> You received this message because you are subscribed to a topic in the 
>>> Google Groups "web2py-users" group.
>>> To unsubscribe from this topic, visit 
>>> https://groups.google.com/d/topic/web2py/BPabc0lulcw/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to 
>>> web2py+un...@googlegroups.com .
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>
>>
>> -- 
>> Tushar Tuteja
>> Undergraduate Student(Fourth Year)
>> Civil Engineering
>> IIT Delhi
>> +919953061943
>> ttu...@gmail.com 
>> ce10...@civil.iitd.ernet.in 
>> "The question isn't who is going to let me; its who is going to stop me!" 
>> - Howard Roark
>>  
>> -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/web2py/BPabc0lulcw/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source cod

Re: [web2py] Migrating a hude database from Spring to web2py

2014-01-09 Thread paolo.vall...@gmail.com
Then set the three variables Michele mentioned to false directly, it is not
necessary to create any metadata,
the following code snippet print the station name from a remote database
(vpn address), the powerful thing is that the table station has several
fields but I defined only once :)

db = DAL('postgres://web2py:web2py@10.8.0.26:5432/postgis',
migrate=False,
migrate_enabled=False,
lazy_tables=True,
pool_size=3
)

db.define_table('station',
Field('name')
)

print db(db.station).select()


 Paolo


2014/1/9 Tushar Tuteja 

> No,
> I don't want to alter the 5 tables schema.
> But I want to perform CRUD operations.
> And it would be great if somehow I can restrict web2py from altering table
> schemas all together as a J2EE application is running on the same the DB
> and DB is a remote DB.
> thanks,
> Tushar Tuteja
>
>
> On 9 January 2014 18:45, Paolo Valleri  wrote:
>
>> Mind that DAL should be instantiated with fake_migrate_all;
>> run your app once, then you can set it to false. This operation will
>> create several files (one for each defined table) in the app/databases/
>> directory
>>
>> moreover, do you need to alter the 5 tables you mentioned?
>>
>> Paolo
>>
>>
>> On Thursday, January 9, 2014 12:59:18 PM UTC+1, Michele Comitini wrote:
>>
>>> Instantiate the DAL with fake_migrate=True, migrate=False,migrate_enable=
>>> False
>>> Define the tables with only the fields you are going to need in a model
>>> file.
>>> This is going to create the metadata needed by web2py without touching
>>> your legacy database schema.
>>>
>>>
>>>
>>>
>>> 2014/1/9 Tushar Tuteja 
>>>
  I have a J2EE application and a database which has 200 tables in it.
 I want to develop a new application using web2py, which would use only
 5 tables.
 I want to know how should I go about it. As I am not clear about how I
 would use database without mapping all the 200 tables which is a huge task.
 and I don't want web2py to make any changes on the database tables and
 their schema.
 only crud operations on the records of the 5 tables.

 Thanks,
 Regards,
 Tushar Tuteja

 --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 You received this message because you are subscribed to the Google
 Groups "web2py-users" group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to web2py+un...@googlegroups.com.

 For more options, visit https://groups.google.com/groups/opt_out.

>>>
>>>  --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to a topic in the
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/web2py/BPabc0lulcw/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>
>
> --
> Tushar Tuteja
> Undergraduate Student(Fourth Year)
> Civil Engineering
> IIT Delhi
> +919953061943
> ttut...@gmail.com 
> ce1090...@civil.iitd.ernet.in
> "The question isn't who is going to let me; its who is going to stop me!"
> - Howard Roark
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/BPabc0lulcw/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Migrating a hude database from Spring to web2py

2014-01-09 Thread Tushar Tuteja
No,
I don't want to alter the 5 tables schema.
But I want to perform CRUD operations.
And it would be great if somehow I can restrict web2py from altering table
schemas all together as a J2EE application is running on the same the DB
and DB is a remote DB.
thanks,
Tushar Tuteja


On 9 January 2014 18:45, Paolo Valleri  wrote:

> Mind that DAL should be instantiated with fake_migrate_all;
> run your app once, then you can set it to false. This operation will
> create several files (one for each defined table) in the app/databases/
> directory
>
> moreover, do you need to alter the 5 tables you mentioned?
>
> Paolo
>
>
> On Thursday, January 9, 2014 12:59:18 PM UTC+1, Michele Comitini wrote:
>
>> Instantiate the DAL with fake_migrate=True, migrate=False,migrate_enable=
>> False
>> Define the tables with only the fields you are going to need in a model
>> file.
>> This is going to create the metadata needed by web2py without touching
>> your legacy database schema.
>>
>>
>>
>>
>> 2014/1/9 Tushar Tuteja 
>>
>>> I have a J2EE application and a database which has 200 tables in it.
>>> I want to develop a new application using web2py, which would use only 5
>>> tables.
>>> I want to know how should I go about it. As I am not clear about how I
>>> would use database without mapping all the 200 tables which is a huge task.
>>> and I don't want web2py to make any changes on the database tables and
>>> their schema.
>>> only crud operations on the records of the 5 tables.
>>>
>>> Thanks,
>>> Regards,
>>> Tushar Tuteja
>>>
>>> --
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> - http://github.com/web2py/web2py (Source code)
>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "web2py-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to web2py+un...@googlegroups.com.
>>>
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/BPabc0lulcw/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
Tushar Tuteja
Undergraduate Student(Fourth Year)
Civil Engineering
IIT Delhi
+919953061943
ttut...@gmail.com 
ce1090...@civil.iitd.ernet.in
"The question isn't who is going to let me; its who is going to stop me!" -
Howard Roark

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Migrating a hude database from Spring to web2py

2014-01-09 Thread Paolo Valleri
Mind that DAL should be instantiated with fake_migrate_all; 
run your app once, then you can set it to false. This operation will create 
several files (one for each defined table) in the app/databases/ directory

moreover, do you need to alter the 5 tables you mentioned?

Paolo


On Thursday, January 9, 2014 12:59:18 PM UTC+1, Michele Comitini wrote:
>
> Instantiate the DAL with fake_migrate=True, 
> migrate=False,migrate_enable=False
> Define the tables with only the fields you are going to need in a model 
> file.
> This is going to create the metadata needed by web2py without touching 
> your legacy database schema.
>
>
>
>
> 2014/1/9 Tushar Tuteja >
>
>> I have a J2EE application and a database which has 200 tables in it.
>> I want to develop a new application using web2py, which would use only 5 
>> tables.
>> I want to know how should I go about it. As I am not clear about how I 
>> would use database without mapping all the 200 tables which is a huge task.
>> and I don't want web2py to make any changes on the database tables and 
>> their schema.
>> only crud operations on the records of the 5 tables.
>>  
>> Thanks,
>> Regards,
>> Tushar Tuteja
>>  
>> -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: ckeditor in appadmin

2014-01-09 Thread Michel Hayek
Thanks Steve Worked well.

-- 
 

*This e-mail is confidential and may also be privileged. If you are not the 
intended **recipient, please notify the sender immediately, delete it from 
your system and do **not copy, disseminate, distribute or disclose any 
information contained therein.*

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: GAE: insert using "key_name"

2014-01-09 Thread Alan Etkin

>
> How about adding support in dal.py for the following:
>
> # processes the field input and add defaults, computes, etc. (does not 
> make actual insertion).
> >>> values = db._insert(spam="alot", ...)
> {"spam": "alot", ...}
>

I made a pr about supporting _insert for processing values without applying 
changes to the database as proposed in the previous post

https://github.com/web2py/web2py/pull/341


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] syntax error in code

2014-01-09 Thread Rob Mayhue
It looks like you are missing the closing ')' on the entered.update_record 
line.

If that doesn't fix it please include the error message that you are 
getting.


On Thursday, January 9, 2014 6:00:52 AM UTC-5, Federico Ferraro wrote:
>
>   form.process().accepted:
> El ene 9, 2014 7:00 a.m., "kartik murthy" <619.k...@gmail.com> 
> escribió:
>
>> Hi there,
>> I am building an app to store electrical consumption data . I 
>> have build a database which include three tabled dept,meter and reading. 
>> THe problem that i have encountered is with the syntax in the following 
>> code:
>>
>>
>>
>> def reg_meter():
>> form = SQLFORM.factory(
>> Field('meter_num',requires=IS_IN_DB(db,db.meter)),
>> Field('meter_type',requires=IS_IN_DB(db,db.meter)),
>> Field('dept_id',requires=IS_IN_DB(db,db.dept.id
>> ,'%(dept_id)s')).process()
>> if form.accepted:
>> entered = db((db.entered.meter_num == form.vars.meter_num) & 
>> (db.entered.meter_type == form.vars.meter_type) & (db.entered.dept_id == 
>> form.vars.dept_id)).select().first()
>> 
>>if entered:
>>   entered.update_record((meter_num = 
>> entered.meter_num+form.vars.meter_num) & (meter_type = 
>> entered.meter_type+form.vars.meter_type) & (dept_id = 
>> entered.dept_id+form.vars.dept_id)
>>
>>else:
>>
>> db.entered.insert(meter_num=form.vars.meter_num,meter_type=form.vars.meter_type,
>> dept_id=form.vars.dept_id)
>>
>> response.flash = 'new record inserted'
>> elif form.errors:
>> response.flash = 'invalid values in form'
>>
>> records = 
>> SQLTABLE(db().select(db.meter.ALL),headers='fieldname:capitalize')
>> return dict(form=form, records=records)
>>
>>
>>
>> It is a function in the default.py for inserting the values. The error is 
>> a syntax error which im not able to debug. Kindly guide me thru the issue. 
>> the syntax error is at the line ' if form.accepted:'  May be the error is 
>> at some other line which i cant find out.
>>
>> Thanks !
>> kartik
>>
>> -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Migrating a hude database from Spring to web2py

2014-01-09 Thread Michele Comitini
Instantiate the DAL with fake_migrate=True,
migrate=False,migrate_enable=False
Define the tables with only the fields you are going to need in a model
file.
This is going to create the metadata needed by web2py without touching your
legacy database schema.




2014/1/9 Tushar Tuteja 

> I have a J2EE application and a database which has 200 tables in it.
> I want to develop a new application using web2py, which would use only 5
> tables.
> I want to know how should I go about it. As I am not clear about how I
> would use database without mapping all the 200 tables which is a huge task.
> and I don't want web2py to make any changes on the database tables and
> their schema.
> only crud operations on the records of the 5 tables.
>
> Thanks,
> Regards,
> Tushar Tuteja
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] syntax error in code

2014-01-09 Thread Federico Ferraro
  form.process().accepted:
El ene 9, 2014 7:00 a.m., "kartik murthy" <619.kar...@gmail.com> escribió:

> Hi there,
> I am building an app to store electrical consumption data . I
> have build a database which include three tabled dept,meter and reading.
> THe problem that i have encountered is with the syntax in the following
> code:
>
>
>
> def reg_meter():
> form = SQLFORM.factory(
> Field('meter_num',requires=IS_IN_DB(db,db.meter)),
> Field('meter_type',requires=IS_IN_DB(db,db.meter)),
> Field('dept_id',requires=IS_IN_DB(db,db.dept.id
> ,'%(dept_id)s')).process()
> if form.accepted:
> entered = db((db.entered.meter_num == form.vars.meter_num) &
> (db.entered.meter_type == form.vars.meter_type) & (db.entered.dept_id ==
> form.vars.dept_id)).select().first()
>
>if entered:
>   entered.update_record((meter_num =
> entered.meter_num+form.vars.meter_num) & (meter_type =
> entered.meter_type+form.vars.meter_type) & (dept_id =
> entered.dept_id+form.vars.dept_id)
>
>else:
>
> db.entered.insert(meter_num=form.vars.meter_num,meter_type=form.vars.meter_type,
> dept_id=form.vars.dept_id)
>
> response.flash = 'new record inserted'
> elif form.errors:
> response.flash = 'invalid values in form'
>
> records =
> SQLTABLE(db().select(db.meter.ALL),headers='fieldname:capitalize')
> return dict(form=form, records=records)
>
>
>
> It is a function in the default.py for inserting the values. The error is
> a syntax error which im not able to debug. Kindly guide me thru the issue.
> the syntax error is at the line ' if form.accepted:'  May be the error is
> at some other line which i cant find out.
>
> Thanks !
> kartik
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Migrating a hude database from Spring to web2py

2014-01-09 Thread Tushar Tuteja
I have a J2EE application and a database which has 200 tables in it.
I want to develop a new application using web2py, which would use only 5 
tables.
I want to know how should I go about it. As I am not clear about how I 
would use database without mapping all the 200 tables which is a huge task.
and I don't want web2py to make any changes on the database tables and 
their schema.
only crud operations on the records of the 5 tables.
 
Thanks,
Regards,
Tushar Tuteja

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Hi there Web2ppy noob here

2014-01-09 Thread Alan Etkin

>
> form = SQLFORM.factory(
> Field('meter_num',requires=IS_IN_DB(db,db.meter)),
> Field('meter_type',requires=IS_IN_DB(db,db.meter)),
> Field('dept_id',requires=IS_IN_DB(db,db.dept.id,'%(dept_id)s'))
>

You have missed the closing parenthesis for the .factory method.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] syntax error in code

2014-01-09 Thread kartik murthy
Hi there,
I am building an app to store electrical consumption data . I 
have build a database which include three tabled dept,meter and reading. 
THe problem that i have encountered is with the syntax in the following 
code:



def reg_meter():
form = SQLFORM.factory(
Field('meter_num',requires=IS_IN_DB(db,db.meter)),
Field('meter_type',requires=IS_IN_DB(db,db.meter)),

Field('dept_id',requires=IS_IN_DB(db,db.dept.id,'%(dept_id)s')).process()
if form.accepted:
entered = db((db.entered.meter_num == form.vars.meter_num) & 
(db.entered.meter_type == form.vars.meter_type) & (db.entered.dept_id == 
form.vars.dept_id)).select().first()

   if entered:
  entered.update_record((meter_num = 
entered.meter_num+form.vars.meter_num) & (meter_type = 
entered.meter_type+form.vars.meter_type) & (dept_id = 
entered.dept_id+form.vars.dept_id)

   else:
   
db.entered.insert(meter_num=form.vars.meter_num,meter_type=form.vars.meter_type,
dept_id=form.vars.dept_id)

response.flash = 'new record inserted'
elif form.errors:
response.flash = 'invalid values in form'

records = 
SQLTABLE(db().select(db.meter.ALL),headers='fieldname:capitalize')
return dict(form=form, records=records)



It is a function in the default.py for inserting the values. The error is a 
syntax error which im not able to debug. Kindly guide me thru the issue. 
the syntax error is at the line ' if form.accepted:'  May be the error is 
at some other line which i cant find out.

Thanks !
kartik

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Hi there Web2ppy noob here

2014-01-09 Thread kartik murthy
I am tryin to build a web app where in i will be using the app to store 
some data info about electrical units consumed. I have three tables viz. 
dept,meter and reading. The problem here is i wrote a function in the 
default.py for the table meter where in the dept_id is a FK referencing id 
of the table dept. in the below code i get a syntax error on the line ' if 
form.process().accepted: ' I think the error is in some other line which im 
not able to debug., Kindly guide me thru the probllem. The code of func 
goes here. 


def reg_meter():
form = SQLFORM.factory(
Field('meter_num',requires=IS_IN_DB(db,db.meter)),
Field('meter_type',requires=IS_IN_DB(db,db.meter)),
Field('dept_id',requires=IS_IN_DB(db,db.dept.id,'%(dept_id)s'))
if form.process().accepted:
entered = db((db.entered.meter_num == form.vars.meter_num) & 
(db.entered.meter_type == form.vars.meter_type) & (db.entered.dept_id == 
form.vars.dept_id)).select().first()

   if entered:
  entered.update_record((meter_num = 
entered.meter_num+form.vars.meter_num) & (meter_type = 
entered.meter_type+form.vars.meter_type) & (dept_id = 
entered.dept_id+form.vars.dept_id)

   else:
   
db.entered.insert(meter_num=form.vars.meter_num,meter_type=form.vars.meter_type,
dept_id=form.vars.dept_id)

response.flash = 'new record inserted'
elif form.errors:
response.flash = 'invalid values in form'

records = 
SQLTABLE(db().select(db.meter.ALL),headers='fieldname:capitalize')
return dict(form=form, records=records)

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Web2py Integration with Sentry

2014-01-09 Thread James Q
Interesting. I have never written wsgi middleware, any pointers on that? As 
middleware, I would still need to have an understanding of how to detect if 
an exception has been logged in the request, no?

Thanks!

-- J

On Tuesday, January 7, 2014 8:24:14 PM UTC-5, Derek wrote:
>
> I haven't, but I've done something similar with a different piece of 
> software. You'd usually just use it as a wsgi middleware around your app. 
> So you'd need to run web2py as wsgi and wrap it with Sentry.
>
> On Monday, January 6, 2014 8:14:46 PM UTC-7, James Q wrote:
>>
>> Has anyone ever integrated web2py an Sentry (
>> https://github.com/getsentry/sentry)? I would like it if all web2py 
>> generated exceptions generate a ticket like usual, but also generates an 
>> event to a sentry server. Has anyone ever done this? If not, could anyone 
>> point to where I would need to patch web2py or how best this integration 
>> would work?
>>
>> Thanks for any help!
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Sqllite Database backup and recover

2014-01-09 Thread Sharjeel Ali Shaukat


I want to make backup of storage.sqllite database let say  backstorage.sqllite 
then i want to fill new database tables with backup database 

insert values from backupdatabase to new database ur help is required

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Learning Management System survey

2014-01-09 Thread Alan Etkin

>
> Any news on progress?
>

Check Pyodel

http://code.google.com/p/pyodel

There's a working prototype available and an online demo at 
http://pyodel.appspot.com

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Learning Management System survey

2014-01-09 Thread Jesus Alvaro
Any news on progress?

El sábado, 8 de enero de 2011 22:40:01 UTC+1, Anthony escribió:
>
> Looks like there's a lot of dissatisfaction with Blackboard (and Moodle):
>  
> http://www.reddit.com/r/programming/comments/eye4y/shame_on_you_blackboard/
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.