Re: [web2py] Added Conditional Validation in the Model...

2012-12-29 Thread Bruno Rocha
* can see two options. 1. Use form validation: def check_user(form): query = db.site.user == form.vars.user query &= db.site.location == form.vars.location if db(query).count():* *form.errors.user = "already exists" def action(): form = SQLFORM(db.site) if form.proce

[web2py] Added Conditional Validation in the Model...

2012-12-29 Thread encompass
I have this in my model. db.define_table('site', Field('location', 'string'), Field('user', db.auth_user, readable=False, writable=False), Field('typos', 'blob', readable=False, writable=False, default=None), Field('status', 'string', readable=False, writable=False, default='pendin

Re: [web2py] Re: Server-side AngularJS execution?

2012-12-29 Thread Alec Taylor
Thanks Anthony, using Spynner now: import spynner if __name__=='__main__': url = "http://angular.github.com/angular-phonecat/step-10/app/#/phones"; browser = spynner.Browser() browser.create_webview(True) browser.load(url, load_timeout=60) print browser._get_html() # ^ Can

Re: [web2py] Where to host web2py

2012-12-29 Thread Gustavo Souza
Hello, Andrew! I'm using https, and my error logs I am giving this message: [Sun Dec 30 00:13:12 2012] [notice] SELinux policy enabled; httpd running as context unconfined_u:system_r:openshift_t:s0:c5,c110 [Sun Dec 30 00:13:12 2012] [notice] mod_bw : Memory Allocated 32 bytes (each conf takes 32

[web2py] Re: parse_as_rest queries

2012-12-29 Thread Massimo Di Pierro
It could be possible via routes but it would be nice it the syntax were to allow it. I stopped developing it because I though instead of reinventing the wheel with this syntax we may want to support some standard. Is there any? On Sunday, 30 December 2012 00:01:03 UTC-6, DenesL wrote: > > Yes,

[web2py] Re: parse_as_rest queries

2012-12-29 Thread DenesL
Yes, from the docs it is clear that one could use such syntax but the idea is to hide it somehow. So instead of /pets/dog I want just /dogs Note that I am providing all parameters for the query in the pseudo-code {pet.kind.eq.dog} to avoid having another arg. On Saturday, December 29, 2012 12:4

[web2py] Re: Upload field with clear text filename

2012-12-29 Thread Anthony
Setting writable to False is probably the best way to keep that field out of the form -- that's why I suggested setting the default value of the field instead. Does that not work? Anthony On Saturday, December 29, 2012 8:04:05 PM UTC-5, Joe Barnhart wrote: > > I was trying to keep the filename

[web2py] Re: Upload field with clear text filename

2012-12-29 Thread Joe Barnhart
I was trying to keep the filename out of the generated form since I want it set "automatically" in the process of uploading the document. Is there a better way to accomplish that? BTW, the test "if request.vars.upload" does not work. It returns "False" even if the upload field has been set.

Re: [web2py] Update and Delete row issue

2012-12-29 Thread Vinicius Assef
On Sat, Dec 29, 2012 at 10:19 PM, Wonton wrote: > Hello everyone and happy new year! Hi. > > I'm having an issue regarding the updating and deletion of a row in my > tables and I can't find any solution, so I hope you can help me. > > 1) Regarding to the update: > As far as I know, to update a r

Re: [web2py] Re: Graph Model (proposal to contribute)

2012-12-29 Thread Jose
dia can load svg files! Jose --

Re: [web2py] how to create profiles

2012-12-29 Thread Vinicius Assef
What do you mean with "user profiles"? On Sat, Dec 29, 2012 at 8:51 AM, sasogeek wrote: > How do allow users to see their profiles and that of other users...? > > -- > > > --

Re: [web2py] Re: Graph Model (proposal to contribute)

2012-12-29 Thread Jose
El sábado, 29 de diciembre de 2012 21:22:47 UTC-3, rochacbruno escribió: > > > > On Sat, Dec 29, 2012 at 10:20 PM, Jose >wrote: > >> ‘dia’ > > > It exports on to an editable dia diagram? > > I have to test it! > >From http://networkx.lanl.gov/pygraphviz/preview/reference/agraph.html Formats (

Re: [web2py] Re: Graph Model (proposal to contribute)

2012-12-29 Thread Bruno Rocha
On Sat, Dec 29, 2012 at 10:20 PM, Jose wrote: > ‘dia’ It exports on to an editable dia diagram? I have to test it! --

Re: [web2py] Re: Graph Model (proposal to contribute)

2012-12-29 Thread Jose
I like different colors to gray... You can add more formats to download: ‘canon’, ‘cmap’, ‘cmapx’, ‘cmapx_np’, ‘dia’, ‘dot’, ‘fig’, ‘gd’, ‘gd2’, ‘gif’, ‘hpgl’, ‘imap’, ‘imap_np’, ‘ismap’, ‘jpe’, ‘jpeg’, ‘jpg’, ‘mif’, ‘mp’, ‘pcl’, ‘pdf’, ‘pic’, ‘plain’, ‘plain-ext’, ‘png’, ‘ps’, ‘ps2’, ‘svg’, ‘

[web2py] Update and Delete row issue

2012-12-29 Thread Wonton
Hello everyone and happy new year! I'm having an issue regarding the updating and deletion of a row in my tables and I can't find any solution, so I hope you can help me. 1) Regarding to the update: As far as I know, to update a row I should do something like this: query = db(db.table.field1=

[web2py] Re: Problems with the MENU helper function and HTML5

2012-12-29 Thread Sverre
Thx for your hint. I'm not knowing js at all, but I found a solution: $(document).ready(function(){ jQuery('div.nav-bar ul').each(function(){ jQuery(this).removeClass('web2py-menu web2py-menu-vertical'); jQuery(this).addClass('menu'); }); jQuery('li.web2py-menu-first').e

[web2py] Re: DB data representation in a SQLFORM

2012-12-29 Thread Anthony
> > The presence of format='%(home_name)s also implies >db.other.home.represent = lambda id, row: '%(home_name)s' % db.home(id) > Note, the default "represent" attribute above is only set if you do NOT explicitly specify the "requires" attribute when defining the field. If you specify a "r

Re: [web2py] plugin_social

2012-12-29 Thread Bruno Rocha
ok, Let me play a bit with this and I will try to test some messaging and profile features to send a patch. *is it on git or hg? --

[web2py] Re: DB data representation in a SQLFORM

2012-12-29 Thread Massimo Di Pierro
Consider this db.define_table(*'home'*, Field('home_name', 'string', requires=[IS_NOT_EMPTY(), IS_NOT_IN_DB(db, 'home.home_name')]), format='%(home_name)s') db.define_table('other',Field(*'home'*, 'reference home', label='Home ID')) format='%(home_name)s' tells web2py how home is to be re

[web2py] Re: DB data representation in a SQLFORM

2012-12-29 Thread Anthony
More generally, to control the type of input used, see the book section on widgets . Anthony On Saturday, December 29, 2012 5:35:07 PM UTC-5, Anthony wrote: > > This IS_IN_DB validator is what gives you the dropdown -- if you don't > want t

Re: [web2py] DB data representation in a SQLFORM

2012-12-29 Thread Bruno Rocha
> > > b) Maybe more generally, how do I choose how the DB field will be > represented (dropdown, checkbox, field, etc.)? (since it seems to by > default represent this field as a dropdown for me) > Look for widgets http://web2py.com/books/default/chapter/29/07#Widgets db.table.widget = SQLFORM.

