[web2py] Re: Need opinions/reviews about embedded jquery/javascript XHTML editor

2014-01-16 Thread Simon Ashley
Just to save you a little bit of time:

def advanced_editor(field, value):
return TEXTAREA(_id=str(field).replace('.', '_'), _name=field.name,_class
='text ckeditor',
_contenteditable='true', _toolbarStartupExpanded='false'
, value=XML(value), _cols=80)

Field('description','text',widget=advanced_editor ),

.description.represent = lambda v, r: XML(v);






On Thursday, 16 January 2014 17:23:18 UTC+10, weheh wrote:

 Good to hear that, since I just downloaded it. THANKS. Any more opinions?

 On Thursday, January 16, 2014 2:18:35 PM UTC+8, Simon Ashley wrote:

 +1 CKeditor seems to work fine, generically linked to text based widgets 
 in models. No heavy demands/ extensions through.



-- 
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: Need opinions/reviews about embedded jquery/javascript XHTML editor

2014-01-16 Thread Annet
I am using CKeditor as well, mainly because its basic version suits my 
needs, and in case I need other features its easily extendible. Furthermore
it really is WYSIWYG. In case of TinyMCE I had to write my own style sheet 
to make the editor match my application's styling.

In the past I also tried NicEdit, at the time it inserted div/div 
elements instead of p/p elements.

I hope this is helpful,

Annet

-- 
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: Bug in DAL with SQLFORM, upload field and required field ???

2014-01-16 Thread Ivan Gazzola

The value for dentista is correct, is equal to Nominativi.id selected in 
drop-down list.
When I insert or update the record with 'logo' empty the query is generated 
with '' instead of NULL and sqlite cannot parse the full query.
if I update with db.Consulenze.insert(dentista=1240) it woks.



Il giorno giovedì 16 gennaio 2014 00:00:41 UTC+1, Anthony ha scritto:

 What value of dentista is being inserted, and have you confirmed that that 
 value is the id of one of the records in the Nominativi table?

 On Wednesday, January 15, 2014 5:56:18 PM UTC-5, Ivan Gazzola wrote:

 I've this table:
 db.define_table(Consulenze,
 Field('dentista','reference Nominativi', required=True),
 Field('data_inizio_collaborazione','date'),
 Field('data_fine_collaborazione','date'),
 Field  ('percentuale','integer'),
 Field('logo','upload'))

 In console insert and update works but if i try to insert from SQLFORM 
 without specifying the upload field I get this error:
 class 'sqlite3.IntegrityError' foreign key constraint failed
 and the query generated is:

 INSERT INTO Consulenze(logo,data_inizio_collabor...sta,percentuale) 
 VALUES ('',NULL,NULL,1240,NULL);
   
   ^^ --I think 
 this is wrong and cuts the query before the required field!!!
 If I comment the upload file 'logo' all works fine 

 



-- 
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: upload e CASCADE delete

2014-01-16 Thread maurizio
Thanks Anthony, I think you're right,
solution should be that after check 
ondelete='CASCADE' and 
check autodelete=True, 
default _before_delete erase the associated files in uploads folder.

I posted an issue on Google Gode (n.1854).

Maurizio


Il giorno mercoledì 15 gennaio 2014 15:39:07 UTC+1, Anthony ha scritto:

 The cascading delete is handled by the database, so the web2py DAL is not 
 executing the delete from the db.allegato table and therefore doesn't have 
 the opportunity to run the _before_delete and _after_delete callbacks (the 
 former is used to autodelete uploaded files).

 I suppose you could create a _before_delete callback on the db.prodotto 
 table that does the file deleting. Maybe we could build this in to the 
 default _before_delete callbacks for tables -- it would check the 
 _referenced_by fields for ondelete='CASCADE', then check the referring 
 table for upload fields with autodelete=True, and then delete the 
 associated files (or maybe just run the _before_delete callback of the 
 referring table). You can post an issue on Google Code and reference this 
 thread.

 In the documentation, we should probably note that the _before_delete and 
 _after_delete callbacks of a table will not be run when the delete happens 
 in the database as the result of a cascade.

 Anthony

 On Wednesday, January 15, 2014 4:26:47 AM UTC-5, maurizio wrote:

 Hi all,
 probably due to my incompetence I have the following problem,
 Thank's in advance anyone who wants to help me.

 consider the following code:

 '''
 db.define_table('prodotto',
 Field('nome'),
 format='%(nome)s',
 plural='prodotti')

 db.define_table('allegato',
 Field('descrizione',requires=IS_NOT_EMPTY()),
 Field('documento','upload',autodelete=True),
 Field('prodotto','reference 
 prodotto',writable=False,readable=False),
 format='%(descrizione)s',
 plural='allegati')

 def index():
 grid = SQLFORM.smartgrid(db.prodotto,
 deletable=True,
 editable=True,
 create=True,
 csv=False)
 return dict(grid=grid)

 web2py 2.7.4-stable+timestamp.2013.10.14.15.16.29
 (Running on Rocket 1.2.6, Python 2.7.3) Debian  7.2 (wheezy)
 '''

 Deleting a record from the allegato table, also delete the 
 corresponding file (autodelete=True) in the default /uploads folder.
 Deleting a record from the prodotto master table, also delete all 
 records in the allegato detail table (CASCADE delete), but files in the 
 folder uploads are not erased.

 Any idea?

 thanks again
 Maurizio



-- 
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 usage

2014-01-16 Thread Arnon Marcus
Our schema is quite large (200+ Tables) and changes very seldom.
I was thinking, is there a way to not have to rebuild it in it's entierty on 
every request?
I mean, is there a way to seperate-out the schema definition from the 
connection object? Ideally, I would put the schema definition code in a 
separate module in the modulesz folder, and import it into the model file that 
creates the connecfion, and somehow pass the ready-made schema-object(s) into 
the newly-created connection object on each request.
Can this be done?
What are the gotchas for this (if any)?
Are there restrictions for somed schema-definitions tbat can not be used like 
this?

-- 
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: javascript/openlayers example in web2py

2014-01-16 Thread Miguel Sánchez
Hi Manuele and other members,

I ´m not a programmer,  I come from the Human Sciences, but I´m mounting my 
social project in http://redhumus.org  . I have a lot of issues yet.

I have created the plugin_map in my application to manage gpx tracks from 
openstreetmaps. The deal is create an application that lets people upload a 
gpx track, visualize it ina a teble and in a openlayer from OpenStreetMaps. 

To begin: I have a simple  example here, moving the original simple 
exercise (
http://redhumus.org/mapas/memoria/comunicacioneschilapastrackmap.html)  to 
web2py in https://redhumus.org:8000/redhumus/plugin_mapas/mapa   But I´m 
experiencing problems with it.  

I would appreciate your help and from anyone interested in participate 
supporting me in this new project named ReDHumus because I´m alone and 
the process is too slow.

Thanks a lot.


*My Code:*


*In controllers/plugin_mapas.py :*

# coding: utf8
def mapa():
 return dict()

*In views/plugin_mapas/mapa.html :  ( I have commented your code because I 
didn´t got how to set map height) *









*{{# here I load the necessary openlayers library and style sheets start = 
0 for idx,source in enumerate(( 'openlayers/OpenLayers.js',
 'openlayers/OpenStreetMap.js', 'OpenLayers-2.11/style.css',  )):  
 # response.files.insert(start+idx,URL(request.application,'static',source))  
   response.files.append(URL(request.application,'static',source))pass}}   
!-- script type=text/javascript!--function () {var map, layer;
 map = new OpenLayers.Map('map');layer = new 
OpenLayers.Layer.OSM( Simple OSM Map);map.addLayer(layer);
map.setCenter(new OpenLayers.LonLat(9.147, -72.472).transform(  
  new OpenLayers.Projection(EPSG:4326),
map.getProjectionObject()), 12);}/script -- script 
type=text/javascript // Start position for the map (hardcoded here for 
simplicity, // but maybe you want to get this from the URL params)  
   var lat=4.83091 var lon=-72.696624
 var zoom=12   function init() { var map; //complex object of type 
OpenLayers.Map   map = new OpenLayers.Map (map, {controls:[ new 
OpenLayers.Control.Navigation(), new OpenLayers.Control.PanZoomBar(), new 
OpenLayers.Control.LayerSwitcher(), new OpenLayers.Control.Attribution()],  
 // maxExtent: new 
OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),  
 //maxResolution: 156543.0399,  
 //numZoomLevels: 13,   //units: 'm',  
 //projection: new OpenLayers.Projection(EPSG:900913),
   //displayProjection: new OpenLayers.Projection(EPSG:4326)  
  } );   // Define the map layer // Here we use a predefined 
layer that will be kept up to date with URL changes layerMapnik = new 
OpenLayers.Layer.OSM.Mapnik(Mapnik); map.addLayer(layerMapnik); 
layerCycleMap = new OpenLayers.Layer.OSM.CycleMap(CycleMap); 
map.addLayer(layerCycleMap); layerMarkers = new 
OpenLayers.Layer.Markers(Markers); map.addLayer(layerMarkers);  // Add 
the Layer with the GPX Track var abril18lgpx = new 
OpenLayers.Layer.Vector(Abril 18, { strategies: [new 
OpenLayers.Strategy.Fixed()], protocol: new OpenLayers.Protocol.HTTP({  
  url: tracks/2013-04-18_082438.gpx, format: new 
OpenLayers.Format.GPX() }), style: {strokeColor: green, strokeWidth: 5, 
strokeOpacity: 0.5}, projection: new OpenLayers.Projection(EPSG:4326) }); 
// Add the Layer with the GPX Track var abril23lgpx = new 
OpenLayers.Layer.Vector(Abril 23, { strategies: [new 
OpenLayers.Strategy.Fixed()], protocol: new OpenLayers.Protocol.HTTP({ url: 
tracks/2013-04-23_070052.gpx, format: new OpenLayers.Format.GPX() }), 
style: {strokeColor: blue, strokeWidth: 5, strokeOpacity: 0.5}, 
projection: new OpenLayers.Projection(EPSG:4326) }); // Add the Layer 
with the GPX Track var abril24lgpx = new OpenLayers.Layer.Vector(Abril 
24, { strategies: [new OpenLayers.Strategy.Fixed()], protocol: new 
OpenLayers.Protocol.HTTP({ url: tracks/2013-04-24_071627.gpx, format: new 
OpenLayers.Format.GPX() }), style: {strokeColor: red, strokeWidth: 5, 
strokeOpacity: 0.5}, projection: new OpenLayers.Projection(EPSG:4326) }); 
// Add the Layer with the GPX Track var abril21lgpx = new 
OpenLayers.Layer.Vector(Abril 21, { strategies: [new 
OpenLayers.Strategy.Fixed()], protocol: new OpenLayers.Protocol.HTTP({ url: 
tracks/2013-04-21_151923_001, format: new OpenLayers.Format.GPX() }), 
style: {strokeColor: blue, strokeWidth: 5, strokeOpacity: 0.5}, 
projection: new OpenLayers.Projection(EPSG:4326) }); // Add the Layer 
with the GPX Track var abril258amlgpx = new OpenLayers.Layer.Vector(Abril 
25 8am, { strategies: [new OpenLayers.Strategy.Fixed()], protocol: new 
OpenLayers.Protocol.HTTP({ url: tracks/2013-04-25_082118.gpx, format: new 
OpenLayers.Format.GPX() }), style: {strokeColor: 

[web2py] Re: Bug in DAL with SQLFORM, upload field and required field ???

2014-01-16 Thread Ivan Gazzola
I found the code in sqlhtml.py, the empty upload value is '' or default

elif field.type == 'upload':
f = self.vars[fieldname]
fd = '%s__delete' % fieldname
if f == '' or f is None:
if self.vars.get(fd, False):
f = self.table[fieldname].default or ''
fields[fieldname] = f
elif self.record:
if self.record[fieldname]:
fields[fieldname] = self.record[fieldname]
else:
f = self.table[fieldname].default or ''
fields[fieldname] = f
else:
f = self.table[fieldname].default or ''
fields[fieldname] = f
self.vars[fieldname] = fields[fieldname]
if not f:
continue
else:


-- 
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] Redis caching

2014-01-16 Thread Arnon Marcus
I noticed that the current implementation for web2py uses pickles.
That is a design choice. There are pros and cons.
Right off of my head, the biggest cons may be retricting cache-use to python, 
and performance penalties.
When I think of all that redis can do, I can not help imagining a better 
solution - especially for caching query results.
All result-sets are flat and simple in nature - before the dal steps in and 
converts them to row objects. This makes it an ideal candidate for redis.
Has anyone thought of this already?
A simplistic (naive) solution aould be to store every result in a hash, and 
stlre all the ids in a sorted set. This way, the result-sef in the cache may be 
queried by redis, and not necessarily be pulled in an all-or-nothing fasion, 
improving read-performance and resources dramatically, while opening the 
possibilities for external non-python processes to access the cache talking to 
redis directly.
It may not be desierable for all use-cases, as there are obviouse security 
concearns, but for ipc stuff and/or intranet applications (which are a common 
use-case in the web2py world), this can be most beneficial.
What do you say?

-- 
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] web2py and PostgreSQL drivers

2014-01-16 Thread Jayadevan M
I was using pg8000 with web2py. Recently I installed psycopg2. But web2py 
is still using pg8000. What could be the reason? The script to start web2py 
in admin mode has the following - 

source /opt/python2.7/bin/activate
which python
python -V
pip freeze
/var/www/web2py/web2py.py  -a password -p 8000

Here is the output from  script which also prints python version, path and 
pip freeze before starting web2py.

/opt/python2.7/bin/python
Python 2.7.5
RunSnakeRun==2.0.4
SquareMap==1.0.3
psycopg2==2.5.2
simplejson==3.3.1
uWSGI==1.9.20
uwsgitop==0.6.2
wsgiref==0.1.2
wxPython==2.8.12.1
wxPython-common==2.8.12.1
web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2014
Version 2.8.2-stable+timestamp.2013.11.28.13.54.07
Database drivers available: SQLite(sqlite3), MySQL(pymysql), 
PostgreSQL(pg8000), IMAP(imaplib)

-- 
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 and PostgreSQL drivers

2014-01-16 Thread Jayadevan M
Looks like the import psycopg2 was failing in dal.py. I tried the command 
from command line (python) and got an error. I had installed PostgreSQL 
libraries in a non-default directory. The following fixed it -
 export LD_LIBRARY_PATH=/opt/pg/9.3/lib:/usr/local/lib

On Thursday, January 16, 2014 3:28:11 PM UTC+5:30, Jayadevan M wrote:

 I was using pg8000 with web2py. Recently I installed psycopg2. But web2py 
 is still using pg8000. What could be the reason? The script to start web2py 
 in admin mode has the following - 

 source /opt/python2.7/bin/activate
 which python
 python -V
 pip freeze
 /var/www/web2py/web2py.py  -a password -p 8000

 Here is the output from  script which also prints python version, path and 
 pip freeze before starting web2py.

 /opt/python2.7/bin/python
 Python 2.7.5
 RunSnakeRun==2.0.4
 SquareMap==1.0.3
 psycopg2==2.5.2
 simplejson==3.3.1
 uWSGI==1.9.20
 uwsgitop==0.6.2
 wsgiref==0.1.2
 wxPython==2.8.12.1
 wxPython-common==2.8.12.1
 web2py Web Framework
 Created by Massimo Di Pierro, Copyright 2007-2014
 Version 2.8.2-stable+timestamp.2013.11.28.13.54.07
 Database drivers available: SQLite(sqlite3), MySQL(pymysql), 
 PostgreSQL(pg8000), IMAP(imaplib)



-- 
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] ultramemcache

2014-01-16 Thread Arnon Marcus
We are using gevent, and we want to use memcached (for now, before we 
upgrade web2py to a version that supports redis...)
I've noticed that there is threading going on in the gluon.memcache package 
- would this work with gevent?

This package is specifically meant for using memcached from a gevent 
process:
https://github.com/esnme/ultramemcache

Can I make the existing gluon.memcache use this instead?
Has anybody tried it?


-- 
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: crud form errors

2014-01-16 Thread sasogeek
How do I highlight the fields with errors though? like it appears in the 
tutorials? example please.

On Wednesday, 15 January 2014 14:41:11 UTC, Anthony wrote:

 Error messages are in form.errors.fieldname (if it is None, there is no 
 error for that field).

 On Wednesday, January 15, 2014 8:49:23 AM UTC-5, sasogeek wrote:

 I have a crud login and registration form with my own html, I don't 
 extend the layout.html. How do I display the form errors when a user 
 submits empty or invalid inputs?



-- 
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: crud form errors

2014-01-16 Thread Anthony
It's up to you to code and style it as you like. Here's how web2py does it: 
https://github.com/web2py/web2py/blob/master/gluon/html.py#L1826. If you 
want it exactly as web2py does it, then just use 
form.custom.widget.fieldname instead of completely manual HTML. See 
http://web2py.com/books/default/chapter/29/07/forms-and-validators#Custom-forms
.

Anthony

On Thursday, January 16, 2014 8:12:24 AM UTC-5, sasogeek wrote:

 How do I highlight the fields with errors though? like it appears in the 
 tutorials? example please.

 On Wednesday, 15 January 2014 14:41:11 UTC, Anthony wrote:

 Error messages are in form.errors.fieldname (if it is None, there is no 
 error for that field).

 On Wednesday, January 15, 2014 8:49:23 AM UTC-5, sasogeek wrote:

 I have a crud login and registration form with my own html, I don't 
 extend the layout.html. How do I display the form errors when a user 
 submits empty or invalid inputs?



-- 
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: Bug in DAL with SQLFORM, upload field and required field ???

2014-01-16 Thread Anthony
I cannot reproduce the problem. Can you pack and attach an app the exhibits 
the problem?

On Thursday, January 16, 2014 3:23:24 AM UTC-5, Ivan Gazzola wrote:


 The value for dentista is correct, is equal to Nominativi.id selected in 
 drop-down list.
 When I insert or update the record with 'logo' empty the query is 
 generated with '' instead of NULL and sqlite cannot parse the full query.
 if I update with db.Consulenze.insert(dentista=1240) it woks.



 Il giorno giovedì 16 gennaio 2014 00:00:41 UTC+1, Anthony ha scritto:

 What value of dentista is being inserted, and have you confirmed that 
 that value is the id of one of the records in the Nominativi table?

 On Wednesday, January 15, 2014 5:56:18 PM UTC-5, Ivan Gazzola wrote:

 I've this table:
 db.define_table(Consulenze,
 Field('dentista','reference Nominativi', required=True),
 Field('data_inizio_collaborazione','date'),
 Field('data_fine_collaborazione','date'),
 Field  ('percentuale','integer'),
 Field('logo','upload'))

 In console insert and update works but if i try to insert from SQLFORM 
 without specifying the upload field I get this error:
 class 'sqlite3.IntegrityError' foreign key constraint failed
 and the query generated is:

 INSERT INTO Consulenze(logo,data_inizio_collabor...sta,percentuale) 
 VALUES ('',NULL,NULL,1240,NULL);
 
 ^^ --I think 
 this is wrong and cuts the query before the required field!!!
 If I comment the upload file 'logo' all works fine 

 



-- 
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: Need opinions/reviews about embedded jquery/javascript XHTML editor

2014-01-16 Thread Anthony
If you don't want to have to replicate web2py's automatic id and name 
attribute generation, you should also be able to do something like:

def advanced_editor(field, value):
return SQLFORM.widgets.text.widget(field, XML(value), _class='text 
ckeditor',
_contenteditable='true', _toolbarStartupExpanded='false', _cols=80)

Anthony

On Thursday, January 16, 2014 2:59:24 AM UTC-5, Simon Ashley wrote:

 Just to save you a little bit of time:

 def advanced_editor(field, value):
 return TEXTAREA(_id=str(field).replace('.', '_'), _name=field.name,_class
 ='text ckeditor',
 _contenteditable='true', _toolbarStartupExpanded=
 'false', value=XML(value), _cols=80)

 Field('description','text',widget=advanced_editor ),

 .description.represent = lambda v, r: XML(v);




-- 
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] Upload file functionality