[web2py] Re: DB data representation in a SQLFORM

2012-12-29 Thread Anthony
This IS_IN_DB validator is what gives you the dropdown -- if you don't want the dropdown, then you can put the validator in a list: Field('home', 'reference home', requires=[IS_IN_DB(db, 'home.id')], label='Home ID') This is mentioned in the book here

[web2py] DB data representation in a SQLFORM

2012-12-29 Thread Ilya
*Issue:* 1. I have a field in a DB table like this: Field(*'home'*, 'reference home', requires=IS_IN_DB(db, 'home.id'), label='Home ID') 2. 'reference home' is a separate DB table like this: # A table to store home names db.define_table(*'home'*, Field('home_name', 'string', requires=[IS_

Re: [web2py] Re: Can web2py be used for highly complex relational databases?

2012-12-29 Thread Massimo Di Pierro
The problem is that SQLA is from this prospective lower level. You can use scripts/extract_pgsql_models.py to introspect the database and "guess" the model, but while this information is sufficient for SQLA, it is not sufficient for web2py. Web2py needs to know more about the column than it is

Re: [web2py] plugin_social

2012-12-29 Thread Massimo Di Pierro
PS. I am planning to add a section about this in the book. On Saturday, 29 December 2012 15:59:30 UTC-6, rochacbruno wrote: > > There is also a facebook like comments plugin: > https://github.com/scubism/sqlabs/blob/master/controllers/plugin_comment_cascade.py > --

Re: [web2py] plugin_social

2012-12-29 Thread Massimo Di Pierro
ok. I'd be happy if you could patch and maintain it. works for you? You are our social network expert. :-) Massimo On Saturday, 29 December 2012 15:58:24 UTC-6, rochacbruno wrote: > > So, maybe it can be a parameter in plugins (PluginManager) or in global > models. > > plugins.plugin_social.pro

Re: [web2py] plugin_social

2012-12-29 Thread Bruno Rocha
There is also a facebook like comments plugin: https://github.com/scubism/sqlabs/blob/master/controllers/plugin_comment_cascade.py --

Re: [web2py] plugin_social

2012-12-29 Thread Bruno Rocha
So, maybe it can be a parameter in plugins (PluginManager) or in global models. plugins.plugin_social.profile_action = "/profile/show/%(username)s" How would the comments intergration work? There is also the MEssaging plugin https://github.com/scubism/sqlabs/blob/master/modules/plugin_messaging.

Re: [web2py] Re: Can web2py be used for highly complex relational databases?

2012-12-29 Thread Michele Comitini
This thread reminds me of a feature I would like to see in the DAL. The DAL is the missing introspection features SQLAlchemy has: legacy db introspection. So with the DAL the developer needs to write always the metadata to describe the db schema. I faced that in a fairly complex sqlite schema.

Re: [web2py] plugin_social

2012-12-29 Thread Massimo Di Pierro
Anyway I posted looking for comments. It would be nice if we could merge it with plugin_comments and plugin_rating so we finally kill plugin_wiki for good! On Saturday, 29 December 2012 15:14:59 UTC-6, Massimo Di Pierro wrote: > > Because I do not know what goes in the profile. I would not

Re: [web2py] plugin_social

2012-12-29 Thread Massimo Di Pierro
Because I do not know what goes in the profile. I would not want people to have to edit the plugin to customize behavior. On Saturday, 29 December 2012 15:06:10 UTC-6, rochacbruno wrote: > > > > On Sat, Dec 29, 2012 at 6:54 PM, Massimo Di Pierro > > > wrote: > >> default/home/id > > > Why not h

Re: [web2py] plugin_social

2012-12-29 Thread Bruno Rocha
On Sat, Dec 29, 2012 at 6:54 PM, Massimo Di Pierro < massimo.dipie...@gmail.com> wrote: > default/home/id Why not having a /plugin_social/profile/id with default controller and view ? --

[web2py] Re: Server-side AngularJS execution?

2012-12-29 Thread Anthony
You might be able to use a headless browser on the server to execute the Javascript to generate the HTML. The Meteor frameworkuses PhantomJS for this purpose. There is also Zombie.js

[web2py] plugin_social

2012-12-29 Thread Massimo Di Pierro
Now you can add your own social network to any existing web2py app: https://dl.dropbox.com/u/18065445/Tmp/web2py.plugin.social.w2p 1) install the plugin (requires db and auth) 2) visit http:///yourapp/plugin_social/search to search for other users by name and send friend requests 3) v

[web2py] Re: request.post_vars EMPTY

2012-12-29 Thread Niphlod
For readers that will bump into this, please read http://victorblog.com/2012/12/20/make-angularjs-http-service-behave-like-jquery-ajax/ On Saturday, December 29, 2012 2:31:01 PM UTC+1, vivek wrote: > > Ok got it ! I just had to go through the Angular APi documentation to > figure out how to assi

Re: [web2py] Re: Auth.wiki() classes in tags

2012-12-29 Thread Andrew W
Thanks. That worked, although the speck one doesn't. Worth adding to the book I think. On Sunday, December 30, 2012 5:38:06 AM UTC+13, Massimo Di Pierro wrote: > > def index(): return auth.wiki(render='html') > > in index.html > > {{extend 'layout'}} > http://js.nicedit.com/nicEdit-latest.js"

[web2py] Re: Can web2py be used for highly complex relational databases?

2012-12-29 Thread Massimo Di Pierro
To better illustrate my previous point I built an example which may be useful to others who are concerned about performance. https://dl.dropbox.com/u/18065445/Tmp/a1000.zip Contains two apps a1000_1 and a1000_2. Both apps define 1000 tables each with 10 columns (no attributes, validators, widg

[web2py] Re: parse_as_rest queries

2012-12-29 Thread Massimo Di Pierro
you can say something like: "/pets[pet]/{pet.kind.eq}" and call /pets/dog or /pets/cat It is not documented because I am convinced this syntax is definitive. It needs more etsting and as you suggest it may be richer. massimo On Saturday, 29 December 2012 11:32:25 UTC-6, DenesL wrote: > > Hi