2014-01-16 Thread LaDarrius Stewart
I thought I was on the correct path with this can soemone tell me where 
this is going wrong?

db.define_table('consumer',
Field 
http://127.0.0.1:8000/examples/global/vars/Field('lname','string', 
requires=IS_NOT_EMPTY 
http://127.0.0.1:8000/examples/global/vars/IS_NOT_EMPTY()),
Field 
http://127.0.0.1:8000/examples/global/vars/Field('fname','string', 
requires=IS_NOT_EMPTY 
http://127.0.0.1:8000/examples/global/vars/IS_NOT_EMPTY()),
Field 
http://127.0.0.1:8000/examples/global/vars/Field('address','string'),
Field 
http://127.0.0.1:8000/examples/global/vars/Field('city','string'),
Field 
http://127.0.0.1:8000/examples/global/vars/Field('stayte','string'),
Field 
http://127.0.0.1:8000/examples/global/vars/Field('zip','string'),
Field 
http://127.0.0.1:8000/examples/global/vars/Field('h_phone','string'),
Field 
http://127.0.0.1:8000/examples/global/vars/Field('c_phone','string'),
Field 
http://127.0.0.1:8000/examples/global/vars/Field('adm_date','date'),
Field 
http://127.0.0.1:8000/examples/global/vars/Field('dob','date'),
Field 
http://127.0.0.1:8000/examples/global/vars/Field('pod','string'),
auth.signature, #creates fields: created_on, created_by, 
modified_on, modified by, is_active
format= lambda r: r.fname + ' ' + r.lname  #substitutes 
consumer.id for consumer name
)
db.define_table('files',
Field 
http://127.0.0.1:8000/examples/global/vars/Field('name', unique=True, 
length=255),
Field 
http://127.0.0.1:8000/examples/global/vars/Field('phile', 'upload', 
custom_store=lambda file, filename, path: store_file(file, filename, path), 
custom_retrieve=lambda filename, path: retrieve_file(filename, path) ),
Field 
http://127.0.0.1:8000/examples/global/vars/Field('consumerid', 'reference 
consumer'),
auth.signature)

def store_file(file, filename=None, path=None):
path = applications/facesheet/uploads
if not os.path.exists(path):
 os.makedirs(path)
pathfilename = os.path.join(path, filename)
dest_file = open(pathfilename, 'wb')
try:
shutil.copyfileobj(file, dest_file)
finally:
dest_file.close()
return filename
def retrieve_file(filename, path=None):
path = applications/facesheet/uploads
return (filename, open(os.path.join(path, filename), 'rb'))

def upload():
var = request http://127.0.0.1:8000/examples/global/vars/request.args(0)
var1 = request http://127.0.0.1:8000/examples/global/vars/request.args(1)
var2 = request http://127.0.0.1:8000/examples/global/vars/request.args(2)
form=SQLFORM http://127.0.0.1:8000/examples/global/vars/SQLFORM(db.files, 
upload=URL http://127.0.0.1:8000/examples/global/vars/URL(download))
form.vars.consumerid = var
if form.process().accepted:
response http://127.0.0.1:8000/examples/global/vars/response.flash = 
files updated
query=(db.files.consumerid==var)
form2=SQLFORM 
http://127.0.0.1:8000/examples/global/vars/SQLFORM.grid(query, args=[var, 
var1, var2], paginate=1, details=False, searchable=False, editable=False, 
csv=False, create=False, deletable=False, user_signature=False)
return locals()

def download():
if not request http://127.0.0.1:8000/examples/global/vars/request.args:
raise HTTP http://127.0.0.1:8000/examples/global/vars/HTTP(404)
name = request http://127.0.0.1:8000/examples/global/vars/request.args[-1]
field = db[files][phile]
try:
(filename, file) = field.retrieve(name)
except IOError:
raise HTTP http://127.0.0.1:8000/examples/global/vars/HTTP(404)
#response.headers[Content-Type] = c.contenttype(name)
response 
http://127.0.0.1:8000/examples/global/vars/response.headers[Content-Disposition]
 = attachment; filename=%s % name
stream = response 
http://127.0.0.1:8000/examples/global/vars/response.stream(file, 
chunk_size=64*1024, request 
http://127.0.0.1:8000/examples/global/vars/request=request 
http://127.0.0.1:8000/examples/global/vars/request)
raise HTTP http://127.0.0.1:8000/examples/global/vars/HTTP(200, stream, 
**response http://127.0.0.1:8000/examples/global/vars/response.headers)

*The upload functionality is working fine stores the relative information in 
the database*

*and saves the file on the server which i wanted the problem is when someone 
clicks on the file *

*from the form2 within the upload method. The link is 
**http://127.0.0.1:8000/facesheet/default/upload/1/John/Smith/download/test3.docx.*

*This brings back a 404 tried so many different examples on the web the few 
that are out there atleast*

*but I keep running into a brick wall. Thank You in advance.*

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

[web2py] Adrian and Jacob retiring as Django BDFLs

2014-01-16 Thread Michele Comitini
Not directly related to web2py.

Django moves to full community mode.

http://www.holovaty.com/writing/bdfls-retiring/

-- 
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: Upload file functionality

2014-01-16 Thread LaDarrius Stewart
Looking at my custom retrieve file shouldnt the path be looking in here path = 
applications/facesheet/uploads

On Thursday, January 16, 2014 10:25:21 AM UTC-6, LaDarrius Stewart wrote:

 I thought I was on the correct path with this can soemone tell me where 
 this is going wrong?

 db.define_table('consumer',
 Field 
 http://127.0.0.1:8000/examples/global/vars/Field('lname','string', 
 requires=IS_NOT_EMPTY 
 http://127.0.0.1:8000/examples/global/vars/IS_NOT_EMPTY()),
 Field 
 http://127.0.0.1:8000/examples/global/vars/Field('fname','string', 
 requires=IS_NOT_EMPTY 
 http://127.0.0.1:8000/examples/global/vars/IS_NOT_EMPTY()),
 Field 
 http://127.0.0.1:8000/examples/global/vars/Field('address','string'),
 Field 
 http://127.0.0.1:8000/examples/global/vars/Field('city','string'),
 Field 
 http://127.0.0.1:8000/examples/global/vars/Field('stayte','string'),
 Field 
 http://127.0.0.1:8000/examples/global/vars/Field('zip','string'),
 Field 
 http://127.0.0.1:8000/examples/global/vars/Field('h_phone','string'),
 Field 
 http://127.0.0.1:8000/examples/global/vars/Field('c_phone','string'),
 Field 
 http://127.0.0.1:8000/examples/global/vars/Field('adm_date','date'),
 Field 
 http://127.0.0.1:8000/examples/global/vars/Field('dob','date'),
 Field 
 http://127.0.0.1:8000/examples/global/vars/Field('pod','string'),
 auth.signature, #creates fields: created_on, created_by, 
 modified_on, modified by, is_active
 format= lambda r: r.fname + ' ' + r.lname  #substitutes 
 consumer.id for consumer name
 )
 db.define_table('files',
 Field 
 http://127.0.0.1:8000/examples/global/vars/Field('name', unique=True, 
 length=255),
 Field 
 http://127.0.0.1:8000/examples/global/vars/Field('phile', 'upload', 
 custom_store=lambda file, filename, path: store_file(file, filename, path), 
 custom_retrieve=lambda filename, path: retrieve_file(filename, path) ),
 Field 
 http://127.0.0.1:8000/examples/global/vars/Field('consumerid', 'reference 
 consumer'),
 auth.signature)

 def store_file(file, filename=None, path=None):
 path = applications/facesheet/uploads
 if not os.path.exists(path):
  os.makedirs(path)
 pathfilename = os.path.join(path, filename)
 dest_file = open(pathfilename, 'wb')
 try:
 shutil.copyfileobj(file, dest_file)
 finally:
 dest_file.close()
 return filename
 def retrieve_file(filename, path=None):
 path = applications/facesheet/uploads
 return (filename, open(os.path.join(path, filename), 'rb'))

 def upload():
 var = request http://127.0.0.1:8000/examples/global/vars/request.args(0)
 var1 = request 
 http://127.0.0.1:8000/examples/global/vars/request.args(1)
 var2 = request 
 http://127.0.0.1:8000/examples/global/vars/request.args(2)
 form=SQLFORM 
 http://127.0.0.1:8000/examples/global/vars/SQLFORM(db.files, upload=URL 
 http://127.0.0.1:8000/examples/global/vars/URL(download))
 form.vars.consumerid = var
 if form.process().accepted:
 response http://127.0.0.1:8000/examples/global/vars/response.flash 
 = files updated
 query=(db.files.consumerid==var)
 form2=SQLFORM 
 http://127.0.0.1:8000/examples/global/vars/SQLFORM.grid(query, args=[var, 
 var1, var2], paginate=1, details=False, searchable=False, editable=False, 
 csv=False, create=False, deletable=False, user_signature=False)
 return locals()

 def download():
 if not request http://127.0.0.1:8000/examples/global/vars/request.args:
 raise HTTP http://127.0.0.1:8000/examples/global/vars/HTTP(404)
 name = request 
 http://127.0.0.1:8000/examples/global/vars/request.args[-1]
 field = db[files][phile]
 try:
 (filename, file) = field.retrieve(name)
 except IOError:
 raise HTTP http://127.0.0.1:8000/examples/global/vars/HTTP(404)
 #response.headers[Content-Type] = c.contenttype(name)
 response 
 http://127.0.0.1:8000/examples/global/vars/response.headers[Content-Disposition]
  = attachment; filename=%s % name
 stream = response 
 http://127.0.0.1:8000/examples/global/vars/response.stream(file, 
 chunk_size=64*1024, request 
 http://127.0.0.1:8000/examples/global/vars/request=request 
 http://127.0.0.1:8000/examples/global/vars/request)
 raise HTTP http://127.0.0.1:8000/examples/global/vars/HTTP(200, stream, 
 **response http://127.0.0.1:8000/examples/global/vars/response.headers)

 *The upload functionality is working fine stores the relative information in 
 the database*

 *and saves the file on the server which i wanted the problem is when someone 
 clicks on the file *

 *from the form2 within the upload method. The link is 
 **http://127.0.0.1:8000/facesheet/default/upload/1/John/Smith/download/test3.docx
 

[web2py] Re: Upload file functionality

2014-01-16 Thread Anthony
Where/how is this link generated: 
*http://127.0.0.1:8000/facesheet/default/upload/1/John/Smith/download/test3.docx
 
http://127.0.0.1:8000/facesheet/default/upload/1/John/Smith/download/test3.docx*

Why do you need the custom store and retrieve functions -- what's wrong 
with the built-in methods?


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.


[web2py] Re: Markmin components

2014-01-16 Thread Janko Strusa
How can I implement this in a view. I am not sure how to call that markmin 
action to be used instead of MARKMIN helper.

Dana srijeda, 8. svibnja 2013. 17:23:24 UTC+2, korisnik Massimo Di Pierro 
napisao je:

 There is an official syntax for this. 

 @{component:controller/function/args}

 To enable this and enable OEMBED I do:

 def markmin(body):
 from gluon.contrib.autolinks import expand_one
 def component(text):
 items = text.split('/')
 controller, function, args = items[0], items[1], items[2:]
 return LOAD(controller, function, args=args, ajax=True).xml()
 return MARKMIN(body, url=True, environment={'component':component},
autolinks=lambda link: expand_one(link, {})).xml()
 db.table.field.represent = lambda v,r: markmin(v or '')

 This is done automatically by auth.wiki()

 Massimo

 On Wednesday, 8 May 2013 09:16:21 UTC-5, villas wrote:

 For anyone interested in my monologue... 

 Function to my previous ideas,  a function as follows could handle both 
 internal and external URLs.  
 I also included a simple check for allowed domains:

 def __component(text):
 if text and text.lower().strip().startswith('http'):
 from urlparse import urlparse   
 allowed_domains = [
  'www.domain1.com', 
  'www.domain2.com', 
]
 if allowed_domains and not any(i in urlparse(text)[1] for i 
 inallowed_domains
 ): 
 return H1('domain not allowed').xml()
 else:
 return LOAD(url=text, ajax=True).xml()
 else:
 items = text.split('/')
 controller, function, args = items[0], items[1], items[2:]
 return LOAD(controller, function, args=args, ajax=True).xml()

 MARKMIN(mytext,url=True,extra=dict(component = lambda value: __component(
 value)))

 In our Markmin we can then include...

 ``http://www.domain1.com/app/mycont/myfunc/arg1``:componenthttp://www.domain1.com/app/mycont/myfunc/arg1:component

 and/or

 ``mycont/myfunc/arg1``:component

 .  
 Maybe someone has other better, or more flexibile, ideas?


 On Wednesday, May 8, 2013 2:09:28 AM UTC+1, villas wrote:

 I can do something like this...
 mytext = 

 ``default/get_cms_article/4``:component

 

 def __component(text):
 items = text.split('/')
 controller, function, args = items[0], items[1], items[2:]
 return LOAD(controller, function, args=args, ajax=True).xml()

 MARKMIN_ENV = dict( 
 component = lambda value: __component(value)
 )  

 MARKMIN(mytext,url=True,extra=MARKMIN_ENV)


 This uses LOAD.  What is recommended for loading components from other 
 domains?  I think I have used JSON for that in the past,  but maybe there 
 are other ways,  I am not sure that I am using the currently recommended 
 methods for Markmin.

 Thanks!





-- 
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: Upload file functionality

2014-01-16 Thread LaDarrius Stewart

from the form2 in the upload method above is how the link is made and the 
custom store retrieve was from an example on the web there isnt many.
But its like its not even using the custom retrieve cause why is looking 
there for the file. Is there and example of using the built in way?