[web2py] parse_as_rest queries

2012-12-29 Thread DenesL
Hi all, is there any documentation (aside from what is said in the book) about the queries parameter in parse_as_rest? Some examples would be nice. Also, looking at the patterns, there does not seem a way to specify a subset in a pattern e.g. (pseudo-code) "/dogs[pet]/{pet.kind.eq.dog}" which

[web2py] Re: Can web2py be used for highly complex relational databases?

2012-12-29 Thread Massimo Di Pierro
TLTR: if you can do it with others you can do it with web2py, although default behavior may be different. There are some important differences between web2py DAL and SQLAlchemy: sqlalchemy has better support for non-integer primary keys (dal supports them too but they make automatic form handli

[web2py] Re: Can web2py be used for highly complex relational databases?

2012-12-29 Thread Alex Glaros
Hi Lazaro and Massimo, The Fi$cal project is not my project; I don't know how many tables it has, but is an example of highly relational financial software so that web2py members could understand my question clearly. Most projects will be in strict 3rd Normal Form. Let me be more transparent r

[web2py] Re: SQLFORM widget support for wider range of input types

2012-12-29 Thread Massimo Di Pierro
I think this would be a good idea but somebody should be in charge of this. Perhaps we can take this approach for web3py where widgets will have a simpler internal design. It will be possible to use web3py widgets in web2py. Anybody wants to be in charge of this? I can explain more so we can di

Re: [web2py] Re: Graph Model (proposal to contribute)

2012-12-29 Thread Massimo Di Pierro
I'll take the patch. ;-) Please use colors which look when printed in black and white. On Saturday, 29 December 2012 07:53:17 UTC-6, Jose wrote: > > This can be useful? > > 1) Save the model > 2) Show auth_ tables different from other > > If you want to send the patch. > Jose > > --

[web2py] Re: Can web2py be used for highly complex relational databases?

2012-12-29 Thread Massimo Di Pierro
I should add that in the system I have looked almost all tables where de-normalized. All tabled storing a key would also stored the value corresponding to the code. This is for two reasons: 1) if you have thousands of tables you cannot join everything all the time. 2) for auditing purposes it s

Re: [web2py] Re: RuntimeError: table appears corrupted

2012-12-29 Thread Massimo Di Pierro
Please send them to me and your model as well. Thanks. On Saturday, 29 December 2012 01:51:42 UTC-6, Richard Penman wrote: > > Thanks - that did it. > > Any idea what happened and how to prevent this? > If helpful I can send the previous and current .table files. > > > On Sat, Dec 29, 2012 at 6

Re: [web2py] Re: Auth.wiki() classes in tags

2012-12-29 Thread Massimo Di Pierro
def index(): return auth.wiki(render='html') in index.html {{extend 'layout'}} http://js.nicedit.com/nicEdit-latest.js"; type="text/javascript"> jQuery(function(){bkLib.onDomLoaded(nicEditors.allTextAreas);}); {{=content}} On Saturday, 29 December 2012 01:35:34 UTC-6, Andrew W wrote: > >

[web2py] Re: Problems with the MENU helper function and HTML5