On Thursday, January 16, 2014 10:25:21 AM UTC-6, LaDarrius Stewart wrote:

 I thought I was on the correct path with this can soemone tell me where 
 this is going wrong?

 db.define_table('consumer',
 Field 
 http://127.0.0.1:8000/examples/global/vars/Field('lname','string', 
 requires=IS_NOT_EMPTY 
 http://127.0.0.1:8000/examples/global/vars/IS_NOT_EMPTY()),
 Field 
 http://127.0.0.1:8000/examples/global/vars/Field('fname','string', 
 requires=IS_NOT_EMPTY 
 http://127.0.0.1:8000/examples/global/vars/IS_NOT_EMPTY()),
 Field 
 http://127.0.0.1:8000/examples/global/vars/Field('address','string'),
 Field 
 http://127.0.0.1:8000/examples/global/vars/Field('city','string'),
 Field 
 http://127.0.0.1:8000/examples/global/vars/Field('stayte','string'),
 Field 
 http://127.0.0.1:8000/examples/global/vars/Field('zip','string'),
 Field 
 http://127.0.0.1:8000/examples/global/vars/Field('h_phone','string'),
 Field 
 http://127.0.0.1:8000/examples/global/vars/Field('c_phone','string'),
 Field 
 http://127.0.0.1:8000/examples/global/vars/Field('adm_date','date'),
 Field 
 http://127.0.0.1:8000/examples/global/vars/Field('dob','date'),
 Field 
 http://127.0.0.1:8000/examples/global/vars/Field('pod','string'),
 auth.signature, #creates fields: created_on, created_by, 
 modified_on, modified by, is_active
 format= lambda r: r.fname + ' ' + r.lname  #substitutes 
 consumer.id for consumer name
 )
 db.define_table('files',
 Field 
 http://127.0.0.1:8000/examples/global/vars/Field('name', unique=True, 
 length=255),
 Field 
 http://127.0.0.1:8000/examples/global/vars/Field('phile', 'upload', 
 custom_store=lambda file, filename, path: store_file(file, filename, path), 
 custom_retrieve=lambda filename, path: retrieve_file(filename, path) ),
 Field 
 http://127.0.0.1:8000/examples/global/vars/Field('consumerid', 'reference 
 consumer'),
 auth.signature)

 def store_file(file, filename=None, path=None):
 path = applications/facesheet/uploads
 if not os.path.exists(path):
  os.makedirs(path)
 pathfilename = os.path.join(path, filename)
 dest_file = open(pathfilename, 'wb')
 try:
 shutil.copyfileobj(file, dest_file)
 finally:
 dest_file.close()
 return filename
 def retrieve_file(filename, path=None):
 path = applications/facesheet/uploads
 return (filename, open(os.path.join(path, filename), 'rb'))

 def upload():
 var = request http://127.0.0.1:8000/examples/global/vars/request.args(0)
 var1 = request 
 http://127.0.0.1:8000/examples/global/vars/request.args(1)
 var2 = request 
 http://127.0.0.1:8000/examples/global/vars/request.args(2)
 form=SQLFORM 
 http://127.0.0.1:8000/examples/global/vars/SQLFORM(db.files, upload=URL 
 http://127.0.0.1:8000/examples/global/vars/URL(download))
 form.vars.consumerid = var
 if form.process().accepted:
 response http://127.0.0.1:8000/examples/global/vars/response.flash 
 = files updated
 query=(db.files.consumerid==var)
 form2=SQLFORM 
 http://127.0.0.1:8000/examples/global/vars/SQLFORM.grid(query, args=[var, 
 var1, var2], paginate=1, details=False, searchable=False, editable=False, 
 csv=False, create=False, deletable=False, user_signature=False)
 return locals()

 def download():
 if not request http://127.0.0.1:8000/examples/global/vars/request.args:
 raise HTTP http://127.0.0.1:8000/examples/global/vars/HTTP(404)
 name = request 
 http://127.0.0.1:8000/examples/global/vars/request.args[-1]
 field = db[files][phile]
 try:
 (filename, file) = field.retrieve(name)
 except IOError:
 raise HTTP http://127.0.0.1:8000/examples/global/vars/HTTP(404)
 #response.headers[Content-Type] = c.contenttype(name)
 response 
 http://127.0.0.1:8000/examples/global/vars/response.headers[Content-Disposition]
  = attachment; filename=%s % name
 stream = response 
 http://127.0.0.1:8000/examples/global/vars/response.stream(file, 
 chunk_size=64*1024, request 
 http://127.0.0.1:8000/examples/global/vars/request=request 
 http://127.0.0.1:8000/examples/global/vars/request)
 raise HTTP http://127.0.0.1:8000/examples/global/vars/HTTP(200, stream, 
 **response http://127.0.0.1:8000/examples/global/vars/response.headers)

 *The upload functionality is working fine stores the relative information in 
 the database*

 *and saves the file on the server which i wanted the problem is 

Re: [web2py] Re: Web2py Integration with Sentry

2014-01-16 Thread James Q
Great. I won't be able to get to this soon, but I assume the standard
process: git clone, make change and make a pull request?

-- james
On Jan 15, 2014 12:17 PM, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:

 Always. :-)

 Rules are simple. I always take a patch if:
 1) fixes a security issue OR
 2) does not break backward compatibility AND
 3) makes web2py faster OR
 4) add a new functionality without making previous behavior slower

 On Wednesday, 15 January 2014 00:41:54 UTC-6, James Q wrote:

 Massimo: Would you consider taking a patch / pull request for a new
 script?

 -- James

 On Thursday, January 9, 2014 9:16:02 AM UTC-5, Massimo Di Pierro wrote:

 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 a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/cYXGl7rlvKQ/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] Can I/how would I create a self-signed certificate using IIS?

2014-01-16 Thread Keith Planer
I'm trying to get remote admin working for my web2py server. I followed 
instructions from 
herehttp://www.howtogeek.com/107415/it-how-to-create-a-self-signed-security-ssl-certificate-and-deploy-it-to-client-machines/
 which 
didn't work for me, I got Error opening metabse: 0x80040154 when I tried 
running the selfssl command in the first step. Then I tried creating the 
certificate in IIS Manager, but I'm not sure how to make the certificate 
associate with my app, which I still have running from the web2py server.

-- 
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: Can I/how would I create a self-signed certificate using IIS?

2014-01-16 Thread Keith Planer
I understand this link might have some guidance for me, but the link is 
down: http://www.web2py.com/AlterEgo/default/show/140

-- 
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: Upload file functionality

2014-01-16 Thread Anthony
On Thursday, January 16, 2014 12:29:11 PM UTC-5, LaDarrius Stewart wrote:


 from the form2 in the upload method above is how the link is made and the 
 custom store retrieve was from an example on the web there isnt many.
 But its like its not even using the custom retrieve cause why is looking 
 there for the file.


For upload fields, the grid constructs a default link, which simply appends 
/download/filename to the grid URL. When that URL is requested, the grid 
itself handles the download by calling response.download(). 
response.download() will call field.retrieve(), which will call your 
custom_retrieve method, but the problem is that response.download() expects 
the filename to start with tablename.fieldname, and your custom_store 
method does not do that, so the file is not found.

As an alternative, you can specify your own URL to handle the downloading 
via the upload argument to SQLFORM.grid. However, you're probably better 
off just using the built-in mechanism for uploads/downloads. The custom 
methods are for when you need to do something differently, but you largely 
appear to be replicating the built-in methods (though in a less secure way 
-- no file renaming or checks to prevent directory traversal attacks).
 

 Is there and example of using the built in way?


Just define a field as an upload field, and uploads are handled 
automatically and downloads are easily handled with response.download(). If 
using the grid, everything will just work.

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: Bootstrap3 package - help to test

2014-01-16 Thread Richard Vézina
Seems pretty clean... I would need to use it to find issue though and I am
still with w2p 2.4.7 for now waiting for the new rname feature to be
available (and stable)... Also I build many autocompleting around bootstrap
typeahead that is no longer part of bootstrap... So I have to refactor and
use Typeahead.js that seems the new way to go... So, can't help testing
now... If I make pet project at home I will definitly use this welcome as a
starting point...

Thanks for this contribution Paolo!

Richard


On Wed, Jan 15, 2014 at 6:10 PM, LightDot light...@gmail.com wrote:

 Hm. I expected a flurry of responses by now. I haven't been able to work
 on this since Christmas, but... come on, anyone?? :) I would think a
 possibility of Bootstrap 3 and Zorb Foundation 5 welcome apps would draw
 crowds...

 Anyway, layout.html:
 - web2py.css needs minor adjustments as there are no .main, .footer,
 .footer-content and .header in layout anymore (btw, .push is also obsolete,
 it disappeared almost 2 years ago, when skeleton.css was replaced by
 bootstrap)
 - I did not test this part, but changes in regards to modernizr.custom.js
 and respond.js seem appropriate. I would suggest a free CDN instead of
 maxcdn.com, though. How about
 cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.js ? We could
 suggest the same for Modernizr (
 cdnjs.cloudflare.com/ajax/libs/modernizr/2.7.1/modernizr.min.js) and
 remove it from static/js

 web2py-bootstrap3.css, web2py-bootstrap3.js, bootstrap3.py:
 - I see no issues so far, admittedly my tests were in no way extensive

 licenses:
 - IANAL, so this being my personal and layman opinion, chosen licenses
 seem correct for all intended purposes.

 I'll try and do more tests soon.

 Regards



 On Monday, December 23, 2013 9:20:48 PM UTC+1, Paolo Caruccio wrote:

 I just completed a package that applies the bootstrap3 style to some
 web2py elements - the current version covers the navigation menus, the auth
 navbar and SQLFORMs (via formstyle) - but I need your help for testing it.

 The package includes the following files:

  - bootstrap3.py
  - web2py-bootstrap3.css
  - web2py-bootstrap3.js
  - example of layout.html
  - a readme file containing the istallation and usage instructions
  - license (please report if the license is right for a future inclusion
 in web2py)

 Here attached some screenshots and a web2py app with examples.

 Thank you in advance for your feedbacks, suggestions for optimizing the
 code and any additions and everything else useful to improve the package.

 Marry Christmas.

  --
 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] Caching of Modules

2014-01-16 Thread Mark Graves
I'm trying to import a local module into my application.

I've got the following at the bottom of one of my model files:

from gluon.custom_import import track_changes
track_changes(True)

It still appears to be caching the class definition.  Has any of this code 
changed recently?

Initially I was passing the class a dict of config variables like so:


class ExampleClass:
def __init__(self,config):
self.config = config


When I called it from the controller, it returned the dict.

Then, when I changed the class file to self.config = 1, it was still 
returning the dict.

Deleted the .pyc file and restarted the webserver and it gave me the new 
value.

Am I missing something?

-- 
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: ultramemcache

2014-01-16 Thread Niphlod
no, you can't. But if you want to write your own and the api is compatible, 
just change the imports at the top and hope for the best.

On Thursday, January 16, 2014 12:02:11 PM UTC+1, Arnon Marcus wrote:

 We are using gevent, and we want to use memcached (for now, before we 
 upgrade web2py to a version that supports redis...)
 I've noticed that there is threading going on in the gluon.memcache 
 package - would this work with gevent?

 This package is specifically meant for using memcached from a gevent 
 process:
 https://github.com/esnme/ultramemcache

 Can I make the existing gluon.memcache use this instead?
 Has anybody tried it?




-- 
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: Can I/how would I create a self-signed certificate using IIS?

2014-01-16 Thread Richard Vézina
Except if you need SSL only for your own (as a developper) needs I suggest
you to walk the extra miles and create your own CA and sign you SSL
certificate then you then deploy CA througt GPO with AD and you will not be
bother again about self-signed SSL certificate...

The link here you refer too, seems to talk about what I said... Deploy
self-signed root certificate or CA, not self-signed SSL certificate...

What is important is that your CA be in p12 or PKCS#12 format that containt
the key and the certificate...

To generate certificate you can use these command :

# Create key of root certificate for Certification Authority
openssl genrsa -des3 -out root_certificate.key 2048 -config
/etc/ssl/openssl.cnf
chmod 400 root_certificate.key
cp root_certificate.key /etc/ssl/private/root_certificate.key
# Self-signing of the root certificate key
openssl req -x509 -new -nodes -key root_certificate.key -days 3650 -out
root_certificate.crt -config /etc/ssl/openssl.cnf
cp root_certificate.crt /etc/ssl/certs/root_certificate.crt
# In order to windows and IE to understand the root certificate it needs a
.p12 file that containt key and certificate of the CA
# Here we create a PEM file containing the key and the certificate for our
root CA certificate
cat root_certificate.key root_certificate.crt 
root_certificate_key_crt.pem
# Then we create the .p12 file
openssl pkcs12 -export -out root_certificate.p12 -in
root_certificate_key_crt.pem -name SUBDOMAIN CA Certificate PKCS#12
# Create a SSL certifcate
openssl genrsa -out SUBDOMAIN.key 2048
chmod 400 SUBDOMAIN.key
# For self-signing certificate (uncomment the lines below if required)
# openssl req -new -x509 -nodes -sha1 -days 3650 -key SUBDOMAIN.key 
SUBDOMAIN.crt
# openssl x509 -noout -fingerprint -text  SUBDOMAIN.crt 
SUBDOMAIN.info
# For SSL signed certificate by Certification Authority you need to issue a
certificate signing request from it
openssl req -new -key SUBDOMAIN.key -out SUBDOMAIN.csr
# NOTE : Don't use A challenge password because you will be prompted for
password each time webserver reboot...
# Sign other SSL key with the root certificate key
# openssl x509 -req -in SUBDOMAIN.csr -CA root_certificate.crt -CAkey
root_certificate.key -CAcreateserial -out SUBDOMAIN.crt -days 3650
# NOTE : This command should work but to make sure the database get
update and a copy of the key with the serial number is create the command
below is better after customize /etc/ssl/openssl.cnf
sudo touch /etc/ssl/CA/index.txt
sudo nano /etc/ssl/CA/serial # and enter 1000
openssl ca -config /etc/ssl/openssl.cnf -out SUBDOMAIN.crt -infiles
SUBDOMAIN.csr

# Deployment
sudo mkdir /etc/ssl/CA
sudo mkdir /etc/ssl/newcerts
sudo mkdir /etc/ssl/crl
# Then set the config required in /etc/ssl/openssl.cnf in order to the root
certificate and the SSL certificate get created in place


cat SUBDOMAIN.crt root_certificate.crt  server.crt
cat SUBDOMAIN.key root_certificate.key  server.key
chmod 400 server.key

sudo cp server.* /etc/nginx/ssl/


You need to configure OpenSSL (/etc/ssl/openss.cnf) before most execute
most command since it will reduce the typing and error in the process to
create a correct valid root certificate...

Ref.:
https://help.ubuntu.com/community/OpenSSL
https://help.ubuntu.com/10.04/serverguide/certificates-and-security.html
http://serverfault.com/questions/9708/what-is-a-pem-file-and-how-does-it-differ-from-other-openssl-generated-key-file
http://www.digicert.com/ssl-certificate-installation-nginx.htm
http://technet.microsoft.com/en-us/library/cc772491.aspx
http://datacenteroverlords.com/2012/03/01/creating-your-own-ssl-certificate-authority/
http://twentyeighttwelve.com/setting-up-your-own-certificate-authority-on-iis7-using-openssl-and-securing-your-web-api-with-client-certificates/

You can also buy a CA for LAN here, but it is not going to continue for
very long, Goddady stop recently to emit new certificate for LAN :
http://www.instantssl.com/ssl-certificate-products/ssl/ssl-certificate-intranetssl.html?ap=ce046
Ref.:
http://support.godaddy.com/help/article/6935/phasing-out-intranet-names-and-ip-addresses-in-ssls

Hope it helps

:)

Richard



On Thu, Jan 16, 2014 at 2:12 PM, Keith Planer kwplan...@gmail.com wrote:

 I understand this link might have some guidance for me, but the link is
 down: http://www.web2py.com/AlterEgo/default/show/140

 --
 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)
- 

Re: [web2py] DAL usage

2014-01-16 Thread Richard Vézina
lazy_table supposed to do just that no?

Richard


On Thu, Jan 16, 2014 at 3:34 AM, Arnon Marcus a.m.mar...@gmail.com wrote:

 Our schema is quite large (200+ Tables) and changes very seldom.
 I was thinking, is there a way to not have to rebuild it in it's entierty
 on every request?
 I mean, is there a way to seperate-out the schema definition from the
 connection object? Ideally, I would put the schema definition code in a
 separate module in the modulesz folder, and import it into the model file
 that creates the connecfion, and somehow pass the ready-made
 schema-object(s) into the newly-created connection object on each request.
 Can this be done?
 What are the gotchas for this (if any)?
 Are there restrictions for somed schema-definitions tbat can not be used
 like this?

 --
 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: Redis caching

2014-01-16 Thread Derek
Nope, nobody thought of it already. You should patent the idea!

I say you should implement it. And while you are at it, add in an ORM and 
ZeroMQ.

On Thursday, January 16, 2014 2:17:31 AM UTC-7, Arnon Marcus wrote:

 I noticed that the current implementation for web2py uses pickles.
 That is a design choice. There are pros and cons.
 Right off of my head, the biggest cons may be retricting cache-use to 
 python, and performance penalties.
 When I think of all that redis can do, I can not help imagining a better 
 solution - especially for caching query results.
 All result-sets are flat and simple in nature - before the dal steps in 
 and converts them to row objects. This makes it an ideal candidate for 
 redis.
 Has anyone thought of this already?
 A simplistic (naive) solution aould be to store every result in a hash, 
 and stlre all the ids in a sorted set. This way, the result-sef in the 
 cache may be queried by redis, and not necessarily be pulled in an 
 all-or-nothing fasion, improving read-performance and resources 
 dramatically, while opening the possibilities for external non-python 
 processes to access the cache talking to redis directly.
 It may not be desierable for all use-cases, as there are obviouse security 
 concearns, but for ipc stuff and/or intranet applications (which are a 
 common use-case in the web2py world), this can be most beneficial.
 What do you say?

-- 
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: Writing Web2Py specification and finding free lance Web2Py coders

2014-01-16 Thread Derek
I suppose you could find people with skills by looking at the web2pyslices 
website and then send them emails.

On Friday, January 10, 2014 2:59:10 AM UTC-7, Timothy Swieter wrote:

 I've got a couple web ideas I'd like to put into motion.  Some work will 
 be done by myself, other work I'd like an expert (or at least someone more 
 knowledgable than me) to do.  I'm thinking about writing a specification of 
 sorts.  Is there any advice or templates recommended for creating a short 
 specification for an app to be coded in Web2Py?

 Along the same lines, I've looked and Googled on various free lance type 
 web sites.  I hadn't don't noticed any particular place that has a critical 
 mass of those listing Web2Py skills.  Plenty of Python or Python web app. 
  I wonder if there is a hangout I am missing where I could find those that 
 code and create in Web2Py for a living or free lance that I could ask for a 
 quote from.

 Thank you - Tim


-- 
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: Redis caching

2014-01-16 Thread Niphlod


On Thursday, January 16, 2014 10:17:31 AM UTC+1, Arnon Marcus wrote:

 I noticed that the current implementation for web2py uses pickles.
 That is a design choice. There are pros and cons.
 Right off of my head, the biggest cons may be retricting cache-use to 
 python, and performance penalties.


cache doesn't cache only resultsets, hence pickle is the only possible 
choice.
 

 When I think of all that redis can do, I can not help imagining a better 
 solution - especially for caching query results.
 All result-sets are flat and simple in nature - before the dal steps in 
 and converts them to row objects. This makes it an ideal candidate for 
 redis.
 Has anyone thought of this already?
 A simplistic (naive) solution aould be to store every result in a hash, 
 and stlre all the ids in a sorted set. This way, the result-sef in the 
 cache may be queried by redis, and not necessarily be pulled in an 
 all-or-nothing fasion, improving read-performance and resources 
 dramatically, while opening the possibilities for external non-python 
 processes to access the cache talking to redis directly.
 It may not be desierable for all use-cases, as there are obviouse security 
 concearns, but for ipc stuff and/or intranet applications (which are a 
 common use-case in the web2py world), this can be most beneficial.
 What do you say?