2012-12-29 Thread Paolo Caruccio
One possible solution (not tested). 1 step) in static/js create a new file named "web2py_metroui.js" having the following contents jQuery(function(){ jQuery('.menu>li.dropdown').each(function(){ jQuery(this).attr({'class':'','data-role':'dropdown'}); }); jQuery('.menu li li').each(fu

[web2py] Problems with the MENU helper function and HTML5

2012-12-29 Thread Sverre
I'm trying to write a layout plugin with the styles of http://metroui.org.ua . A problem is, that he is using custom data in the menu definitions like > > > Item 1 > > SubItem >

[web2py] SQLFORM widget support for wider range of input types

2012-12-29 Thread Calvin
WHATWG (*Web Hypertext Application Technology Working Group ) list a wide range of input types in * http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#states-of-the-type-attribute Could we update SQLFORM.widgets so that a whole r

[web2py] Re: Graph Model (proposal to contribute)

2012-12-29 Thread Jose
El viernes, 28 de diciembre de 2012 15:15:34 UTC-3, Luc Chase escribió: > > Hi, > just to clarify please... is this to show the model using a graphical > model? > Or is it for extending the DAL to support Graph > databasemodels ? > > -- > Luc. > Onl

[web2py] Re: request.post_vars EMPTY

2012-12-29 Thread vivek
Ok got it ! I just had to go through the Angular APi documentation to figure out how to assign encoding. Ty ones again --

[web2py] Re: Server-side AngularJS execution?

2012-12-29 Thread Niphlod
I'd not recommend any of the mvc javascript frameworks if you're interested in any SEO consistent results. Support for executing javascript by crawlers is largely missing and there is no "documented" way to tell them to crawl and execute specific fragments. If you're positive about implementing

[web2py] Re: request.post_vars EMPTY

2012-12-29 Thread vivek
So how would I ideally encode the data? In a previous function i was using $.ajax to post data and the variables were available in response.post_vars. On Saturday, December 29, 2012 4:45:17 PM UTC+4, Niphlod wrote: > > if you have only a json string posted sent without being encoded > (multipa

Re: [web2py] `@service.json` works locally but not on Heroku?

2012-12-29 Thread Niphlod
locally generic views works because in your models (if you used the scaffolding app it's in db.py) you have response.generic_patterns = ['*'] if request.is_local else [] On Saturday, December 29, 2012 5:47:55 AM UTC+1, Alec Taylor wrote: > > Thanks, that did the trick. > > Strange that it had

[web2py] Re: drop down list as auto-complete

2012-12-29 Thread Niphlod
http://web2py.com/books/default/chapter/29/07?search=autocomplete#Autocomplete-widget On Saturday, December 29, 2012 10:45:38 AM UTC+1, max wrote: > > In my dependancy tables I have thousands of entries. > e.g. > > frg.define_table('group', >Field('name','string'), > ) > > frg.define_table('

[web2py] Re: How to check/get the data type of db fields

2012-12-29 Thread Niphlod
it's in the "type" attribute of the field, as in db.auth_user.first_name.type PS: if you're checking other variables, the recommended method to check the type in python is is isinstance() >>> myvar = 123 >>> isinstance(myvar, int) True On Saturday, December 29, 2012 10:58:20 AM UTC+1, a

[web2py] Re: request.post_vars EMPTY

2012-12-29 Thread Niphlod
if you have only a json string posted sent without being encoded (multipart/form-data) you have the json directly in response.body . request.post_vars is filled only if data comes encoded. On Saturday, December 29, 2012 1:28:23 PM UTC+1, vivek wrote: > > Hi i been using angularjs to develop my f

[web2py] request.post_vars EMPTY

2012-12-29 Thread vivek
Hi i been using angularjs to develop my front end . I am using http.post to send data to web2py. The POST tab under firebug shows a valid JSON being posted. Now in my controller I believe my request.post_vars is empty. I tried using simplejson.loads , but it throws me an error expected string

Re: [web2py] Conditional {{extend layout.html}}?

2012-12-29 Thread Simon Ashley
Thanks, excellent, that works .. (compiling wont been an immediate issue) >> >> > > --

[web2py] how to create profiles

2012-12-29 Thread sasogeek
How do allow users to see their profiles and that of other users...? --

[web2py] Re: How to check/get the data type of db fields

2012-12-29 Thread at
Ok, I've somehow achieved the objective in this way: *dType = type(all_rows[rowid][key]) intType = type(123) strType = type('Test String') . . if (dType == strType): print "Found an string" elif (dType == intType): print "Found an integer" else: print "Found something else" *Regards On

[web2py] drop down list as auto-complete

2012-12-29 Thread max
In my dependancy tables I have thousands of entries. e.g. frg.define_table('group', Field('name','string'), ) frg.define_table('kundenstamm', Field('a20',frg.group), ) frg.kundenstamm.a20.requires = IS_IN_DB(frg, frg.group.id, '%(id)s , %(name)s',zero=T('Choose')) I have thousands of val

[web2py] Re: Can web2py be used for highly complex relational databases?

2012-12-29 Thread Lazarof
Hello Alex. Could you comment what Massimo explained? Is that the situation? I bet that's. пятница, 28 декабря 2012 г., 19:38:25 UTC+4 пользователь Alex Glaros написал: > > Can web2py be used for highly complex relational databases for large > fiscal projects? Example: California's Fi$cal proje

[web2py] Re: How to check/get the data type of db fields

2012-12-29 Thread at
lets say we've: dType = type(all_rows[rowid][key]) Now how to check if the dType is string, or integer, boolean etc? Any build-in functions for this purpose? Regards On Saturday, 29 December 2012 13:07:29 UTC+5, at wrote: > > > While looping through all database fields of a table, need to deter

[web2py] How to check/get the data type of db fields

2012-12-29 Thread at
While looping through all database fields of a table, need to determine data-type of each field before processing data in it. How to determine which fields is of type *str*, which one is of *int type*, etc. Can somebody assist? Thanks --