It's cool. Actually, I started developing something like that using DAL 
callbacks, but as soon as multiple tables are involved with FK and such, it 
starts to loose speed. Also, your whole app needs to be coded a-la 
ActiveRecord, i.e. fetch only by PK. 
BTW, I'm not properly sure that fetching 100 records with 100 calls to 
redis vs pulling a single time a pickle of 1000 records and discarding what 
you don't need is faster.

BTW2: ORM are already there: redisco and redis-lympid

-- 
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 question

2014-01-16 Thread Niphlod


On Thursday, January 16, 2014 5:13:59 AM UTC+1, Jayadevan M wrote:

 A couple of questions about web2py scheduler - 
 1) I have configured web2py using nginx znd uwsgi on CentOS. These 
 services will automatically restart if the server reboots. How can I ensure 
 that web2py scheduler also restarts?


Use whatever CentOS offers as a service monitor. Don't know CentOS enough 
to tell what's the best option out there. Alternatively, since its in your 
toolbelt yet, checkout 
http://uwsgi-docs.readthedocs.org/en/latest/AttachingDaemons.html
 

 2) Is this the right way of starting the scheduler from command line?
 nohup python web2py.py -K myapp 

 The right way is just 

web2py.py -K yourapp

depending on what process/service manager you'll use to watch that process, 
you might need to add sugar around it, such as the line you posted.  

-- 
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: Important New Year News: Edison Award

2014-01-16 Thread Tim Richardson
web2py is now in the nominee showcase. As I write this, web2py is on page 
20 of the nominee slide show.
http://www.edisonawards.com/nomineegallery.php

On Saturday, 4 January 2014 15:08:38 UTC+11, Massimo Di Pierro wrote:

 Web2py/me have been nominated for the Edison Award. Please wish web2py 
 (and me) good luck. :-)



-- 
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: DAL usage

2014-01-16 Thread Anthony
If you set DAL(..., lazy_tables=True), most of the table definition code is 
deferred until the first time you call db.tablename, so tables that are not 
accessed on a given request are not fully defined. Of course, you can put 
the schema definition code into a function or class in a module and import 
and execute that function/class at request time, but the actual definition 
code would still have to run at each request (albeit, only for the tables 
you actually need for that request).

It sounds like instead, you would prefer for the module to create a table 
object so the table object can be imported directly (and then added to the 
DAL connection object of the current request) -- that way, the table object 
would be created only once, the first time it is imported. This isn't 
possible with the current API, though I suppose you could create instances 
of the dal.Table class in the module and then write your own version of 
DAL.define_table to attach the imported Table objects to a DAL instance. 
Perhaps this could be made an option of the current .define_table() method 
(as it is, if you pass a Table object to .define_table(), it just makes 
copies of all the Field objects, but perhaps there could be an option to 
pass in a Table object that gets used as is). Not sure how much benefit 
there would be to this approach, assuming any given request doesn't involve 
too many table definitions -- lazy_tables, conditional models, and 
importing functions/classes from modules may be sufficiently speedy for 
most use cases.

Anthony

On Thursday, January 16, 2014 3:34:35 AM UTC-5, Arnon Marcus wrote:

 Our schema is quite large (200+ Tables) and changes very seldom.
 I was thinking, is there a way to not have to rebuild it in it's entierty 
 on every request?
 I mean, is there a way to seperate-out the schema definition from the 
 connection object? Ideally, I would put the schema definition code in a 
 separate module in the modulesz folder, and import it into the model file 
 that creates the connecfion, and somehow pass the ready-made 
 schema-object(s) into the newly-created connection object on each request.
 Can this be done?
 What are the gotchas for this (if any)?
 Are there restrictions for somed schema-definitions tbat can not be used 
 like this?

-- 
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] where can I find older versions ?

2014-01-16 Thread Stef Mientki

thanks !
that one is working.

cheers,
Stef
On 15-01-14 22:10, Niphlod wrote:

he's seeking the binary.

https://code.google.com/p/web2py/issues/detail?id=1809

However, I still can't reproduce the issue.

You can download the 2.8.2 version that is not giving the error here
https://www.dropbox.com/s/4o7ld0vmy9pl9g8/web2py_exe.py2exe.7z



On Wednesday, January 15, 2014 3:19:17 PM UTC+1, Richard wrote:

Github pick a tag download...

Richard


On Tue, Jan 14, 2014 at 7:28 PM, Stef Mientki stef.m...@gmail.com
javascript: wrote:

hi,

where can I find older versions,
because the latest version gives me this error

  wcscpy_s cound not be located in msvcrt.dll

(winXP, 32 bit)

cheers,
Stef

-- 
Resources:

- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py
http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list
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 javascript:.
For more options, visit
https://groups.google.com/groups/opt_out
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.


--
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: DAL usage

2014-01-16 Thread Anthony


 It sounds like instead, you would prefer for the module to create a table 
 object so the table object can be imported directly (and then added to the 
 DAL connection object of the current request) -- that way, the table object 
 would be created only once, the first time it is imported.


Of course, the problem with this approach is that you couldn't dynamically 
change any attributes of the table or its fields (e.g., .readable and 
.writable) at request time, because that would effect other requests as 
well.

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.


[web2py] Re: Bug in DAL with SQLFORM, upload field and required field ???

2014-01-16 Thread Ivan Gazzola
Ok, i renamed the field logo in logo2 and all works fine...
Rechecking the code I saw that I had defined in a previous version the 
field logo as reference.
it is probably not deleted the foreign key in sqlite when I change the 
definition of the field from reference to upload



thx

Ivan

Il giorno giovedì 16 gennaio 2014 15:17:24 UTC+1, Anthony ha scritto:

 I cannot reproduce the problem. Can you pack ttach an app the exhibits the 
 problem?


-- 
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] using CAS

2014-01-16 Thread Robert Bjornson
Hi,

I'm trying to use our university CAS server as the authentication for my 
web2py app.  I am able to direct logins to CAS fine, by using this code in 
my model file:

auth=Auth(db, cas_provider='https://securedev.its.yale.edu/cas')

After completing the cas login, when I look at db.auth_user table, or 
session.auth.user, only auth_user.registration_id has a value, which is 
https://securedev.its.yale.edu/cas/rdb9. 

If I do subsequent logins using the same login name, web2py finds the 
existing user entry and gives me that id.  So far so good.

My question is, how can I cleanly fill in the other fields of the user 
entry (things like firstname, lastname, etc.).  I can pull them from my 
local ldap
server using the login name.  But, what is the clean way to push them into 
the database when the record is first created?  Is there a callback to 
login that I can use for this?

Thanks,

Rob

-- 
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: ultramemcache

2014-01-16 Thread Arnon Marcus
I was going to, but couldn't find it...
In fact, I even ran a full text-search on the entire web2py stack, and
found no import memcache anywhere (nor from memcache for that matter...)
Which is extremely weird, as it actually does work with my memcached
server...

Hmm...

I guess I must have missed it, despite my due diligence, and probably my
Pycharm as well...

Any pointers on where it is?


On Thu, Jan 16, 2014 at 11:06 PM, Niphlod niph...@gmail.com wrote:

 no, you can't. But if you want to write your own and the api is
 compatible, just change the imports at the top and hope for the best.

 On Thursday, January 16, 2014 12:02:11 PM UTC+1, Arnon Marcus wrote:

 We are using gevent, and we want to use memcached (for now, before we
 upgrade web2py to a version that supports redis...)
 I've noticed that there is threading going on in the gluon.memcache
 package - would this work with gevent?

 This package is specifically meant for using memcached from a gevent
 process:
 https://github.com/esnme/ultramemcache

 Can I make the existing gluon.memcache use this instead?
 Has anybody tried it?


  --
 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/-XCTWqTUJl0/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: using CAS

2014-01-16 Thread Massimo Di Pierro
You can do

if auth.user and not auth.user.first_name:
 pull them from ldap and store them in auth.user

On Thursday, 16 January 2014 16:10:18 UTC-6, Robert Bjornson wrote:

 Hi,

 I'm trying to use our university CAS server as the authentication for my 
 web2py app.  I am able to direct logins to CAS fine, by using this code in 
 my model file:

 auth=Auth(db, cas_provider='https://securedev.its.yale.edu/cas')

 After completing the cas login, when I look at db.auth_user table, or 
 session.auth.user, only auth_user.registration_id has a value, which is 
 https://securedev.its.yale.edu/cas/rdb9. 

 If I do subsequent logins using the same login name, web2py finds the 
 existing user entry and gives me that id.  So far so good.

 My question is, how can I cleanly fill in the other fields of the user 
 entry (things like firstname, lastname, etc.).  I can pull them from my 
 local ldap
 server using the login name.  But, what is the clean way to push them into 
 the database when the record is first created?  Is there a callback to 
 login that I can use for this?

 Thanks,

 Rob



-- 
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: Redis caching

2014-01-16 Thread Arnon Marcus
Derek: Are you being sarcastic and mean?

 

 cache doesn't cache only resultsets, hence pickle is the only possible 
 choice.
  


Well, not if you only need flat and basic objects - there the benefit of 
pickle is mute and it's overhead is obvious - take a look at this project:
https://redis-collections.readthedocs.org/en/latest/
 

 It's cool. Actually, I started developing something like that using DAL 
 callbacks, but as soon as multiple tables are involved with FK and such, it 
 starts to loose speed. Also, your whole app needs to be coded a-la 
 ActiveRecord, i.e. fetch only by PK. 


Hmmm... Haven't thought of that... Well, you can't search/query for 
specific records by their hashed-values, but that's not the use-case I was 
thinking about - I am not suggesting replacing the dal... Plus, that 
restriction would also exist when using pickles for such a use-case...
What I had in mind is simpler than that - just have a bunch of simple 
queries that you would do in your cache.ram anyways, and instead have their 
raw result-set (before being parsed into rows objects) and cached as-is 
(almost...) - that would be faster to load-in the cache than into 
cache.ram, and also faster for retrieval.
 

 BTW, I'm not properly sure that fetching 100 records with 100 calls to 
 redis vs pulling a single time a pickle of 1000 records and discarding what 
 you don't need is faster.


Hmmm... I don't know, redis is famous for crunching somewhere in the order 
of 500K requests per-second - have you tested it? 
 

 BTW2: ORM are already there: redisco and redis-lympid


10x, I'll take a look - though I think an ORM would defeat the purpose (in 
terms of of speed) and would be overkill... 

-- 
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: error class 'gluon.contrib.pypyodbc.ProgrammingError' ('', 'SQL_INVALID_HANDLE') when DAL is mssq

2014-01-16 Thread Josh Myers
I was also getting this same error and I thank Gianganh for his help in 
moving me along.

Now, using the solution above, instead of getting the SQL_INVALID_HANDLE, I 
am getting the following:

class 'pyodbc.Error' ('HY000', 'The driver did not supply an error!')

Gianganh, did you also get this error?  Or, if you didn't, do you know how 
I can fix this?


- Josh



On Thursday, December 26, 2013 10:13:36 PM UTC-5, Gianganh Nguyen wrote:

 Hey,
 I resolved this issue follow:
 1. Setup pyodbc-3.0.7.win32-py2.7.exe (download from 
 http://code.google.com/p/pyodbc/downloads/list)
 2. Insert to the db.py file:




 *import pyodbc from gluon.dal import MSSQLAdapterif not 
 (MSSQLAdapter.driver):MSSQLAdapter.driver = 
 globals().get('pyodbc',None)*

 And everything is okay.

 Thanks!
 *(^_^)*

 Vào 00:21:28 UTC+7 Thứ sáu, ngày 27 tháng mười hai năm 2013, Alan Etkin đã 
 viết:

 This error is produced when the controller files execute a query string, 
 example db(db.usr).select() or db(db.usr).count(). It does not always occur 
 but frequently occur!


 Have you checked app/databases/sql.log?

 Maybe you can post the last commands stored for debugging.



-- 
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: using CAS

2014-01-16 Thread Robert Bjornson
Hi Massimo,

Thanks for the reply.  I'm still not certain the best place to do this.  Is 
there a callback within the login processing where I can stick this code, 
or should I use _next in the CAS redirect to go to a controller that will 
do this?  

Thanks,

Rob


On Thursday, January 16, 2014 5:17:26 PM UTC-5, Massimo Di Pierro wrote:

 You can do

 if auth.user and not auth.user.first_name:
  pull them from ldap and store them in auth.user

 On Thursday, 16 January 2014 16:10:18 UTC-6, Robert Bjornson wrote:

 Hi,

 I'm trying to use our university CAS server as the authentication for my 
 web2py app.  I am able to direct logins to CAS fine, by using this code in 
 my model file:

 auth=Auth(db, cas_provider='https://securedev.its.yale.edu/cas')

 After completing the cas login, when I look at db.auth_user table, or 
 session.auth.user, only auth_user.registration_id has a value, which is 
 https://securedev.its.yale.edu/cas/rdb9. 

 If I do subsequent logins using the same login name, web2py finds the 
 existing user entry and gives me that id.  So far so good.

 My question is, how can I cleanly fill in the other fields of the user 
 entry (things like firstname, lastname, etc.).  I can pull them from my 
 local ldap
 server using the login name.  But, what is the clean way to push them 
 into the database when the record is first created?  Is there a callback to 
 login that I can use for this?

 Thanks,

 Rob



-- 
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: Redis caching

2014-01-16 Thread Anthony


 What I had in mind is simpler than that - just have a bunch of simple 
 queries that you would do in your cache.ram anyways, and instead have their 
 raw result-set (before being parsed into rows objects) and cached as-is 
 (almost...)


Note, when you do .select(..., cache=...), it does in fact just cache the 
raw result set from the database -- it does not parse into a Rows object 
and pickle/cache the Rows object (though you can do that as well, if you 
instead do .select(..., cacheable=True), though the Row objects will be 
missing some functionality in that case).

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.


[web2py] Re: DAL usage

2014-01-16 Thread Arnon Marcus


 It sounds like instead, you would prefer for the module to create a table 
 object so the table object can be imported directly (and then added to the 
 DAL connection object of the current request) -- that way, the table object 
 would be created only once, the first time it is imported.



That's exactly what I meant.
It would then refresh itself only when you make a change to the schema, as 
the module would have to be re-compiled on import-time on the next request.

In most ORMs/DALs there is a clear separation between the connection-object 
and the schema-object(s), and for good reason : schema-changes are few and 
far between - requests/connections are numerous and rapid - it makes no 
sense tying them together like that... It's a poor design-choice, IMHO.

Of course, the problem with this approach is that you couldn't dynamically 
 change any attributes of the table or its fields (e.g., .readable and 
 .writable) at request time, because that would effect other requests as 
 well.


I don't know that needing to define a per-request readable/writable is such 
a common use-case - or else I don't fully understand what you are alluding 
to...
Are these definitions for security that are modified based on 
auth-definitions, after being cross-referenced with the 
request/session-user?
If so, I guess they would have to be re-set automatically by the DAL object 
on each request, but that doesn't mean the entire-schema needs to be 
re-generated - the auth-definitions are already in the database anyways, 
and this means it's not a schema-related issue - it's just data that got 
bolted-onto the schema-objects for convenience... If it is taken from the 
database anyways (or even if it's caches), the bolted-on variables can be 
reset on each request in a thread-safe kind of way - though that may 
require further thinking...

-- 
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: How to add a column?

2014-01-16 Thread 黄祥
very detail and clear explaination with the examples, why not put this on 
the book on dal chapter?

best regards,
stifan

-- 
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: Important New Year News: Edison Award

2014-01-16 Thread Michele Comitini
Why didn't they put the logo instead of a random snapshot??


2014/1/16 Tim Richardson t...@growthpath.com.au

 web2py is now in the nominee showcase. As I write this, web2py is on page
 20 of the nominee slide show.
 http://www.edisonawards.com/nomineegallery.php


 On Saturday, 4 January 2014 15:08:38 UTC+11, Massimo Di Pierro wrote:

 Web2py/me have been nominated for the Edison Award. Please wish web2py
 (and me) good luck. :-)

  --
 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: DAL usage

2014-01-16 Thread Anthony


 I don't know that needing to define a per-request readable/writable is 
 such a common use-case - or else I don't fully understand what you are 
 alluding to...


Sometimes you want to show/hide particular fields in a form, grid, etc. 
depending on some condition, so you set the readable and writable 
attributes dynamically in the controller. Also, default, represent, and 
compute attributes as well as validators sometimes use request specific 
data. 
 

 If so, I guess they would have to be re-set automatically by the DAL 
 object on each request,


It's not just a matter of resetting. If there is only a single fixed 
instance of an object that gets imported from a module, any change to an 
attribute during a request will persist (and affect other simultaneous 
requests).

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.


[web2py] Re: DAL usage

2014-01-16 Thread Anthony


 In most ORMs/DALs there is a clear separation between the 
 connection-object and the schema-object(s), and for good reason : 
 schema-changes are few and far between - requests/connections are numerous 
 and rapid - it makes no sense tying them together like that... It's a poor 
 design-choice, IMHO.


The issue isn't connecting the schema objects with the connection object 
(that can be handled). The issue is that the schema object may include 
request specific mutable attributes.

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.


[web2py] Re: DAL usage

2014-01-16 Thread Arnon Marcus
A database scema is a description of the structure of a database - it has 
nothing to do with requests.
You are talking about a convinience-feature that could have been implemented 
differently - this coupling is convinient but makes no sense from a performance 
standpoint.
I am looking for a way around that...
If there isn't any, it only means that for this to be possible it needs to be 
re-implemented in a way that would make that possible.

-- 
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.