[web2py] getting db instance from select()

2013-05-01 Thread lucas
i think i am asking this properly.  if i do 

rtn = db(...query stuff...).select()

and then pass it as a parameter to a function like

some_fxn(rtn)

is there a property in this rtn instance to allow me to read and access the 
original db instance?  i need to run another query in some_fxn off of db 
but some_fxn in located in a py file under modules and modules does seem to 
have automatic access to db.

lucas

-- 

--- 
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: getting db instance from select()

2013-05-01 Thread Niphlod
you're looking for rtn.db .

PS: you can as well pass db around, keeps the code explicit
e.g.
some_fxn(rtn, db)

On Wednesday, May 1, 2013 9:49:54 AM UTC+2, lucas wrote:
>
> i think i am asking this properly.  if i do 
>
> rtn = db(...query stuff...).select()
>
> and then pass it as a parameter to a function like
>
> some_fxn(rtn)
>
> is there a property in this rtn instance to allow me to read and access 
> the original db instance?  i need to run another query in some_fxn off of 
> db but some_fxn in located in a py file under modules and modules does seem 
> to have automatic access to db.
>
> lucas
>

-- 

--- 
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: Jquery mobile module not working

2013-05-01 Thread toni campins
Replace plugin_jqmobile/layout.html for this :



  






{{=response.title or request.application}}


 












 












 http://code.jquery.com/jquery-1.9.1.min.js";>

{{include 'web2py_ajax.html'}}


//run this script after jQuery loads, but before jQuery Mobile loads

//customize jQuery Mobile to let IE7+ in (Mobile IE)   

$(document).bind("mobileinit", function(){
  $.extend(  $.mobile , {
 
  //extend gradeA qualifier to include IE7+
gradeA: function(){
 //IE version check by James Padolsey, modified by jdalton - from 
http://gist.github.com/527683
 var ie = (function() {
 var v = 3, div = document.createElement('div'), a = 
div.all || [];
 while (div.innerHTML = '', a[0]); 
 return v > 4 ? v : !v;
 }());
 
 //must either support media queries or be IE7+
 return $.support.mediaquery || (ie && ie >= 7);
}
  });
});


http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css"; />
http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js";>
 

  .error { color: red; }

  
  
   
 
  
  
  
  



  
{{=response.title}}
{{block header}}
{{if not auth.user:}}
Login
{{else:}}
Logout
{{pass}}
{{=T("Home")}}
{{end}}
{{if response.menu:}}


  {{for _ in response.menu[1:]:}}
  {{=_[0]}}
  {{pass}}


{{pass}} 
  
  
{{if response.flash:}}{{=response.flash}}{{pass}} 
{{include}}
  
  
{{block footer}}
powered by Prosystem@2013
{{end}}
  


  

 
  


-- 

--- 
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: Webfaction account with multiple apps under 1 web2py install

2013-05-01 Thread Kenneth
I am using the routers.domains method to routing the applications to 
domains, 
I have a problem that I can access to the applications which are not routed 
to the assigned domain.

for example

routers = dict(
  BASE  = dict(
  domains = {
  'domain1.com' : 'app1',
  'domain2.com' : 'app2',
  }
  ),
)


domain2.com still has the access to app1.

Should I just block the applications when users request the unassigned 
applications from the controller?

Thank you

On Wednesday, February 1, 2012 4:14:05 PM UTC-6, Jim S wrote:
>
> Hi
>
> I've got a couple different apps I want to deploy under my web2py 
> instance on webfaction.  Unfortunately, I'm well versed in routing and 
> knowing how to route different requests to different apps.
>
> I have different urls that I'd like mapped to different apps.
>
> www.application1.com I would like to point to 
> web2py/applications/application1
> www.application2.com I would like to point to 
> web2py/applications/application2
>
> And, if possible, I prefer to not show the application name in the url 
> ->  www.application1.com/application1/controller/function
>
> Controller and function are fine but would prefer to eliminate the 
> duplicate application1.  If there is a spot in the manual I should study 
> harder, please reference it.  Unfortunately, I'm relatively weak when it 
> comes to url rewriting/routing and regular expressions.
>
>  -Jim
>
>

-- 

--- 
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: Jquery mobile module not working

2013-05-01 Thread Massimo Di Pierro
Can you send me a patch for admin?

On Wednesday, 1 May 2013 03:15:33 UTC-5, toni campins wrote:
>
> Replace plugin_jqmobile/layout.html for this :
>
> 
> 
>   
> 
> 
> 
> 
> 
> 
> {{=response.title or request.application}}
> 
> 
>  
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>  type="image/x-icon">
>  href="{{=URL('static','images/favicon2.png')}}">
>  
> 
> 
> 
> 
>
>
> 
>  href="{{=URL('static','plugin_jqmobile/css/handheld.css')}}">
> 
> 
> 
>
>  http://code.jquery.com/jquery-1.9.1.min.js";>
> 
> {{include 'web2py_ajax.html'}}
>
> 
> //run this script after jQuery loads, but before jQuery Mobile loads
>
> //customize jQuery Mobile to let IE7+ in (Mobile IE)   
> 
> $(document).bind("mobileinit", function(){
>   $.extend(  $.mobile , {
>  
>   //extend gradeA qualifier to include IE7+
> gradeA: function(){
>  //IE version check by James Padolsey, modified by jdalton - from 
> http://gist.github.com/527683
>  var ie = (function() {
>  var v = 3, div = document.createElement('div'), a = 
> div.all || [];
>  while (div.innerHTML = '', a[0]); 
>  return v > 4 ? v : !v;
>  }());
>  
>  //must either support media queries or be IE7+
>  return $.support.mediaquery || (ie && ie >= 7);
> }
>   });
> });
> 
> 
> http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css"; />
> http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js";>
>  
> 
>   .error { color: red; }
> 
>   
>   
> 
>   
>   
>   
>   
> 
> 
> 
>   
> {{=response.title}}
> {{block header}}
> {{if not auth.user:}}
>  class="ui-btn-left">Login
> {{else:}}
>  class="ui-btn-left">Logout
> {{pass}}
>  class="ui-btn-right">{{=T("Home")}}
> {{end}}
> {{if response.menu:}}
> 
> 
>   {{for _ in response.menu[1:]:}}
>   {{=_[0]}}
>   {{pass}}
> 
> 
> {{pass}} 
>   
>   
> {{if response.flash:}}{{=response.flash}}{{pass}} 
> {{include}}
>   
>data-position="fixed">
> {{block footer}}
> powered by Prosystem@2013
> {{end}}
>   
> 
>
>   
> 
>  
>   
> 
>
>

-- 

--- 
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: getting db instance from select()

2013-05-01 Thread Massimo Di Pierro
rtn is a set of rows. There is no exposed api to access the original db 
connection since it may or may not exist. The db connection from which the 
data was fetched may be closed.

That said rtn[0] is the first row. rtn[0].delete_record is a callable 
object and rtn[0].delete_record.db is what you are looking for.

On Wednesday, 1 May 2013 02:49:54 UTC-5, lucas wrote:
>
> i think i am asking this properly.  if i do 
>
> rtn = db(...query stuff...).select()
>
> and then pass it as a parameter to a function like
>
> some_fxn(rtn)
>
> is there a property in this rtn instance to allow me to read and access 
> the original db instance?  i need to run another query in some_fxn off of 
> db but some_fxn in located in a py file under modules and modules does seem 
> to have automatic access to db.
>
> lucas
>

-- 

--- 
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: Webfaction account with multiple apps under 1 web2py install

2013-05-01 Thread Loïc
Did you restart your webserver / reload routes?

I use a similar routes.py for multiple domains and it works fine.
Maybe you could try : 

routers = dict(
  BASE  = dict(
  domains = {
'www.domain1.com' : 'app1',
'domain1.com' : 'app1',
'www.domain2.com' : 'app2',
'domain2.com' : 'app2',
  },
  applications=['app1', 'app2']
  ),
)





Le mercredi 1 mai 2013 14:54:34 UTC+2, Kenneth a écrit :
>
> I am using the routers.domains method to routing the applications to 
> domains, 
> I have a problem that I can access to the applications which are not 
> routed to the assigned domain.
>
> for example
>
> routers = dict(
>   BASE  = dict(
>   domains = {
>   'domain1.com' : 'app1',
>   'domain2.com' : 'app2',
>   }
>   ),
> )
>
>
> domain2.com still has the access to app1.
>
> Should I just block the applications when users request the unassigned 
> applications from the controller?
>
> Thank you
>
> On Wednesday, February 1, 2012 4:14:05 PM UTC-6, Jim S wrote:
>>
>> Hi
>>
>> I've got a couple different apps I want to deploy under my web2py 
>> instance on webfaction.  Unfortunately, I'm well versed in routing and 
>> knowing how to route different requests to different apps.
>>
>> I have different urls that I'd like mapped to different apps.
>>
>> www.application1.com I would like to point to 
>> web2py/applications/application1
>> www.application2.com I would like to point to 
>> web2py/applications/application2
>>
>> And, if possible, I prefer to not show the application name in the url 
>> ->  www.application1.com/application1/controller/function
>>
>> Controller and function are fine but would prefer to eliminate the 
>> duplicate application1.  If there is a spot in the manual I should study 
>> harder, please reference it.  Unfortunately, I'm relatively weak when it 
>> comes to url rewriting/routing and regular expressions.
>>
>>  -Jim
>>
>>

-- 

--- 
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: Webfaction account with multiple apps under 1 web2py install

2013-05-01 Thread Kenneth
Yeah. I follow the same pattern.
Could you try to browse "www.domain1.com/app2" to see if it doesn't direct 
to app2? Mine does. hmm

On Wednesday, May 1, 2013 8:48:31 AM UTC-5, Loïc wrote:
>
> Did you restart your webserver / reload routes?
>
> I use a similar routes.py for multiple domains and it works fine.
> Maybe you could try : 
>
> routers = dict(
>   BASE  = dict(
>   domains = {
> 'www.domain1.com' : 'app1',
> 'domain1.com' : 'app1',
> 'www.domain2.com' : 'app2',
> 'domain2.com' : 'app2',
>   },
>   applications=['app1', 'app2']
>   ),
> )
>
>
>
>
>
> Le mercredi 1 mai 2013 14:54:34 UTC+2, Kenneth a écrit :
>>
>> I am using the routers.domains method to routing the applications to 
>> domains, 
>> I have a problem that I can access to the applications which are not 
>> routed to the assigned domain.
>>
>> for example
>>
>> routers = dict(
>>   BASE  = dict(
>>   domains = {
>>   'domain1.com' : 'app1',
>>   'domain2.com' : 'app2',
>>   }
>>   ),
>> )
>>
>>
>> domain2.com still has the access to app1.
>>
>> Should I just block the applications when users request the unassigned 
>> applications from the controller?
>>
>> Thank you
>>
>> On Wednesday, February 1, 2012 4:14:05 PM UTC-6, Jim S wrote:
>>>
>>> Hi
>>>
>>> I've got a couple different apps I want to deploy under my web2py 
>>> instance on webfaction.  Unfortunately, I'm well versed in routing and 
>>> knowing how to route different requests to different apps.
>>>
>>> I have different urls that I'd like mapped to different apps.
>>>
>>> www.application1.com I would like to point to 
>>> web2py/applications/application1
>>> www.application2.com I would like to point to 
>>> web2py/applications/application2
>>>
>>> And, if possible, I prefer to not show the application name in the url 
>>> ->  www.application1.com/application1/controller/function
>>>
>>> Controller and function are fine but would prefer to eliminate the 
>>> duplicate application1.  If there is a spot in the manual I should study 
>>> harder, please reference it.  Unfortunately, I'm relatively weak when it 
>>> comes to url rewriting/routing and regular expressions.
>>>
>>>  -Jim
>>>
>>>

-- 

--- 
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: response.download

2013-05-01 Thread Richard Vézina
I think I just fall on this one...

Is this issue fixed, because no ticket seems to have been open??

Thanks

Richard


On Mon, Apr 29, 2013 at 5:39 AM, Domagoj Kovač wrote:

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

-- 

--- 
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] Comparing floats in a database query

2013-05-01 Thread AnnG
Hi,

I have a DAL query which works OK when selecting integer 'float' fields (eg 
4.0, 5.0, 6.0)  (I'm using a MySQL database), but does not select rows 
containing actual float numbers (eg 6.3).

Here is the code

for table_row in db((db.field_phenotype.field_phenotype_pk == db.
scaninstance_fieldphenotype.field_phenotype_fk) & (db.
scaninstance_fieldphenotype.scaninstance_fk == db.scaninstance.
scaninstance_pk) & (db.scaninstance.patient_fk == self.patient_id) 

& (db.scaninstance.age_months == age_months)  # goes wrong here

).select(db.field_phenotype.name, db.scaninstance_fieldphenotype.
field_phenotype_value):
...

... The 'age_months' variable is copied from an earlier query from the same 
table/field. That earlier query works fine, returning all floats - which 
print out fine on my web-page.
The query shown above only matches with rows where the 
db.scaninstance.age_months 
is an integer (converted to a float) eg 4.0, 5.0, 64.0
but not for actual floats eg 6.3

Can anyone help??

Regards

Ann

-- 

--- 
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: Webfaction account with multiple apps under 1 web2py install

2013-05-01 Thread Loïc
You're right.
On my webserver :

www.domain1.com redirects to app1 ==> OK
www.domain2.com redirects to app2 ==> OK

*but*

www.domain1.com/app2 redirects to app2, and I don't understand why...

Le mercredi 1 mai 2013 15:54:08 UTC+2, Kenneth a écrit :
>
> Yeah. I follow the same pattern.
> Could you try to browse "www.domain1.com/app2" to see if it doesn't 
> direct to app2? Mine does. hmm
>
> On Wednesday, May 1, 2013 8:48:31 AM UTC-5, Loïc wrote:
>>
>> Did you restart your webserver / reload routes?
>>
>> I use a similar routes.py for multiple domains and it works fine.
>> Maybe you could try : 
>>
>> routers = dict(
>>   BASE  = dict(
>>   domains = {
>> 'www.domain1.com' : 'app1',
>> 'domain1.com' : 'app1',
>> 'www.domain2.com' : 'app2',
>> 'domain2.com' : 'app2',
>>   },
>>   applications=['app1', 'app2']
>>   ),
>> )
>>
>>
>>
>>
>>
>> Le mercredi 1 mai 2013 14:54:34 UTC+2, Kenneth a écrit :
>>>
>>> I am using the routers.domains method to routing the applications to 
>>> domains, 
>>> I have a problem that I can access to the applications which are not 
>>> routed to the assigned domain.
>>>
>>> for example
>>>
>>> routers = dict(
>>>   BASE  = dict(
>>>   domains = {
>>>   'domain1.com' : 'app1',
>>>   'domain2.com' : 'app2',
>>>   }
>>>   ),
>>> )
>>>
>>>
>>> domain2.com still has the access to app1.
>>>
>>> Should I just block the applications when users request the unassigned 
>>> applications from the controller?
>>>
>>> Thank you
>>>
>>> On Wednesday, February 1, 2012 4:14:05 PM UTC-6, Jim S wrote:

 Hi

 I've got a couple different apps I want to deploy under my web2py 
 instance on webfaction.  Unfortunately, I'm well versed in routing and 
 knowing how to route different requests to different apps.

 I have different urls that I'd like mapped to different apps.

 www.application1.com I would like to point to 
 web2py/applications/application1
 www.application2.com I would like to point to 
 web2py/applications/application2

 And, if possible, I prefer to not show the application name in the url 
 ->  www.application1.com/application1/controller/function

 Controller and function are fine but would prefer to eliminate the 
 duplicate application1.  If there is a spot in the manual I should 
 study 
 harder, please reference it.  Unfortunately, I'm relatively weak when 
 it 
 comes to url rewriting/routing and regular expressions.

  -Jim



-- 

--- 
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: getting db instance from select()

2013-05-01 Thread Cliff Kachinske
I like explicit, so some_fxn(rtn, db)

or even tighter is some_fxn(rtn, db.sometable)

On Wednesday, May 1, 2013 3:49:54 AM UTC-4, lucas wrote:
>
> i think i am asking this properly.  if i do 
>
> rtn = db(...query stuff...).select()
>
> and then pass it as a parameter to a function like
>
> some_fxn(rtn)
>
> is there a property in this rtn instance to allow me to read and access 
> the original db instance?  i need to run another query in some_fxn off of 
> db but some_fxn in located in a py file under modules and modules does seem 
> to have automatic access to db.
>
> lucas
>

-- 

--- 
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: smartgrid: how to disable repeating parent ID in child record

2013-05-01 Thread Cliff Kachinske
you could use links something like

def get_stuff(user_id):
# fetch the items for that user
# iterate through items, intersperse with BR()
# return the whole mess in a SPAN()


# Caveat: not sure of following syntax and too lazy to look it up in manual
# Just look in the writeup for smartgrid
links = [{'head': 'Purchases', 'body': lambda value, row: get_stuff(value)}]

form = SQLFORM.smartgrid(links = links)


On Tuesday, April 30, 2013 6:54:51 PM UTC-4, Alex Glaros wrote:
>
> Am returning to this question as I have a better description of what I'm 
> looking for.
>
> The example is the owner's list of all shopping purchases in a store for 
> one day.
>
> George - 10 coffee cups
>1 blender
>3 boxes of laundry soap
>
> Henry  -2 napkin holders
>
> Customer names are in the parent file, and items purchased are in the 
> child file.
>
> The store owner doesn't want to see "George, George, George", etc. listed 
> on his report. Just the one-time group header "George"
>
> Is the only way to get a formatted report in the example above to hand 
> code it?
>
> Anyone know of any examples?
>
> thanks,
>
> Alex Glaros
>
> On Saturday, March 16, 2013 11:01:18 PM UTC-7, Alex Glaros wrote:
>>
>> thanks Steve but your example doesn't have the child detail records the 
>> way mine does, so it's a different example
>>
>> pythonanywhere host seems great
>>
>> I'll hold off on this problem till later
>>
>> much appreciated,
>>
>> Alex
>>
>> On Saturday, March 16, 2013 5:39:58 AM UTC-7, 黄祥 wrote:
>>>
>>> maybe my code is similar for you, please check :
>>> https://sugizo.pythonanywhere.com/task/default/task
>>>
>>> email : us...@gmail.com
>>> password : password
>>>
>>> email : us...@gmail.com
>>> password : password
>>>
>>> if you want i can share the code.
>>> in that webapps, i'm using task, maybe you can change it into database 
>>> table : project, with the field with what you want
>>>
>>

-- 

--- 
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: response.download

2013-05-01 Thread Anthony
The problem is that the Field object or db adapter contains information 
about where the file was uploaded (and whether uploadseparate is True). 
However, when using SQLFORM.factory to upload, there is no persistent Field 
object or db adapter that can be referenced by response.download, so it has 
no way to find the file. Upload fields and response.download are really 
intended to be used with real database tables. This isn't a problem when 
uploads go into the static folder, though, because those can be served 
directly rather than going through response.download.

If you are using SQLFORM.factory, where are you storing the name of the 
saved file so you can access it for downloads?

Anthony

On Wednesday, May 1, 2013 9:56:42 AM UTC-4, Richard wrote:
>
> I think I just fall on this one...
>
> Is this issue fixed, because no ticket seems to have been open??
>
> Thanks
>
> Richard
>
>
> On Mon, Apr 29, 2013 at 5:39 AM, Domagoj Kovač 
> 
> > wrote:
>
>> Thanks! 
>>
>> -- 
>>  
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

-- 

--- 
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] HTTP status codes

2013-05-01 Thread Carl
Web2py supports a subset of HTTP status codes as listed here: 
http://en.wikipedia.org/wiki/List_of_HTTP_status_codes

The LinkedIn service I am using employs throttling and I'd like to throw a 429 
Too Many Requests exception.

Can this status code, along with other missing codes, be added to web2py in 
gluon/http.py?


-- 

--- 
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: ORM (?) : A Revisit, NOT a Rebuttal

2013-05-01 Thread Arnon Marcus

>
>  
> I didn't say there were ORM features in the DAL, just that it includes 
> features that you might otherwise expect to find in an ORM 
>

Well, it seems like a semantic-issue. DAL and ORM are pretty abstract-terms.
Here is how interpret them:
DAL - A way to construct schemas and queries without writing SQL or DBAPI 
calls.
ORM - A way to construct domain-models using a DAL in a statefull manner.

The DAL is a way of saying:
"Hey, here's a bunch of objects and methods, please generate an SQL out of 
them, send them to the database for me and give me results"

The ORM is a way of saying:
"Hey, here's a bunch of classes and attributes, please wire them up so 
their instances would communicate their state to each other, optimizing my 
transaction-operations for me as I use them"

Generally, as Massimo confirmed, the DAL is purely stateless.
It only returns dictionary-like immediate-results.


...migrations, automatic file uploads/retrieval, recursive selects, 
> automatic results serialization into HTML, virtual fields, computed fields, 
> validators, field representations, field labels, field comments, table 
> labels, list:-type fields, JSON fields, export to CSV, smart queries, 
> callbacks, record versioning, common fields, multi-tenancy, common filters, 
> GAE support, and MongoDB support?



That's a mouth-full...
Let's brake it down, shell we?:

*Multi-Tenancy, Common-Filters, Smart-Queries:*
These are SQL-related features - meaning, DAL-features, not ORM ones. 

*Common Fields, **Automatic-Migrations, CSV/HTML/XML-Exports:*
These are schema-related features - meaning, DAL/framework-features, not 
ORM ones
*
*
*Labels, Comments:*
These are schema-metadata-related features - meaning, DAL-features, not ORM 
ones.

*GAE/MongoDB:* 
Target database-support is a low-level DAL-feature - The DAL may or may not 
support specific targets - but it's not an ORM feature.

*JSON/List fields:*
These are database-related feaatures - they are adapters for data-types 
that may or may not be supported in your target-database.
The DAL may or may not support them, but they are not ORM features either 
way.

*Validators, Upload/Retrieval, **Record-Versioning, Callbacks, Record-**
Representations**:*
These are not DAL *nor *ORM features - they are framework-features. They 
are input/output adapters.
It is a way of saying: "Hey, when you get results back, run them through 
these operations".

*Virtual/Computed fields:*
These are kinda-tricky to classify.

Computed-Fields are for automating input-transformations. They are a way of 
saying:
"Hey, take these values that I'm *already** inserting to *these other 
fields, *run them through this function*, and *store the result in* that 
other field."

Virtual-Fields are for automating output-transformations. They are a way of 
saying:
"Hey, take these values that I'm *already **getting from* these other 
fields, *run them through this function*, and *produce the results as* that 
other field".

The distinctions between these features vs. the ORM-equivalent ones, are 
quite subtle and illusive, but profound.

The first difference is of scope - Virtual/Computed-fields can only be 
applied to other fields of the same Table.
In (some) ORMs they are not, because an ORM class does not necessarily have 
to be a 1:1 representation of a table.
The whole point of an ORM is to be able to construct "domain-models", not 
mere class-forms of Table-descriptions.
In the DAL, Virtual/Computed-fields can NOT generate implicit calls to 
foreign-table-fields.

The second difference is of statelessness-vs-statfullness - The DAL is 
stateless, so it can-not give values from a previous query.
ORMs are statefull in nature, so:
- For output, Virtual-fields can use *values **already stored* in those *
other-field's* cache, and *not even query* the database.
- For input, Computed-Fields can use* values **already stored* in those *
other-field's* cache, and *not even insert* them to the database.
The DAL is stateless in nature, so:
- For output, Virtual-fields *must* *query **values* from those *other-field
*, in order to invoke the functionality of the automated-output.
- For input, Computed-Fields *must insert values* to those *other fields,* in 
order to invoke the functionality of the automated-input.
** There is also cache for the DAL, but it's time-based, and not 
transaction-based.*
*
*
As for *Lazy*-virtual-fields, they are not the sort of laziness that an ORM 
has - it's a deferred-execution of the automation that is defined to run on 
the records *after* the query has returned. In ORMs there are 
deferred-queries for laziness.
*
*
*Recursive-Selects:**
*
The documentation on this feature is not cleat - it seems that it generates 
queries on your behalf, but is only useful for single-record queries, as 
it's like an Active-Record pattern - it doesn't do any transaction-level 
operation-optimizations within loops (as there are non deferred-queries).


But if you use an ORM built on top of the D

Re: [web2py] Re: response.download

2013-05-01 Thread Richard Vézina
Hello Anthony,

It's not my problem actually after more investigation and reading this
thread twice... My case is pretty weird or there is something I don't
understand... But I fall on 404, but files are there correctly named with
the proper read/write permissions... The only thing I made special is
restoring file from a zip archive into the original folder name... Nothing
really change except the date of modification that is altered. What can I
do for digger trouble shooting?

Richard


On Wed, May 1, 2013 at 10:11 AM, Anthony  wrote:

> The problem is that the Field object or db adapter contains information
> about where the file was uploaded (and whether uploadseparate is True).
> However, when using SQLFORM.factory to upload, there is no persistent Field
> object or db adapter that can be referenced by response.download, so it has
> no way to find the file. Upload fields and response.download are really
> intended to be used with real database tables. This isn't a problem when
> uploads go into the static folder, though, because those can be served
> directly rather than going through response.download.
>
> If you are using SQLFORM.factory, where are you storing the name of the
> saved file so you can access it for downloads?
>
> Anthony
>
>
> On Wednesday, May 1, 2013 9:56:42 AM UTC-4, Richard wrote:
>
>> I think I just fall on this one...
>>
>> Is this issue fixed, because no ticket seems to have been open??
>>
>> Thanks
>>
>> Richard
>>
>>
>> On Mon, Apr 29, 2013 at 5:39 AM, Domagoj Kovač wrote:
>>
>>> Thanks!
>>>
>>> --
>>>
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "web2py-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to web2py+un...@**googlegroups.com.
>>>
>>> For more options, visit 
>>> https://groups.google.com/**groups/opt_out
>>> .
>>>
>>>
>>>
>>
>>  --
>
> ---
> 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.
>
>
>

-- 

--- 
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: Webfaction account with multiple apps under 1 web2py install

2013-05-01 Thread Kenneth
:) Thank you for trying, Loic!

Should I just ignore this concern? I am not too concerned about this but I 
would like to learn about how to solve this problem.

On Wednesday, May 1, 2013 8:59:41 AM UTC-5, Loïc wrote:
>
> You're right.
> On my webserver :
>
> www.domain1.com redirects to app1 ==> OK
> www.domain2.com redirects to app2 ==> OK
>
> *but*
>
> www.domain1.com/app2 redirects to app2, and I don't understand why...
>
> Le mercredi 1 mai 2013 15:54:08 UTC+2, Kenneth a écrit :
>>
>> Yeah. I follow the same pattern.
>> Could you try to browse "www.domain1.com/app2" to see if it doesn't 
>> direct to app2? Mine does. hmm
>>
>> On Wednesday, May 1, 2013 8:48:31 AM UTC-5, Loïc wrote:
>>>
>>> Did you restart your webserver / reload routes?
>>>
>>> I use a similar routes.py for multiple domains and it works fine.
>>> Maybe you could try : 
>>>
>>> routers = dict(
>>>   BASE  = dict(
>>>   domains = {
>>> 'www.domain1.com' : 'app1',
>>> 'domain1.com' : 'app1',
>>> 'www.domain2.com' : 'app2',
>>> 'domain2.com' : 'app2',
>>>   },
>>>   applications=['app1', 'app2']
>>>   ),
>>> )
>>>
>>>
>>>
>>>
>>>
>>> Le mercredi 1 mai 2013 14:54:34 UTC+2, Kenneth a écrit :

 I am using the routers.domains method to routing the applications to 
 domains, 
 I have a problem that I can access to the applications which are not 
 routed to the assigned domain.

 for example

 routers = dict(
   BASE  = dict(
   domains = {
   'domain1.com' : 'app1',
   'domain2.com' : 'app2',
   }
   ),
 )


 domain2.com still has the access to app1.

 Should I just block the applications when users request the unassigned 
 applications from the controller?

 Thank you

 On Wednesday, February 1, 2012 4:14:05 PM UTC-6, Jim S wrote:
>
> Hi
>
> I've got a couple different apps I want to deploy under my web2py 
> instance on webfaction.  Unfortunately, I'm well versed in routing and 
> knowing how to route different requests to different apps.
>
> I have different urls that I'd like mapped to different apps.
>
> www.application1.com I would like to point to 
> web2py/applications/application1
> www.application2.com I would like to point to 
> web2py/applications/application2
>
> And, if possible, I prefer to not show the application name in the url 
> ->  www.application1.com/application1/controller/function
>
> Controller and function are fine but would prefer to eliminate the 
> duplicate application1.  If there is a spot in the manual I should 
> study 
> harder, please reference it.  Unfortunately, I'm relatively weak when 
> it 
> comes to url rewriting/routing and regular expressions.
>
>  -Jim
>
>

-- 

--- 
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: grid not ordering lambda-generated column values correctly

2013-05-01 Thread Richard Vézina
So, if I do understand correctly the Niphold explanation if I want to
search for instance the first_name of the auth_user table that is
referenced from my table I can't just pass the to SQLFORM.grid my_table, I
better pass it a join query where all the represent are replaced with the
really field of the referenced table, right?

Richard


On Mon, Aug 6, 2012 at 4:25 PM, Niphlod  wrote:

> really don't know if this is officially supported or not, but works in
> a test I just made.
>
>
> On Monday, August 6, 2012 10:06:44 PM UTC+2, Cliff Kachinske wrote:
>>
>> Maybe I missed something here.
>>
>> I know you can pass a query to grid.  By queryset do you mean a set of
>> row objects?
>>
>> On Monday, August 6, 2012 3:56:12 PM UTC-4, Niphlod wrote:
>>>
>>> this is more related to an implementation logic than a bug.
>>>
>>> fields that are represented by some other field gets computed at
>>> run-time, but to search/orderby them you have to fetch them too, and that
>>> can be expensive.
>>>
>>> If you need to orderby/search by a referenced/represented/**computed
>>> field, you can pass the full queryset to the grid.
>>>
>>> On Monday, August 6, 2012 9:07:59 PM UTC+2, Cliff Kachinske wrote:

 Me too.  It's one of the reasons I don't use grid/smartgrid.

 Sorry I don't have an answer.

 On Monday, August 6, 2012 10:18:07 AM UTC-4, weheh wrote:
>
> I have an SQLFORM.grid(... orderby=db.host.id ...) where
> db.host.id.represent=lambda value, row: int(
> db((db.url_queue.host_id == value) & (db.url_queue.removed ==
> None)).count()
> )
>
> The host.id column displays the correct numbers, but when I click on
> the column title to order ascending or descending, the order is seemingly
> random. I suspect it's ordering not by the lambda value, but rather by the
> underlying host.id value. Seems like a bug ...?
>
  --
>
>
>
>

-- 

--- 
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: HTTP status codes

2013-05-01 Thread Leonel Câmara
I guess you could add 429 to gluon.http definitions in your model and then 
use it, but I haven't tried it

Something like thin in your model

from gluon import http

http.defined_status[429] = 'Too Many Request'

And then in your controllers

raise HTTP(429)

Quarta-feira, 1 de Maio de 2013 15:13:05 UTC+1, Carl escreveu:
>
> Web2py supports a subset of HTTP status codes as listed here: 
> http://en.wikipedia.org/wiki/List_of_HTTP_status_codes
>
> The LinkedIn service I am using employs throttling and I'd like to throw a 
> 429 
> Too Many Requests exception.
>
> Can this status code, along with other missing codes, be added to web2py 
> in gluon/http.py?
>
>
>

-- 

--- 
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: HTTP status codes

2013-05-01 Thread Leonel Câmara
Watch for the typos in the previous posts I must need more coffee or 
something

Quarta-feira, 1 de Maio de 2013 15:13:05 UTC+1, Carl escreveu:
>
> Web2py supports a subset of HTTP status codes as listed here: 
> http://en.wikipedia.org/wiki/List_of_HTTP_status_codes
>
> The LinkedIn service I am using employs throttling and I'd like to throw a 
> 429 
> Too Many Requests exception.
>
> Can this status code, along with other missing codes, be added to web2py 
> in gluon/http.py?
>
>
>

-- 

--- 
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: HTTP status codes

2013-05-01 Thread Carl Roach
thanks Leonel, I'm refactoring server calls at the mo, but I'll try that
straight afterwards.


On 1 May 2013 15:56, Leonel Câmara  wrote:

> I guess you could add 429 to gluon.http definitions in your model and then
> use it, but I haven't tried it
>
> Something like thin in your model
>
> from gluon import http
>
> http.defined_status[429] = 'Too Many Request'
>
> And then in your controllers
>
> raise HTTP(429)
>
> Quarta-feira, 1 de Maio de 2013 15:13:05 UTC+1, Carl escreveu:
>
>> Web2py supports a subset of HTTP status codes as listed here:
>> http://en.wikipedia.org/**wiki/List_of_HTTP_status_codes
>>
>> The LinkedIn service I am using employs throttling and I'd like to throw
>> a 429 Too Many Requests exception.
>>
>> Can this status code, along with other missing codes, be added to web2py
>> in gluon/http.py?
>>
>>
>>  --
>
> ---
> 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/03sPc8GVBG0/unsubscribe?hl=en.
> 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.
>
>
>

-- 

--- 
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: HTTP status codes

2013-05-01 Thread Carl
works sweetly.

from gluon import HTTP
from gluon.http import defined_status
if not(429 in defined_status):
defined_status[429] = 'Too Many Requests'
raise HTTP(429, "Too Many Requests")



On Wednesday, 1 May 2013 15:57:36 UTC+1, Carl wrote:
>
> thanks Leonel, I'm refactoring server calls at the mo, but I'll try that 
> straight afterwards.
>
>
> On 1 May 2013 15:56, Leonel Câmara wrote:
>
>> I guess you could add 429 to gluon.http definitions in your model and 
>> then use it, but I haven't tried it
>>
>> Something like thin in your model
>>
>> from gluon import http
>>
>> http.defined_status[429] = 'Too Many Request'
>>
>> And then in your controllers
>>
>> raise HTTP(429)
>>
>> Quarta-feira, 1 de Maio de 2013 15:13:05 UTC+1, Carl escreveu:
>>
>>> Web2py supports a subset of HTTP status codes as listed here: 
>>> http://en.wikipedia.org/**wiki/List_of_HTTP_status_codes
>>>
>>> The LinkedIn service I am using employs throttling and I'd like to throw 
>>> a 429 Too Many Requests exception.
>>>
>>> Can this status code, along with other missing codes, be added to web2py 
>>> in gluon/http.py?
>>>
>>>
>>>  -- 
>>  
>> --- 
>> 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/03sPc8GVBG0/unsubscribe?hl=en.
>> 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.
>>  
>>  
>>
>
>

-- 

--- 
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: HTTP status codes

2013-05-01 Thread Anthony
More simply, I think you can also just do this:

raise HTTP('429 Too Many Requests')

Anthony

On Wednesday, May 1, 2013 11:33:14 AM UTC-4, Carl wrote:
>
> works sweetly.
>
> from gluon import HTTP
> from gluon.http import defined_status
> if not(429 in defined_status):
> defined_status[429] = 'Too Many Requests'
> raise HTTP(429, "Too Many Requests")
>
>
>
> On Wednesday, 1 May 2013 15:57:36 UTC+1, Carl wrote:
>>
>> thanks Leonel, I'm refactoring server calls at the mo, but I'll try that 
>> straight afterwards.
>>
>>
>> On 1 May 2013 15:56, Leonel Câmara wrote:
>>
>>> I guess you could add 429 to gluon.http definitions in your model and 
>>> then use it, but I haven't tried it
>>>
>>> Something like thin in your model
>>>
>>> from gluon import http
>>>
>>> http.defined_status[429] = 'Too Many Request'
>>>
>>> And then in your controllers
>>>
>>> raise HTTP(429)
>>>
>>> Quarta-feira, 1 de Maio de 2013 15:13:05 UTC+1, Carl escreveu:
>>>
 Web2py supports a subset of HTTP status codes as listed here: 
 http://en.wikipedia.org/**wiki/List_of_HTTP_status_codes

 The LinkedIn service I am using employs throttling and I'd like to 
 throw a 429 Too Many Requests exception.

 Can this status code, along with other missing codes, be added to 
 web2py in gluon/http.py?


  -- 
>>>  
>>> --- 
>>> 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/03sPc8GVBG0/unsubscribe?hl=en.
>>> To unsubscribe from this group and all its topics, send an email to 
>>> web2py+un...@googlegroups.com .
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>  
>>>  
>>>
>>
>>

-- 

--- 
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: HTTP status codes

2013-05-01 Thread Carl Roach
ah... the *tyranny of /w*

this works... HTTP('429 Too_Many_Requests')

In glucon/http.py HTTP regex_status isn't friendly to messages with
whitespace (or hyphens)

Thanks for pointing me to this. One line simple line beats 5 simple lines!
:)





On 1 May 2013 16:41, Anthony  wrote:

> More simply, I think you can also just do this:
>
> raise HTTP('429 Too Many Requests')
>
> Anthony
>
> On Wednesday, May 1, 2013 11:33:14 AM UTC-4, Carl wrote:
>
>> works sweetly.
>>
>> from gluon import HTTP
>> from gluon.http import defined_status
>> if not(429 in defined_status):
>> defined_status[429] = 'Too Many Requests'
>> raise HTTP(429, "Too Many Requests")
>>
>>
>>
>> On Wednesday, 1 May 2013 15:57:36 UTC+1, Carl wrote:
>>
>>> thanks Leonel, I'm refactoring server calls at the mo, but I'll try that
>>> straight afterwards.
>>>
>>>
>>> On 1 May 2013 15:56, Leonel Câmara wrote:
>>>
 I guess you could add 429 to gluon.http definitions in your model and
 then use it, but I haven't tried it

 Something like thin in your model

 from gluon import http

 http.defined_status[429] = 'Too Many Request'

 And then in your controllers

 raise HTTP(429)

 Quarta-feira, 1 de Maio de 2013 15:13:05 UTC+1, Carl escreveu:

> Web2py supports a subset of HTTP status codes as listed here:
> http://en.wikipedia.org/wiki/List_of_HTTP_status_codes
>
> The LinkedIn service I am using employs throttling and I'd like to
> throw a 429 Too Many Requests exception.
>
> Can this status code, along with other missing codes, be added to
> web2py in gluon/http.py?
>
>
>  --

 ---
 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/03sPc8GVBG0/**unsubscribe?hl=en
 .
  To unsubscribe from this group and all its topics, send an email to
 web2py+un...@**googlegroups.com.

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



>>>
>>>  --
>
> ---
> 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/03sPc8GVBG0/unsubscribe?hl=en.
> 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.
>
>
>

-- 

--- 
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: ORM (?) : A Revisit, NOT a Rebuttal

2013-05-01 Thread Anthony


> I didn't say there were ORM features in the DAL, just that it includes 
>> features that you might otherwise expect to find in an ORM 
>>
>
> Well, it seems like a semantic-issue. DAL and ORM are pretty 
> abstract-terms.
> Here is how interpret them:
> DAL - A way to construct schemas and queries without writing SQL or DBAPI 
> calls.
> ORM - A way to construct domain-models using a DAL in a statefull manner.
>

I don't think you are understanding me, so let me try to be more clear. 
Let's say an ORM is a particular design pattern for modeling data, and a 
DAL is a different design pattern for modeling data. Each of those 
different design patterns can nevertheless be used to implement similar 
types of features. For example, you might want to query the database and 
return a results set. This can be done in an ORM, and it can be done in a 
DAL. The implementation and the syntax will be different in each case, but 
they are both implementing a common feature. So, when I say the DAL 
implements features that might otherwise be found in a typical ORM, I am 
not saying the DAL implements an ORM design pattern, just that it 
replicates functionality for which you might otherwise use an ORM. For 
example, in an ORM, you can define a method in a class that returns a value 
calculated from the fields of a database record. In the web2py DAL, this 
same functionality can be achieved using a virtual field or lazy field. I 
don't know if the SQLA CORE has virtual fields, but if it doesn't, I would 
suppose it leaves this kind of functionality to the ORM.

The point is, many features found in DAL's and ORM's are not unique or 
specific to the DAL or ORM design pattern. Each design pattern can be used 
to implement many common types of functionality (the functionality may not 
be identical, but at least similar, and used to satisfy the same goals).

The ORM is a way of saying:
> "Hey, here's a bunch of classes and attributes, please wire them up so 
> their instances would communicate their state to each other, optimizing my 
> transaction-operations for me as I use them"
>

That looks like the definition of the SQLA ORM, not ORM's in general.

...migrations, automatic file uploads/retrieval, recursive selects, 
>> automatic results serialization into HTML, virtual fields, computed fields, 
>> validators, field representations, field labels, field comments, table 
>> labels, list:-type fields, JSON fields, export to CSV, smart queries, 
>> callbacks, record versioning, common fields, multi-tenancy, common filters, 
>> GAE support, and MongoDB support?
>
>
> That's a mouth-full...
> Let's brake it down, shell we?:
>

No, let's not. My point is not that any of those items properly belong to 
either a DAL or an ORM, or that they can only be implemented with either a 
DAL or an ORM design pattern. Rather, you had claimed that the SQLA CORE is 
equivalent to the web2py DAL and that all 20,000+ lines of SQLA ORM code 
must therefore be providing unique functionality not available in the DAL 
(thus implying that the ORM must be useful). I was just suggesting that the 
DAL might be doing more than the SQLA CORE (at least in some areas), and 
that the DAL might possibly be offering some features for which you would 
otherwise need the SQLA ORM.

Regarding all the features you claim are inherently DAL features and not 
ORM features, I disagree. Any one of those features could rightly be part 
of either a DAL or an ORM. They are simply features you might want to 
implement within any data modeling abstraction, whatever the design pattern.
 

> The first difference is of scope - Virtual/Computed-fields can only be 
> applied to other fields of the same Table.
>

No, they can also be applied to the results of joins (not sure if that's 
typically as easy to do in an ORM) -- see 
http://web2py.com/books/default/chapter/29/06#Old-style-virtual-fields.
 

> In the DAL, Virtual/Computed-fields can NOT generate implicit calls to 
> foreign-table-fields.
>

Yes, they can with recursive selects.
 

> The second difference is of statelessness-vs-statfullness - The DAL is 
> stateless, so it can-not give values from a previous query.
> ORMs are statefull in nature, so:
> - For output, Virtual-fields can use *values **already stored* in those *
> other-field's* cache, and *not even query* the database.
> - For input, Computed-Fields can use* values **already stored* in those *
> other-field's* cache, and *not even insert* them to the database.
> The DAL is stateless in nature, so:
> - For output, Virtual-fields *must* *query **values* from those *
> other-field*, in order to invoke the functionality of the 
> automated-output.
> - For input, Computed-Fields *must insert values* to those *other fields,* in 
> order to invoke the functionality of the automated-input.
> ** There is also cache for the DAL, but it's time-based, and not 
> transaction-based.*
>

I'm not quite sure what you mean here. Even in an ORM, in order to 
calculate the 

[web2py] Re: Webfaction account with multiple apps under 1 web2py install

2013-05-01 Thread Loïc
I would like to understand too...
Maybe somebody else has an idea ?

-- 

--- 
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: Webfaction account with multiple apps under 1 web2py install

2013-05-01 Thread Loïc
I would like to understand too...
Maybe somebody else has an idea ?

-- 

--- 
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: HTTP status codes

2013-05-01 Thread Anthony
Oops. Actually, I think this should be fixed -- I'll open an issue.

Anthony

On Wednesday, May 1, 2013 12:09:17 PM UTC-4, Carl wrote:
>
> ah... the *tyranny of /w*
>
> this works... HTTP('429 Too_Many_Requests')
>
> In glucon/http.py HTTP regex_status isn't friendly to messages with 
> whitespace (or hyphens)
>
> Thanks for pointing me to this. One line simple line beats 5 simple lines! 
> :)
>
>
>  
>
>
> On 1 May 2013 16:41, Anthony > wrote:
>
>> More simply, I think you can also just do this:
>>
>> raise HTTP('429 Too Many Requests')
>>
>> Anthony
>>
>> On Wednesday, May 1, 2013 11:33:14 AM UTC-4, Carl wrote:
>>
>>> works sweetly.
>>>
>>> from gluon import HTTP
>>> from gluon.http import defined_status
>>> if not(429 in defined_status):
>>> defined_status[429] = 'Too Many Requests'
>>> raise HTTP(429, "Too Many Requests")
>>>
>>>
>>>
>>> On Wednesday, 1 May 2013 15:57:36 UTC+1, Carl wrote:
>>>
 thanks Leonel, I'm refactoring server calls at the mo, but I'll try 
 that straight afterwards.


 On 1 May 2013 15:56, Leonel Câmara wrote:

> I guess you could add 429 to gluon.http definitions in your model and 
> then use it, but I haven't tried it
>
> Something like thin in your model
>
> from gluon import http
>
> http.defined_status[429] = 'Too Many Request'
>
> And then in your controllers
>
> raise HTTP(429)
>
> Quarta-feira, 1 de Maio de 2013 15:13:05 UTC+1, Carl escreveu:
>
>> Web2py supports a subset of HTTP status codes as listed here: 
>> http://en.wikipedia.org/wiki/List_of_HTTP_status_codes
>>
>> The LinkedIn service I am using employs throttling and I'd like to 
>> throw a 429 Too Many Requests exception.
>>
>> Can this status code, along with other missing codes, be added to 
>> web2py in gluon/http.py?
>>
>>
>>  -- 
>  
> --- 
> 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/03sPc8GVBG0/**unsubscribe?hl=en
> .
>  To unsubscribe from this group and all its topics, send an email to 
> web2py+un...@**googlegroups.com.
>
> For more options, visit 
> https://groups.google.com/**groups/opt_out
> .
>  
>  
>

  -- 
>>  
>> --- 
>> 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/03sPc8GVBG0/unsubscribe?hl=en.
>> To unsubscribe from this group and all its topics, send an email to 
>> web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

-- 

--- 
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: HTTP status codes

2013-05-01 Thread Carl Roach
thanks


On 1 May 2013 17:48, Anthony  wrote:

> Oops. Actually, I think this should be fixed -- I'll open an issue.
>
> Anthony
>
>
> On Wednesday, May 1, 2013 12:09:17 PM UTC-4, Carl wrote:
>
>> ah... the *tyranny of /w*
>>
>> this works... HTTP('429 Too_Many_Requests')
>>
>> In glucon/http.py HTTP regex_status isn't friendly to messages with
>> whitespace (or hyphens)
>>
>> Thanks for pointing me to this. One line simple line beats 5 simple
>> lines! :)
>>
>>
>>
>>
>>
>> On 1 May 2013 16:41, Anthony  wrote:
>>
>>> More simply, I think you can also just do this:
>>>
>>> raise HTTP('429 Too Many Requests')
>>>
>>> Anthony
>>>
>>> On Wednesday, May 1, 2013 11:33:14 AM UTC-4, Carl wrote:
>>>
 works sweetly.

 from gluon import HTTP
 from gluon.http import defined_status
 if not(429 in defined_status):
 defined_status[429] = 'Too Many Requests'
 raise HTTP(429, "Too Many Requests")



 On Wednesday, 1 May 2013 15:57:36 UTC+1, Carl wrote:

> thanks Leonel, I'm refactoring server calls at the mo, but I'll try
> that straight afterwards.
>
>
> On 1 May 2013 15:56, Leonel Câmara wrote:
>
>> I guess you could add 429 to gluon.http definitions in your model and
>> then use it, but I haven't tried it
>>
>> Something like thin in your model
>>
>> from gluon import http
>>
>> http.defined_status[429] = 'Too Many Request'
>>
>> And then in your controllers
>>
>> raise HTTP(429)
>>
>> Quarta-feira, 1 de Maio de 2013 15:13:05 UTC+1, Carl escreveu:
>>
>>> Web2py supports a subset of HTTP status codes as listed here:
>>> http://en.wikipedia.org/**wiki/List_of_HTTP_status_codes
>>>
>>> The LinkedIn service I am using employs throttling and I'd like to
>>> throw a 429 Too Many Requests exception.
>>>
>>> Can this status code, along with other missing codes, be added to
>>> web2py in gluon/http.py?
>>>
>>>
>>>  --
>>
>> ---
>> 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/**
>> to**pic/web2py/03sPc8GVBG0/**unsubsc**ribe?hl=en
>> .
>>  To unsubscribe from this group and all its topics, send an email to
>> web2py+un...@**googlegroups.com.
>>
>> For more options, visit 
>> https://groups.google.com/**grou**ps/opt_out
>> .
>>
>>
>>
>
>  --
>>>
>>> ---
>>> 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/03sPc8GVBG0/**unsubscribe?hl=en
>>> .
>>> To unsubscribe from this group and all its topics, send an email to
>>> web2py+un...@**googlegroups.com.
>>> For more options, visit 
>>> https://groups.google.com/**groups/opt_out
>>> .
>>>
>>>
>>>
>>
>>  --
>
> ---
> 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/03sPc8GVBG0/unsubscribe?hl=en.
> 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.
>
>
>

-- 

--- 
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: ORM (?) : A Revisit, NOT a Rebuttal

2013-05-01 Thread Derek
You don't get to define terms any way you see fit. DAL and ORM have 
specific meanings.

DAL is a TLA (three letter acronym) for "Database Abstraction Layer".
ORM is a TLA for "Object Relational Mapping".

So, what does a DAL do? Wikipedia tells us that it "... is an application 
programming 
interface which 
unifies the communication between a computer application and 
databases such 
as SQL Server , 
DB2
, MySQL , 
PostgreSQL
, Oracle  or 
SQLite. 
Traditionally, all database vendors provide their own interface tailored to 
their products which leaves it to the application programmer to implement 
code for all database interfaces he or she would like to support. Database 
abstraction layers reduce the amount of work by providing a consistent API 
to the developer and hide the database specifics behind this interface as 
much as possible. There exist many abstraction layers with different 
interfaces in numerous programming languages."

What does an ORM do? Wikipedia tells us that it "... is a 
programming technique 
for converting data between incompatible type 
systems
 in object-oriented  programming 
languages. This creates, in effect, a "virtualobject 
database" 
that can be used from within the programming language. "

So, the two terms are not mutually exclusive, but they handle different 
domains. It may be interesting to have an ORM on top of DAL, but I 
personally feel that creating YAORM (Yet Another Object Relational Mapping) 
is counter-productive especially when you could bypass the DAL and just use 
SQLA which you yourself say is the best ORM there is.

Now, perhaps what may be beneficial is to separate the DAL from the HTML 
generation and data validation logic. That way, you could plug in SQLA and 
yet your SMARTGRID and FORMs would work with all the bells and whistles.


On Wednesday, May 1, 2013 7:15:11 AM UTC-7, Arnon Marcus wrote:
>
>  
>> I didn't say there were ORM features in the DAL, just that it includes 
>> features that you might otherwise expect to find in an ORM 
>>
>
> Well, it seems like a semantic-issue. DAL and ORM are pretty 
> abstract-terms.
> Here is how interpret them:
> DAL - A way to construct schemas and queries without writing SQL or DBAPI 
> calls.
> ORM - A way to construct domain-models using a DAL in a statefull manner.
>
> The DAL is a way of saying:
> "Hey, here's a bunch of objects and methods, please generate an SQL out of 
> them, send them to the database for me and give me results"
>
> The ORM is a way of saying:
> "Hey, here's a bunch of classes and attributes, please wire them up so 
> their instances would communicate their state to each other, optimizing my 
> transaction-operations for me as I use them"
>
> Generally, as Massimo confirmed, the DAL is purely stateless.
> It only returns dictionary-like immediate-results.
>
>
> ...migrations, automatic file uploads/retrieval, recursive selects, 
>> automatic results serialization into HTML, virtual fields, computed fields, 
>> validators, field representations, field labels, field comments, table 
>> labels, list:-type fields, JSON fields, export to CSV, smart queries, 
>> callbacks, record versioning, common fields, multi-tenancy, common filters, 
>> GAE support, and MongoDB support?
>
>
>
> That's a mouth-full...
> Let's brake it down, shell we?:
>
> *Multi-Tenancy, Common-Filters, Smart-Queries:*
> These are SQL-related features - meaning, DAL-features, not ORM ones. 
>
> *Common Fields, **Automatic-Migrations, CSV/HTML/XML-Exports:*
> These are schema-related features - meaning, DAL/framework-features, not 
> ORM ones
> *
> *
> *Labels, Comments:*
> These are schema-metadata-related features - meaning, DAL-features, not 
> ORM ones.
>
> *GAE/MongoDB:* 
> Target database-support is a low-level DAL-feature - The DAL may or may 
> not support specific targets - but it's not an ORM feature.
>
> *JSON/List fields:*
> These are database-related feaatures - they are adapters for data-types 
> that may or may not be supported in your target-database.
> The DAL may or may not support them, but they are not ORM features either 
> way.
>
> *Validators, Upload/Retrieval, **Record-Versioning, Callbacks, Record-**
> Representations**:*
> These are not DAL *nor *ORM features - they are framework-features. They 
> are input/output adapters.
> It is a way of saying: "Hey, when you get results back, run them through 
> these operations".
>
> *Virtual/Computed fields:*
> These are kinda-tricky to class

[web2py] SQLFORM.grid() and Search

2013-05-01 Thread Richard
Hello,

I did some research about SQLFORM.grid() Search Question and I summarize 
what I found here :

Search requirements for me to use SQLFROM.grid() in place of Datatables.net 
:


   1. Need to be able to search the representation for referenced fields *
   (Solved)*
   2. No database field name in the Query Builder...
  - I would like the labels to be used in the Query Builder and then be 
  translated into the proper query passed to the URL *(Open, a solution 
  seems to exist)*
  3. User should have the option to search over all the fields (like 
   Datatables.net search/filter)* (Open, a solution seems to exist)*


*1)* I was searching a way to search representation of a referenced field 
and I found this answer (from Niphold) :

How to search referenced field (query with join) :
https://groups.google.com/d/msg/web2py/Z4HZNNLlyYs/lknATE2iKJoJ


*2)* But then, I realize that for the construction of the search the user 
has to know the database fields names (the labels are not taking into 
account by the query builder) in order to create his search... 

I try to solve that with SQLFROM.grid headers=HEADERS_DICT, but still the 
query constructor display the database field name and not there labels...

About that issue, I found this thread that seem to address the problem into 
a elegant way :

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

So, the solution seems to exist, but I would have to implement my own or 
reuse this one... Did this had been (could be) added built-in in 
SQLFORM.grid()??

*3)* I would like to preserve something I consider as a "feature". Actually 
I use Datatables.net almost every where I need a grid, and my users know 
how use the search/filter of Datatables, so I would have this option into 
SQLFORM.grid()...

I found this share :
https://groups.google.com/d/msg/web2py/9_1ECdKHKUo/8OISg7o8OVIJ

Again, I have to test and see how it fit beside the query builder... Having 
to different input search may be weird for user or lead to misunderstanding.


Is there other important things I should know about SQLFORM.grid() and 
search?

What the future for a better search experience with SQLFORM.grid()?

I think the greatest advantage of SQLFORM.grid() over other Javascript grid 
for instance is the ability to create a search and share it to other user 
as a link... Of course there is also the possibility to create more 
complexe query than a simple filter box. And I want these features in my 
app.

Richard

Other thread :

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

Related :

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

-- 

--- 
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: Bootstrap typeahead

2013-05-01 Thread Annet
Hi Richard,

Thanks for your reply.

The one include in web2py is not ok?
>

The problem is that it's covering the date field when it pops up.
I find it quite convenient to be able to enter a date without using
the date picker, especially with birth dates.

Furthermore, it's not styled the Bootstrap way, for jQuery UI there
is a Bootstrap CSS file available.


There is also the one of s-cubism :
>
> http://dev.s-cubism.com/plugin_anytime_widget
>


The problem with anytime is its license, I am working on a commercial
application. 
 

Best regards,

Annet

-- 

--- 
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: Comparing floats in a database query

2013-05-01 Thread Derek
Comparing floats for equality is an issue with MySQL. Floats are rarely 
equal, since the internal representation can be different than the actual 
number. You'd want to use a different data type, or make your comparison a 
greater than or less than.

On Wednesday, May 1, 2013 6:59:27 AM UTC-7, AnnG wrote:
>
> Hi,
>
> I have a DAL query which works OK when selecting integer 'float' fields 
> (eg 4.0, 5.0, 6.0)  (I'm using a MySQL database), but does not select rows 
> containing actual float numbers (eg 6.3).
>
> Here is the code
>
> for table_row in db((db.field_phenotype.field_phenotype_pk == db.
> scaninstance_fieldphenotype.field_phenotype_fk) & (db.
> scaninstance_fieldphenotype.scaninstance_fk == db.scaninstance.
> scaninstance_pk) & (db.scaninstance.patient_fk == self.patient_id) 
>
> & (db.scaninstance.age_months == age_months)  # goes wrong here
>
> ).select(db.field_phenotype.name, db.scaninstance_fieldphenotype.
> field_phenotype_value):
> ...
>
> ... The 'age_months' variable is copied from an earlier query from the 
> same table/field. That earlier query works fine, returning all floats - 
> which print out fine on my web-page.
> The query shown above only matches with rows where the 
> db.scaninstance.age_months 
> is an integer (converted to a float) eg 4.0, 5.0, 64.0
> but not for actual floats eg 6.3
>
> Can anyone help??
>
> Regards
>
> Ann
>

-- 

--- 
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] how can i login without using form?

2013-05-01 Thread Giuseppe Marchetti
can i use any function to login?
or
how can i login with function?

for ex:
gluon.tools.auth.login(a value from my database)
auth.login(db.auth_user(id)) etc..

1 Mayıs 2013 Çarşamba 01:10:57 UTC+3 tarihinde Giuseppe Marchetti yazdı:
>
> I dont get any error.. i just want to be log in.. i get all values from 
> twitter and write to my database. but it doesnt say "you r login" but all 
> the value got writen to the database.. though the database record, the 
> person cannot be logged in..
> i examinated the etti.. but it doesnt work.. cuz it records you again when 
> its your second time to visit with your twitter.. so it s problem.. it s 
> why i use rauth..
> I am so sorry about taking your time..
>
> Best regards...
>
> 1 Mayıs 2013 Çarşamba 00:53:58 UTC+3 tarihinde Michele Comitini yazdı:
>>
>> Can you send the error you are getting?
>>
>>
>> 2013/4/30 Giuseppe Marchetti 
>>
>>> Thank you for your interest Michele.. But i examinated your code for 
>>> etti from code google but it doesnt work on web2py.. i guess it works on 
>>> old version web2py..
>>> i just wonder how i can set login flag.. can i send u mail about my 
>>> screenshots?
>>> i run rauth and it works great.. but it doesnt set login flag..
>>>
>>>
>>> 30 Nisan 2013 Salı 23:06:49 UTC+3 tarihinde Michele Comitini yazdı:
>>>
 I wrote:

> I think it is very similar in scope to what you want to achieve.  See 
> it running here:
>
> http://2-etti.appspot.com/
>
> Ops sorry GAE changed something so it is not running anymore :-/

  -- 
>>>  
>>> --- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "web2py-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to web2py+un...@googlegroups.com.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>  
>>>  
>>>
>>
>>

-- 

--- 
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: Anyone used WHOOSH as search engine with web2py?

2013-05-01 Thread Derek
That's an interesting project. Have you taken a look at GIEWIKI? It's 
"tiddlywiki that runs on Google App Engine" and it is amazing.
You can see it running here:
http://giewiki.appspot.com/

It will work with most any tiddlywiki setup. The default of GIEWiki is more 
of a blog with comments, but you can install for example tbGTD or mGSD, or 
any of the other tiddlywiki variants with plugins.

And, the good news is... it has full text search via GAE.

On Tuesday, April 30, 2013 3:10:23 PM UTC-7, Brian Erickson wrote:
>
> Thanks, Massimo.
> (by the way, my project is to write a program in the style of 
> http://tiddlywiki.com/ in web2py.)
> Any full text search would work for my needs. Is there a better (simpler) 
> option you could recommend?
>
> On Monday, April 29, 2013 12:20:12 AM UTC-4, Massimo Di Pierro wrote:
>>
>> This is all I have on the topic:
>>
>> https://gist.github.com/mdipierro/5479683
>>
>>
>>
>> On Sunday, 28 April 2013 22:42:45 UTC-5, Brian Erickson wrote:
>>>
>>> Hi Select, I'm resurrecting this topic to hopefully get a clue on how to 
>>> implement this. Any help appreciated.
>>> I got the Whoosh source, unpacked and put just the folder 'whoosh' into 
>>> site-applications. I created the files you provided search.py and 
>>> search/index.html. On visiting seach.html web2py throws an error, it wants 
>>> a directory myapp/private/index. I created that and now the ticket is: 
>>>  Index 'MAIN' does not exist in 
>>> FileStorage('/usr/share/web2py/applications/noo/private/index')
>>>
>>> Don't know how to proceed. Suggestions? Thanks,
>>> Brian
>>>
>>> On Wednesday, October 13, 2010 8:34:26 AM UTC-4, select wrote:

 it's fast, it's pure python (just dump in to web2py/site-packages) and 
 simple to use 


 http://tlc2.hg.sourceforge.net/hgweb/tlc2/tlc2/file/4387b942c7ab/controllers/search.py
  

 http://tlc2.hg.sourceforge.net/hgweb/tlc2/tlc2/file/4387b942c7ab/views/search/index.html
  

 :) 

 On Oct 12, 8:38 pm, David Marko  wrote: 
 > Is there anyone who has used the whoosh (
 http://bitbucket.org/mchaput/ 
 > whoosh/wiki/Home) for full text search? If so, can you share your 
 > experience? 
 > 
 > David
>>>
>>>

-- 

--- 
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] How would one design a promotion for products using web2py?

2013-05-01 Thread bracquet
Hello all, I was wondering how to do promotions for products that have a 
time limit to it? An example of this would be Valve's Steam, where each 
individual game can have a unique promotion which ends after a certain time 
is passed. The promotion can be tied to an individual product, to groups of 
products, or all products in a site-wide promotion.

I'm thinking that each product would have a python datetime associated that 
defines the end of the promotion.

db.define_table('myproducts',
  Field('name'),
  Field('description'),
  Field('original_price'),
  Field('promo_price'),
  Field('promotion_end', 'datetime', default=None))  # 
'promotion_end' should be None if no promotion is active

Then, whenever a product is going to be on sale or something, I can update 
that product's promotion_end. A javascript timer would use this date and 
countdown from it on the website, so that the user can see how long there 
is until the promotion ends for that product. For groups of products, it's 
just updating the promotion_end for multiple products. For site-wide, I 
would just update the promotion_end for all products.

When a promotion is active, the promo_price will show (probably calculated 
dynamically depending on the how large the discount is). When the promotion 
is inactive, the original_price will show.

There are a few problems I don't understand how to solve:

- I will probably have to write a script to update the promotion_end for 
the products when a promotion is going to happen. Where will this script 
live (in the modules folder?) and when/where should it be executed?

- Since the timer is ticking down on the client-side (using a javascript 
countdown timer), how will the server know when a promotion has ended so 
that it can immediately update the site's html to hide any signs of the 
expired promotion? The server will also have to reset to its original price 
instead of the promo price and set the promotion_end to None.
  
 For example, when a promotion is active on a product, the html will 
display original_price crossed out and display the promo_price in big 
letters. When the promo is inactive, the html should show only the 
original_price and the countdown timer should not be shown at all.

- In reference to the previous question, if the server needs to keep track 
of the time left of a promotion, what happens if an email is to be sent out 
24 hours before the promotion ends? This implies that the server needs to 
consistently keep track of all active promotions and their respective end 
times. Does web2py have some sort of mechanism (maybe some sort of python 
thread?) that will actively keep track of this?

I'm not familiar with database design or web2py in-depth, so any help or 
ideas would be great.

-- 

--- 
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] Folder structure for components

2013-05-01 Thread b00m_chef
I am sure this has been brought up before, but, is there any plan to allow 
making more self-contained components. Where the model, view, and 
controller are under the same directory?

In other words, something similar to Django, where one imports the  
element containing the component, but all the code, including the component 
view are within the app folder.

I am building an app that would really benefit from the ability to organize 
my app like that.

Thanks,

-- 

--- 
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: Webfaction account with multiple apps under 1 web2py install

2013-05-01 Thread Kenneth
+1 !!

On Wednesday, May 1, 2013 11:37:20 AM UTC-5, Loïc wrote:
>
> I would like to understand too...
> Maybe somebody else has an idea ?

-- 

--- 
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: Folder structure for components

2013-05-01 Thread Niphlod
I'm not sure I follow 
let's take an hypothetical "do_this" component
you can have
controllers/do_this.py
models/do_this.py or models/do_this/whatever.py
views/do_this/index.html views/do_this/anotherindex.html (or .load, or 
.json, or .whatisneeded)

and in your view simply calling LOAD('do_this', 'index')

and all works. The only thing that is not "contained" in a folder is the 
controller file, and that's more or less the recommended structure for 
web2py plugins. If you take "the structure" a little bit further (like the 
one explained in the book at 
http://web2py.com/books/default/chapter/29/12#Plugins) you'd have also the 
admin app grouping them all in a single "manage this plugin" page. 

What do you need ? all those files in a single folder ?

-- 

--- 
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: Comparing floats in a database query

2013-05-01 Thread Niphlod
+1 . http://dev.mysql.com/doc/refman/5.0/en/problems-with-float.html



On Wednesday, May 1, 2013 8:18:03 PM UTC+2, Derek wrote:
>
> Comparing floats for equality is an issue with MySQL. Floats are rarely 
> equal, since the internal representation can be different than the actual 
> number. You'd want to use a different data type, or make your comparison a 
> greater than or less than.
>
> On Wednesday, May 1, 2013 6:59:27 AM UTC-7, AnnG wrote:
>>
>> Hi,
>>
>> I have a DAL query which works OK when selecting integer 'float' fields 
>> (eg 4.0, 5.0, 6.0)  (I'm using a MySQL database), but does not select rows 
>> containing actual float numbers (eg 6.3).
>>
>> Here is the code
>>
>> for table_row in db((db.field_phenotype.field_phenotype_pk == db.
>> scaninstance_fieldphenotype.field_phenotype_fk) & (db.
>> scaninstance_fieldphenotype.scaninstance_fk == db.scaninstance.
>> scaninstance_pk) & (db.scaninstance.patient_fk == self.patient_id) 
>>
>> & (db.scaninstance.age_months == age_months)  # goes wrong here
>>
>> ).select(db.field_phenotype.name, db.scaninstance_fieldphenotype.
>> field_phenotype_value):
>> ...
>>
>> ... The 'age_months' variable is copied from an earlier query from the 
>> same table/field. That earlier query works fine, returning all floats - 
>> which print out fine on my web-page.
>> The query shown above only matches with rows where the 
>> db.scaninstance.age_months 
>> is an integer (converted to a float) eg 4.0, 5.0, 64.0
>> but not for actual floats eg 6.3
>>
>> Can anyone help??
>>
>> Regards
>>
>> Ann
>>
>

-- 

--- 
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 would one design a promotion for products using web2py?

2013-05-01 Thread Anthony

>
> - Since the timer is ticking down on the client-side (using a javascript 
> countdown timer), how will the server know when a promotion has ended so 
> that it can immediately update the site's html to hide any signs of the 
> expired promotion? The server will also have to reset to its original price 
> instead of the promo price and set the promotion_end to None.


The HTML isn't generated once and held statically -- it is generated 
dynamically on every request. So, whenever a page for a product or products 
is requested, pull the relevant records from the db, check whether each 
product has an active promo (i.e., whether promo_end is later than 
request.now), and generate the output accordingly.

If you want an existing page to update its own contents (without a server 
refresh), you'd have to do that with Javascript, but it sounds like you're 
already planning to do that.
 

> - In reference to the previous question, if the server needs to keep track 
> of the time left of a promotion, what happens if an email is to be sent out 
> 24 hours before the promotion ends? This implies that the server needs to 
> consistently keep track of all active promotions and their respective end 
> times. Does web2py have some sort of mechanism (maybe some sort of python 
> thread?) that will actively keep track of this?
>

Maybe look into using the scheduler: 
http://web2py.com/books/default/chapter/29/04#Scheduler-(experimental)

Anthony

-- 

--- 
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] SQLFORM.grid() and Search

2013-05-01 Thread Niphlod
uhm.. 
2. seems hard but not impossible. However, what do you need specifically ? 
instead of *auth_user.first_name="hello"* just *First name="hello"* or 
*whatever 
suites me best=Hello*? What if some column names collide ?
3. unless you're referring to custom-coded filters in datatables.net, all 
it has is a single input that searches all fields in a "contains()" manner, 
i.e. if you put "a" in it it will filter all the rows where "a" is found in 
any column. That's what grid does by default if you put "a" in the main 
input field and press "search".

In other words, current search widget is easy enough for every user out 
there, extremely flexibile while retaining a "quick" way to search through 
your table . we can shift that balance a little but up to a certain 
point: it kinda has to suite everybody's needs. 

On Wednesday, May 1, 2013 7:59:07 PM UTC+2, Richard wrote:
>
> Hello,
>
> I did some research about SQLFORM.grid() Search Question and I summarize 
> what I found here :
>
> Search requirements for me to use SQLFROM.grid() in place of 
> Datatables.net :
>
>
>1. Need to be able to search the representation for referenced fields *
>(Solved)*
>2. No database field name in the Query Builder...
>   - I would like the labels to be used in the Query Builder and then 
>   be translated into the proper query passed to the URL *(Open, a 
>   solution seems to exist)*
>   3. User should have the option to search over all the fields (like 
>Datatables.net search/filter)* (Open, a solution seems to exist)*
>
>
> *1)* I was searching a way to search representation of a referenced field 
> and I found this answer (from Niphold) :
>
> How to search referenced field (query with join) :
> https://groups.google.com/d/msg/web2py/Z4HZNNLlyYs/lknATE2iKJoJ
>
>
> *2)* But then, I realize that for the construction of the search the user 
> has to know the database fields names (the labels are not taking into 
> account by the query builder) in order to create his search... 
>
> I try to solve that with SQLFROM.grid headers=HEADERS_DICT, but still the 
> query constructor display the database field name and not there labels...
>
> About that issue, I found this thread that seem to address the problem 
> into a elegant way :
>
> https://groups.google.com/forum/?fromgroups=#!topic/web2py/JVDZtZCsRTw
>
> So, the solution seems to exist, but I would have to implement my own or 
> reuse this one... Did this had been (could be) added built-in in 
> SQLFORM.grid()??
>
> *3)* I would like to preserve something I consider as a "feature". 
> Actually I use Datatables.net almost every where I need a grid, and my 
> users know how use the search/filter of Datatables, so I would have this 
> option into SQLFORM.grid()...
>
> I found this share :
> https://groups.google.com/d/msg/web2py/9_1ECdKHKUo/8OISg7o8OVIJ
>
> Again, I have to test and see how it fit beside the query builder... 
> Having to different input search may be weird for user or lead to 
> misunderstanding.
>
>
> Is there other important things I should know about SQLFORM.grid() and 
> search?
>
> What the future for a better search experience with SQLFORM.grid()?
>
> I think the greatest advantage of SQLFORM.grid() over other Javascript 
> grid for instance is the ability to create a search and share it to other 
> user as a link... Of course there is also the possibility to create more 
> complexe query than a simple filter box. And I want these features in my 
> app.
>
> Richard
>
> Other thread :
>
> https://groups.google.com/forum/?fromgroups=#!topic/web2py/hKe6lI25Bv4
>
> Related :
>
> https://groups.google.com/forum/?fromgroups=#!topic/web2py/bScnOfTCvL8
>

-- 

--- 
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: Webfaction account with multiple apps under 1 web2py install

2013-05-01 Thread Anthony
What if you add exclusive_domain=True to the BASE dict? I believe that 
prevents creating outgoing URLs like that, but not sure if it affects 
incoming requests.

Anthony

On Wednesday, May 1, 2013 12:37:11 PM UTC-4, Loïc wrote:
>
> I would like to understand too...
> Maybe somebody else has an idea ?

-- 

--- 
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: HTTP status codes

2013-05-01 Thread Niphlod
PS: having the missing one in gluon/http.py shouldn't be a 
performance-penalty. 
Send a patch for the one missing but avoid being "too much off the 
standards" (like a "750 Didn't bother to compile it")

-- 

--- 
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: grid not ordering lambda-generated column values correctly

2013-05-01 Thread Niphlod
yep. you would have to fetch those fields for searching through them anyway.

On Wednesday, May 1, 2013 4:54:28 PM UTC+2, Richard wrote:
>
> So, if I do understand correctly the Niphold explanation if I want to 
> search for instance the first_name of the auth_user table that is 
> referenced from my table I can't just pass the to SQLFORM.grid my_table, I 
> better pass it a join query where all the represent are replaced with the 
> really field of the referenced table, right?
>
> Richard
>
>
> On Mon, Aug 6, 2012 at 4:25 PM, Niphlod >wrote:
>
>> really don't know if this is officially supported or not, but works 
>> in a test I just made.
>>
>>
>> On Monday, August 6, 2012 10:06:44 PM UTC+2, Cliff Kachinske wrote:
>>>
>>> Maybe I missed something here.  
>>>
>>> I know you can pass a query to grid.  By queryset do you mean a set of 
>>> row objects?
>>>
>>> On Monday, August 6, 2012 3:56:12 PM UTC-4, Niphlod wrote:

 this is more related to an implementation logic than a bug.

 fields that are represented by some other field gets computed at 
 run-time, but to search/orderby them you have to fetch them too, and that 
 can be expensive.

 If you need to orderby/search by a referenced/represented/**computed 
 field, you can pass the full queryset to the grid.

 On Monday, August 6, 2012 9:07:59 PM UTC+2, Cliff Kachinske wrote:
>
> Me too.  It's one of the reasons I don't use grid/smartgrid.
>
> Sorry I don't have an answer.
>
> On Monday, August 6, 2012 10:18:07 AM UTC-4, weheh wrote:
>>
>> I have an SQLFORM.grid(... orderby=db.host.id ...) where
>> db.host.id.represent=lambda value, row: int(
>> db((db.url_queue.host_id == value) & (db.url_queue.removed == 
>> None)).count()
>> )
>>
>> The host.id column displays the correct numbers, but when I click on 
>> the column title to order ascending or descending, the order is 
>> seemingly 
>> random. I suspect it's ordering not by the lambda value, but rather by 
>> the 
>> underlying host.id value. Seems like a bug ...?
>>
>  -- 
>>  
>>  
>>  
>>
>
>

-- 

--- 
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: HTTP status codes

2013-05-01 Thread Anthony
There's more than just one missing -- 
http://www.iana.org/assignments/http-status-codes/http-status-codes.xml lists 
28 4xx codes alone. Perhaps we should add some of them explicitly, but we 
should also make it possible to raise other codes.

Anthony

On Wednesday, May 1, 2013 3:34:00 PM UTC-4, Niphlod wrote:
>
> PS: having the missing one in gluon/http.py shouldn't be a 
> performance-penalty. 
> Send a patch for the one missing but avoid being "too much off the 
> standards" (like a "750 Didn't bother to compile it")
>
>

-- 

--- 
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: HTTP status codes

2013-05-01 Thread Niphlod
Yep, let me be clearer: +1 on giving the possibility to raise whatever you 
may find useful but if gluon/http.py misses some standard ones, we should 
include them.

On Wednesday, May 1, 2013 9:53:02 PM UTC+2, Anthony wrote:
>
> There's more than just one missing -- 
> http://www.iana.org/assignments/http-status-codes/http-status-codes.xml lists 
> 28 4xx codes alone. Perhaps we should add some of them explicitly, but we 
> should also make it possible to raise other codes.
>
> Anthony
>
> On Wednesday, May 1, 2013 3:34:00 PM UTC-4, Niphlod wrote:
>>
>> PS: having the missing one in gluon/http.py shouldn't be a 
>> performance-penalty. 
>> Send a patch for the one missing but avoid being "too much off the 
>> standards" (like a "750 Didn't bother to compile it")
>>
>>

-- 

--- 
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] HTTP status codes

2013-05-01 Thread Carl Roach
The existing code makes it possible to raise any 3-digit status code.

raise HTTP('xxx Messsage_text')

though, see above post, spaces aren't allowed in Message_text in current
regex.



On Wednesday, 1 May 2013, Anthony wrote:

> There's more than just one missing --
> http://www.iana.org/assignments/http-status-codes/http-status-codes.xml lists
> 28 4xx codes alone. Perhaps we should add some of them explicitly, but we
> should also make it possible to raise other codes.
>
> Anthony
>
> On Wednesday, May 1, 2013 3:34:00 PM UTC-4, Niphlod wrote:
>>
>> PS: having the missing one in gluon/http.py shouldn't be a
>> performance-penalty.
>> Send a patch for the one missing but avoid being "too much off the
>> standards" (like a "750 Didn't bother to compile it")
>>
>>  --
>
> ---
> 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/03sPc8GVBG0/unsubscribe?hl=en.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com  'web2py%2bunsubscr...@googlegroups.com');>.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 

--- 
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: grid not ordering lambda-generated column values correctly

2013-05-01 Thread Richard Vézina
This is faster I guest then making a lambda db query each record each
request...

I post an other thread about SQLFORM.grid() and search if you want to
comment...

Thanks

Richard


On Wed, May 1, 2013 at 3:35 PM, Niphlod  wrote:

> yep. you would have to fetch those fields for searching through them
> anyway.
>
>
> On Wednesday, May 1, 2013 4:54:28 PM UTC+2, Richard wrote:
>
>> So, if I do understand correctly the Niphold explanation if I want to
>> search for instance the first_name of the auth_user table that is
>> referenced from my table I can't just pass the to SQLFORM.grid my_table, I
>> better pass it a join query where all the represent are replaced with the
>> really field of the referenced table, right?
>>
>> Richard
>>
>>
>> On Mon, Aug 6, 2012 at 4:25 PM, Niphlod  wrote:
>>
>>> really don't know if this is officially supported or not, but works
>>> in a test I just made.
>>>
>>>
>>> On Monday, August 6, 2012 10:06:44 PM UTC+2, Cliff Kachinske wrote:

 Maybe I missed something here.

 I know you can pass a query to grid.  By queryset do you mean a set of
 row objects?

 On Monday, August 6, 2012 3:56:12 PM UTC-4, Niphlod wrote:
>
> this is more related to an implementation logic than a bug.
>
> fields that are represented by some other field gets computed at
> run-time, but to search/orderby them you have to fetch them too, and that
> can be expensive.
>
> If you need to orderby/search by a referenced/represented/**compute**d
> field, you can pass the full queryset to the grid.
>
> On Monday, August 6, 2012 9:07:59 PM UTC+2, Cliff Kachinske wrote:
>>
>> Me too.  It's one of the reasons I don't use grid/smartgrid.
>>
>> Sorry I don't have an answer.
>>
>> On Monday, August 6, 2012 10:18:07 AM UTC-4, weheh wrote:
>>>
>>> I have an SQLFORM.grid(... orderby=db.host.id ...) where
>>> db.host.id.represent=lambda value, row: int(
>>> db((db.url_queue.host_id == value) & (db.url_queue.removed ==
>>> None)).count()
>>> )
>>>
>>> The host.id column displays the correct numbers, but when I click
>>> on the column title to order ascending or descending, the order is
>>> seemingly random. I suspect it's ordering not by the lambda value, but
>>> rather by the underlying host.id value. Seems like a bug ...?
>>>
>>  --
>>>
>>>
>>>
>>>
>>
>>  --
>
> ---
> 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.
>
>
>

-- 

--- 
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] SQLFORM.grid() and Search

2013-05-01 Thread Richard Vézina
Wasn't know about your explanation for point 3 (contains() manner), so this
one seems to be solved. Will test if we can do, a  b to
make sure it search for a & b in association in all the columns though...

About 2, I agree with you it is a bigger challenge. But I think it could
work at least for single table, because it makes no sens to give the same
label twice into the same table. In case of join, the issue could be solve
the same way we do with web2py query adding the tablename. Only difference
we should use a label for table name there too and web2py has no notion of
table label...

table_name_label.field_name_label !=, ==, etc. value searched

This map into :

table_name.field_name==value searched

?

Richard


On Wed, May 1, 2013 at 3:27 PM, Niphlod  wrote:

> uhm..
> 2. seems hard but not impossible. However, what do you need specifically ?
> instead of *auth_user.first_name="hello"* just *First name="hello"* or 
> *whatever
> suites me best=Hello*? What if some column names collide ?
> 3. unless you're referring to custom-coded filters in datatables.net, all
> it has is a single input that searches all fields in a "contains()" manner,
> i.e. if you put "a" in it it will filter all the rows where "a" is found in
> any column. That's what grid does by default if you put "a" in the main
> input field and press "search".
>
> In other words, current search widget is easy enough for every user out
> there, extremely flexibile while retaining a "quick" way to search through
> your table . we can shift that balance a little but up to a certain
> point: it kinda has to suite everybody's needs.
>
> On Wednesday, May 1, 2013 7:59:07 PM UTC+2, Richard wrote:
>>
>> Hello,
>>
>> I did some research about SQLFORM.grid() Search Question and I summarize
>> what I found here :
>>
>> Search requirements for me to use SQLFROM.grid() in place of
>> Datatables.net :
>>
>>
>>1. Need to be able to search the representation for referenced fields
>>*(Solved)*
>>2. No database field name in the Query Builder...
>>   - I would like the labels to be used in the Query Builder and then
>>   be translated into the proper query passed to the URL *(Open, a
>>   solution seems to exist)*
>>   3. User should have the option to search over all the fields (like
>>Datatables.net search/filter)* (Open, a solution seems to exist)*
>>
>>
>> *1)* I was searching a way to search representation of a referenced
>> field and I found this answer (from Niphold) :
>>
>> How to search referenced field (query with join) :
>> https://groups.google.com/d/**msg/web2py/Z4HZNNLlyYs/**lknATE2iKJoJ
>>
>>
>> *2)* But then, I realize that for the construction of the search the
>> user has to know the database fields names (the labels are not taking into
>> account by the query builder) in order to create his search...
>>
>> I try to solve that with SQLFROM.grid headers=HEADERS_DICT, but still the
>> query constructor display the database field name and not there labels...
>>
>> About that issue, I found this thread that seem to address the problem
>> into a elegant way :
>>
>> https://groups.google.com/**forum/?fromgroups=#!topic/**
>> web2py/JVDZtZCsRTw
>>
>> So, the solution seems to exist, but I would have to implement my own or
>> reuse this one... Did this had been (could be) added built-in in
>> SQLFORM.grid()??
>>
>> *3)* I would like to preserve something I consider as a "feature".
>> Actually I use Datatables.net almost every where I need a grid, and my
>> users know how use the search/filter of Datatables, so I would have this
>> option into SQLFORM.grid()...
>>
>> I found this share :
>> https://groups.google.com/d/**msg/web2py/9_1ECdKHKUo/**8OISg7o8OVIJ
>>
>> Again, I have to test and see how it fit beside the query builder...
>> Having to different input search may be weird for user or lead to
>> misunderstanding.
>>
>>
>> Is there other important things I should know about SQLFORM.grid() and
>> search?
>>
>> What the future for a better search experience with SQLFORM.grid()?
>>
>> I think the greatest advantage of SQLFORM.grid() over other Javascript
>> grid for instance is the ability to create a search and share it to other
>> user as a link... Of course there is also the possibility to create more
>> complexe query than a simple filter box. And I want these features in my
>> app.
>>
>> Richard
>>
>> Other thread :
>>
>> https://groups.google.com/**forum/?fromgroups=#!topic/**
>> web2py/hKe6lI25Bv4
>>
>> Related :
>>
>> https://groups.google.com/**forum/?fromgroups=#!topic/**
>> web2py/bScnOfTCvL8
>>
>  --
>
> ---
> You received this message because you are subsc

Re: [web2py] Re: Bootstrap typeahead

2013-05-01 Thread Richard Vézina
On Wed, May 1, 2013 at 2:10 PM, Annet  wrote:

> Hi Richard,
>
> Thanks for your reply.
>
>
> The one include in web2py is not ok?
>>
>
> The problem is that it's covering the date field when it pops up.
> I find it quite convenient to be able to enter a date without using
> the date picker, especially with birth dates.
>
>
Yeah it is not fully flexible... It does well what it does...


> Furthermore, it's not styled the Bootstrap way, for jQuery UI there
> is a Bootstrap CSS file available.
>
>
Wasn't know about that... It nice.


>
> There is also the one of s-cubism :
>>
>> http://dev.s-cubism.com/**plugin_anytime_widget
>>
>
>
> The problem with anytime is its license, I am working on a commercial
> application.
>
>

I forget about this issue.


I think you have no other option than to stick with JQuery UI, but as long
as to use only the calendar js (I don't know if it is possible), but if it
is possible it is not a big dependence since you have the bootstrap for the
CSS.

Richard



>
> Best regards,
>
> Annet
>
> --
>
> ---
> 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.
>
>
>

-- 

--- 
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] Is anyone working on a two-step login for auth? (Sometimes called two factor authentication)

2013-05-01 Thread Cliff Kachinske
If so, can you share the code?

If not, I will put it on my todo list, but there are a lot of things in 
front of it.

Thanks,
Cliff Kachinske


-- 

--- 
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] SQLFORM.grid() and Search

2013-05-01 Thread Cliff Kachinske
I like the latest search in grid/smartgrid a lot.  A very nice piece of 
work.

I do have a tiny concern about exposing table names to the world at large, 
though.  Maybe it would be possible to obfuscate the table name by 
presenting the plural of the table.  
 

On Wednesday, May 1, 2013 4:23:23 PM UTC-4, Richard wrote:
>
> Wasn't know about your explanation for point 3 (contains() manner), so 
> this one seems to be solved. Will test if we can do, a  
> b to make sure it search for a & b in association in all the columns 
> though...
>
> About 2, I agree with you it is a bigger challenge. But I think it could 
> work at least for single table, because it makes no sens to give the same 
> label twice into the same table. In case of join, the issue could be solve 
> the same way we do with web2py query adding the tablename. Only difference 
> we should use a label for table name there too and web2py has no notion of 
> table label...
>
> table_name_label.field_name_label !=, ==, etc. value searched
>
> This map into :
>
> table_name.field_name==value searched
>
> ?
>
> Richard
>
>
> On Wed, May 1, 2013 at 3:27 PM, Niphlod >wrote:
>
>> uhm.. 
>> 2. seems hard but not impossible. However, what do you need specifically 
>> ? instead of *auth_user.first_name="hello"* just *First name="hello"* or 
>> *whatever suites me best=Hello*? What if some column names collide ?
>> 3. unless you're referring to custom-coded filters in datatables.net, 
>> all it has is a single input that searches all fields in a "contains()" 
>> manner, i.e. if you put "a" in it it will filter all the rows where "a" is 
>> found in any column. That's what grid does by default if you put "a" in the 
>> main input field and press "search".
>>
>> In other words, current search widget is easy enough for every user out 
>> there, extremely flexibile while retaining a "quick" way to search through 
>> your table . we can shift that balance a little but up to a certain 
>> point: it kinda has to suite everybody's needs. 
>>
>> On Wednesday, May 1, 2013 7:59:07 PM UTC+2, Richard wrote:
>>>
>>> Hello,
>>>
>>> I did some research about SQLFORM.grid() Search Question and I summarize 
>>> what I found here :
>>>
>>> Search requirements for me to use SQLFROM.grid() in place of 
>>> Datatables.net :
>>>
>>>
>>>1. Need to be able to search the representation for referenced 
>>>fields *(Solved)*
>>>2. No database field name in the Query Builder... 
>>>   - I would like the labels to be used in the Query Builder and 
>>>   then be translated into the proper query passed to the URL *(Open, 
>>>   a solution seems to exist)*
>>>   3. User should have the option to search over all the fields 
>>>(like Datatables.net search/filter)* (Open, a solution seems to 
>>>exist)* 
>>>
>>>
>>> *1)* I was searching a way to search representation of a referenced 
>>> field and I found this answer (from Niphold) :
>>>
>>> How to search referenced field (query with join) :
>>> https://groups.google.com/d/**msg/web2py/Z4HZNNLlyYs/**lknATE2iKJoJ
>>>
>>>
>>> *2)* But then, I realize that for the construction of the search the 
>>> user has to know the database fields names (the labels are not taking into 
>>> account by the query builder) in order to create his search... 
>>>
>>> I try to solve that with SQLFROM.grid headers=HEADERS_DICT, but still 
>>> the query constructor display the database field name and not there 
>>> labels...
>>>
>>> About that issue, I found this thread that seem to address the problem 
>>> into a elegant way :
>>>
>>> https://groups.google.com/**forum/?fromgroups=#!topic/**
>>> web2py/JVDZtZCsRTw
>>>
>>> So, the solution seems to exist, but I would have to implement my own or 
>>> reuse this one... Did this had been (could be) added built-in in 
>>> SQLFORM.grid()??
>>>
>>> *3)* I would like to preserve something I consider as a "feature". 
>>> Actually I use Datatables.net almost every where I need a grid, and my 
>>> users know how use the search/filter of Datatables, so I would have this 
>>> option into SQLFORM.grid()...
>>>
>>> I found this share :
>>> https://groups.google.com/d/**msg/web2py/9_1ECdKHKUo/**8OISg7o8OVIJ
>>>
>>> Again, I have to test and see how it fit beside the query builder... 
>>> Having to different input search may be weird for user or lead to 
>>> misunderstanding.
>>>
>>>
>>> Is there other important things I should know about SQLFORM.grid() and 
>>> search?
>>>
>>> What the future for a better search experience with SQLFORM.grid()?
>>>
>>> I think the greatest advantage of SQLFORM.grid() over other Javascript 
>>> grid for instance is the ability to create a search and share it to other 
>>> user as a link... Of course there is also the possibility to create more 
>>> complexe 

Re: [web2py] HTTP status codes

2013-05-01 Thread Michele Comitini
Shouldn't be:

HTTP(750, 'Make my day')

i.e. with the code as int and a description as str?


2013/5/1 Carl Roach 

> The existing code makes it possible to raise any 3-digit status code.
>
> raise HTTP('xxx Messsage_text')
>
> though, see above post, spaces aren't allowed in Message_text in current
> regex.
>
>
>
> On Wednesday, 1 May 2013, Anthony wrote:
>
>> There's more than just one missing --
>> http://www.iana.org/assignments/http-status-codes/http-status-codes.xml lists
>> 28 4xx codes alone. Perhaps we should add some of them explicitly, but we
>> should also make it possible to raise other codes.
>>
>> Anthony
>>
>> On Wednesday, May 1, 2013 3:34:00 PM UTC-4, Niphlod wrote:
>>>
>>> PS: having the missing one in gluon/http.py shouldn't be a
>>> performance-penalty.
>>> Send a patch for the one missing but avoid being "too much off the
>>> standards" (like a "750 Didn't bother to compile it")
>>>
>>>  --
>>
>> ---
>> 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/03sPc8GVBG0/unsubscribe?hl=en.
>> 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.
>>
>>
>>
>  --
>
> ---
> 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.
>
>
>

-- 

--- 
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] bootstrap thumnails problem

2013-05-01 Thread Omi Chiba
Maybe this is not web2py issue but I'm trying to use thumnail class to 
shows the three image blocks but the text in the paragraph inside is 
strangely have too much space between the words.

Does anyone know how to adjust it?

How can we help you?

 

  {{=IMG(_src=URL('static/images','holder260_180.png'),_style="width: 
250px",_class="img-polaroid",_alt="Order Status")}}
  Order Status
  Thumbnail caption...

  
  

  {{=IMG(_src=URL('static/images','holder260_180.png'),_style="width: 
250px",_class="img-polaroid",_alt="Order Status")}}
  Q&A
  To search the Frequently Asked Questions

  
  

  {{=IMG(_src=URL('static/images','holder260_180.png'),_style="width: 
250px",_class="img-polaroid",_alt="Order Status")}}
 Contact
  Thumbnail caption...

  






-- 

--- 
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] HTTP status codes

2013-05-01 Thread Carl Roach
Two parameters for supported codes, but check http.py to() code and you'll
see parsing present for the "compressed" parameter I described.
On 1 May 2013 22:02, "Michele Comitini"  wrote:

> Shouldn't be:
>
> HTTP(750, 'Make my day')
>
> i.e. with the code as int and a description as str?
>
>
> 2013/5/1 Carl Roach 
>
>> The existing code makes it possible to raise any 3-digit status code.
>>
>> raise HTTP('xxx Messsage_text')
>>
>> though, see above post, spaces aren't allowed in Message_text in current
>> regex.
>>
>>
>>
>> On Wednesday, 1 May 2013, Anthony wrote:
>>
>>> There's more than just one missing --
>>> http://www.iana.org/assignments/http-status-codes/http-status-codes.xml 
>>> lists
>>> 28 4xx codes alone. Perhaps we should add some of them explicitly, but we
>>> should also make it possible to raise other codes.
>>>
>>> Anthony
>>>
>>> On Wednesday, May 1, 2013 3:34:00 PM UTC-4, Niphlod wrote:

 PS: having the missing one in gluon/http.py shouldn't be a
 performance-penalty.
 Send a patch for the one missing but avoid being "too much off the
 standards" (like a "750 Didn't bother to compile it")

  --
>>>
>>> ---
>>> 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/03sPc8GVBG0/unsubscribe?hl=en.
>>> 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.
>>>
>>>
>>>
>>  --
>>
>> ---
>> 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.
>>
>>
>>
>
>  --
>
> ---
> 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/03sPc8GVBG0/unsubscribe?hl=en.
> 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.
>
>
>

-- 

--- 
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: ORM (?) : A Revisit, NOT a Rebuttal

2013-05-01 Thread Michele Comitini
Why not write a driver for SQLA that speaks DAL instead of a sql dialect?


2013/5/1 Derek 

> You don't get to define terms any way you see fit. DAL and ORM have
> specific meanings.
>
> DAL is a TLA (three letter acronym) for "Database Abstraction Layer".
> ORM is a TLA for "Object Relational Mapping".
>
> So, what does a DAL do? Wikipedia tells us that it "... is an application
> programming 
> interface 
> which
> unifies the communication between a computer application and 
> databases such
> as SQL Server , 
> DB2
> , MySQL , 
> PostgreSQL
> , Oracle  or 
> SQLite.
> Traditionally, all database vendors provide their own interface tailored to
> their products which leaves it to the application programmer to implement
> code for all database interfaces he or she would like to support. Database
> abstraction layers reduce the amount of work by providing a consistent API
> to the developer and hide the database specifics behind this interface as
> much as possible. There exist many abstraction layers with different
> interfaces in numerous programming languages."
>
> What does an ORM do? Wikipedia tells us that it "... is a 
> programming technique
> for converting data between incompatible type 
> systems
>  in object-oriented  programming
> languages. This creates, in effect, a "virtualobject 
> database"
> that can be used from within the programming language. "
>
> So, the two terms are not mutually exclusive, but they handle different
> domains. It may be interesting to have an ORM on top of DAL, but I
> personally feel that creating YAORM (Yet Another Object Relational Mapping)
> is counter-productive especially when you could bypass the DAL and just use
> SQLA which you yourself say is the best ORM there is.
>
> Now, perhaps what may be beneficial is to separate the DAL from the HTML
> generation and data validation logic. That way, you could plug in SQLA and
> yet your SMARTGRID and FORMs would work with all the bells and whistles.
>
>
> On Wednesday, May 1, 2013 7:15:11 AM UTC-7, Arnon Marcus wrote:
>>
>>
>>> I didn't say there were ORM features in the DAL, just that it includes
>>> features that you might otherwise expect to find in an ORM
>>>
>>
>> Well, it seems like a semantic-issue. DAL and ORM are pretty
>> abstract-terms.
>> Here is how interpret them:
>> DAL - A way to construct schemas and queries without writing SQL or DBAPI
>> calls.
>> ORM - A way to construct domain-models using a DAL in a statefull manner.
>>
>> The DAL is a way of saying:
>> "Hey, here's a bunch of objects and methods, please generate an SQL out
>> of them, send them to the database for me and give me results"
>>
>> The ORM is a way of saying:
>> "Hey, here's a bunch of classes and attributes, please wire them up so
>> their instances would communicate their state to each other, optimizing my
>> transaction-operations for me as I use them"
>>
>> Generally, as Massimo confirmed, the DAL is purely stateless.
>> It only returns dictionary-like **immediate-results.
>>
>>
>> ...migrations, automatic file uploads/retrieval, recursive selects,
>>> automatic results serialization into HTML, virtual fields, computed fields,
>>> validators, field representations, field labels, field comments, table
>>> labels, list:-type fields, JSON fields, export to CSV, smart queries,
>>> callbacks, record versioning, common fields, multi-tenancy, common filters,
>>> GAE support, and MongoDB support?
>>
>>
>>
>> That's a mouth-full...
>> Let's brake it down, shell we?:
>>
>> *Multi-Tenancy, Common-Filters, Smart-Queries:*
>> These are SQL-related features - meaning, DAL-features, not ORM ones.
>>
>> *Common Fields, **Automatic-Migrations, CSV/HTML/XML-Exports:*
>> These are schema-related features - meaning, DAL/framework-**features,
>> not ORM ones
>> *
>> *
>> *Labels, Comments:*
>> These are schema-metadata-related features - meaning, DAL-features, not
>> ORM ones.
>>
>> *GAE/MongoDB:*
>> Target database-support is a low-level DAL-feature - The DAL may or may
>> not support specific targets - but it's not an ORM feature.
>>
>> *JSON/List fields:*
>> These are database-related feaatures - they are adapters for data-types
>> that may or may not be supported in your target-database.
>> The DAL may or may not support them, but they are not ORM features either
>> way.
>>
>> *Validators, Upload/Retrieval, **Record-Versioning, Callbacks, Record-**
>> Representations**:*
>> These are not DAL *nor *ORM features - they are framework

[web2py] Re: Anyone used WHOOSH as search engine with web2py?

2013-05-01 Thread andrej burja
hi

i was testing solr and whoosh

now i'm using whoosh because it is python based and i can easily port my 
application (no need to intall java, tomcat etc)

newer had any real problems

most of the time i spend figuring out how to use stemmer/lematization (not 
for english), but this is not part of whoosh

andrej

On Tuesday, October 12, 2010 8:38:46 PM UTC+2, David Marko wrote:
>
> Is there anyone who has used the whoosh (http://bitbucket.org/mchaput/ 
> whoosh/wiki/Home ) for 
> full text search? If so, can you share your 
> experience? 
>
> David 
>

-- 

--- 
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] HTTP status codes

2013-05-01 Thread Michele Comitini
you are right! that's horrible

I would put a new parameter

HTTP(status, body='', status_msg='')

inside the __init__:

if status_msg:
   defined_status[status] = status_msg



2013/5/1 Carl Roach 

> Two parameters for supported codes, but check http.py to() code and you'll
> see parsing present for the "compressed" parameter I described.
> On 1 May 2013 22:02, "Michele Comitini" 
> wrote:
>
>> Shouldn't be:
>>
>> HTTP(750, 'Make my day')
>>
>> i.e. with the code as int and a description as str?
>>
>>
>> 2013/5/1 Carl Roach 
>>
>>> The existing code makes it possible to raise any 3-digit status code.
>>>
>>> raise HTTP('xxx Messsage_text')
>>>
>>> though, see above post, spaces aren't allowed in Message_text in current
>>> regex.
>>>
>>>
>>>
>>> On Wednesday, 1 May 2013, Anthony wrote:
>>>
 There's more than just one missing --
 http://www.iana.org/assignments/http-status-codes/http-status-codes.xml 
 lists
 28 4xx codes alone. Perhaps we should add some of them explicitly, but we
 should also make it possible to raise other codes.

 Anthony

 On Wednesday, May 1, 2013 3:34:00 PM UTC-4, Niphlod wrote:
>
> PS: having the missing one in gluon/http.py shouldn't be a
> performance-penalty.
> Send a patch for the one missing but avoid being "too much off the
> standards" (like a "750 Didn't bother to compile it")
>
>  --

 ---
 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/03sPc8GVBG0/unsubscribe?hl=en.
 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.



>>>  --
>>>
>>> ---
>>> 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.
>>>
>>>
>>>
>>
>>  --
>>
>> ---
>> 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/03sPc8GVBG0/unsubscribe?hl=en.
>> 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.
>>
>>
>>
>  --
>
> ---
> 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.
>
>
>

-- 

--- 
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: ORM (?) : A Revisit, NOT a Rebuttal

2013-05-01 Thread Cliff Kachinske
I started doing this stuff hand hacking SELECT, INSERT, DELETE and UPDATE 
statements and feeding them into MySQL via PHP.  It was tedious, boring and 
error prone.

This is probably not a typical background, but it is the one I have.

Given my experience, the Web2py DAL feels great.  The whole concept behind 
it is very straightforward: get a request from the controller, manipulate 
the data and pass a response back.

Also, working with the DAL is more akin to configuration than it is to 
programming.  It's a little faster and way less error prone.  

In my brief encounters with ORMs, they have seemed squishy and obtuse; 
overly complicated.

So I don't see the value of fitting an ORM layer on top of the DAL.  But 
some might.  I would propose that the best way to get others on board would 
be to channel the energy being burned on this thread into an implementable 
design or even a set of specific software requirements or pseudo code.




On Saturday, April 27, 2013 9:18:45 AM UTC-4, Arnon Marcus wrote:
>
> I am in the process of researching ways to improve the structure of my 
> web2py-app's code, simplifying usage of certain areas, and enabling 
> RPC-like interface for external programs.
>
> I use web2py for over 3 years now, and love every aspect of it - 
> especially the DAL (!)
>
> However, as the code grew larger, and 
> as hierarchical domain-model-patterns started to emerge, I started to look 
> for alternative ways of accessing and using the portion of the data-model 
> that is strictly hierarchical in nature.
>
> It is a huge controversial issue with relational-data-models which contain 
> hierarchies. I don't intend to open a large discussion about this here. 
> Suffice it to say, that even the most die-hard SQL lover, would admit 
> it's shortcomings when hierarchies are introduces into the data-mode. It is 
> an unsolved (probably "unsolvable") problem in data-model theory.
>
> So it is no a matter of looking fot the "best" solution, because there can 
> not exist such a concept - even in theory.
>
> It is a matter of looking for the "most-fitting" set of trade-offs for the 
> problem at hand.
>
> That said, some projects are large and/or varied enough, that they *DO 
> *include 
> both *highly-relational* areas*,* *as well as* *highly-hierarchical*
>  areas *- within the same data-model (!)* 
>
> For such use-cases, a more flexible/hybrid approach is beneficial.
> You don't expect to have to choose either/or relational-models 
> vs. hierarchical-models - you expect your framework to include and 
> facilitate support for both approaches for the same database.
> You would use the relational-features of the framework for when it is most 
> suited for, and hierarchical-features for when IT makes better sense.
> Ideally, your framework would be built in an integrated-yet-layered 
> design, that would make it easy for you to accomplish both approaches in 
> a synergetic manner.
>
>
> My research has led me through ZODB and SQLAlchemy, just to get a feel for 
> what an ORM could provide. Aside from reading a lot and watching a lot of 
> lectures about these technologies, as well as general opinions about them, 
> I have also taken the time to *really go through tons of threads in this 
> group about these issues. as well as the web2py documentation.*
>
> Bottom-line, my current feelings about this issue, is that there is still 
> something missing in web2py to facilitate the construction of higher-levels 
> of abstractions, that are more focused on business-logic than 
> database-schema. I also feel that there are "dogmatic" sentiments being 
> thrown from both sides of the fence in this flame-fest fiasco.
> I think this hurts us - a lot.
>
> I think a more constructive approach would be to acknowledge that there 
> are different use-cases that can benefit from different approaches, and 
> that this leads to opposing opinions regarding certain trade-off that are 
> being sought after.
>
> I think that web2py has taken an approach that is still too narrow-minded 
> when it comes to supporting multiple-approaches, and that a layered-design 
> could be beneficial here.
>
> Case in point, the philosophy and design of SQLAlchemy:
> http://www.youtube.com/watch?v=uvFBXxftvN4
>
> Now, just to be clear, I think that the web2py-DAL's API is much cleaner, 
> simpler, and more easy and fun to use than SQA's API, at least for the 
> SQL-Expression layer. But I also think that SQA's is a more flexible 
> approach - it can target a more varied set of use-cases.
> Contrary to most of what I've read about SQA in this group, it's ORM is 
> NOT mandatory, nor is it a "necessarily" 
> more-restrictive/less-performant way of using the database. I think most 
> criticisms I've seen here of it, are ill-informed, and have a somewhat 
> "prima-facie" smell to them. They mainly attack the ORM concept in it's 
> Active-Record form, which is NOT what SQA has. They also don't consider the 
> layered-architecture of SQA, and 

[web2py] @make_member_of() decorator

2013-05-01 Thread Vinicius Assef
I created a decorator to allow binding a function to a Table instance.

IMHO, this helps organizing models, creating something similar to
Django's managers.

To an example, see: https://gist.github.com/viniciusban/5497532

To get an scaffolding application with organized model files and this
decorator embedded, visit https://github.com/viniciusban/my_welcome

Hope this helps somebody.

Massimo, what do you think about embedding this decorator (or
something better) in web2py, to allow creating table methods?

--
Vinicius Assef

-- 

--- 
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] Coping with new behavior of _referenced_by

2013-05-01 Thread Michael Ellis
I've got an app from before 2.0 with wizard-generated code in multiple 
views that looks similar to this.

{{=form}}
{{for t,f in db.t_sys_config._referenced_by:}}{{if not 
t[-8:]=='_archive':}}[{{=A(t[2:],_href=URL('%s_select'%t[2:],args=(f,form.record.id)))}}]{{pass}}{{pass}}
 


Under web2py 2.4.6, the for loop throws a ticket because *_referenced_by*is 
returning a list of Field objects instead of tuples. The app is running 
in almost 100 different servers on 1.99.  How can I modify the app code 
(without doing something kludgey like detecting web2py versions) so it will 
run under any web2py version?

Thanks,
Mike

-- 

--- 
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: @make_member_of() decorator

2013-05-01 Thread Anthony
Is this different from using Field.Method: 
http://web2py.com/books/default/chapter/29/06#New-style-virtual-fields

Anthony

On Wednesday, May 1, 2013 5:34:48 PM UTC-4, viniciusban wrote:
>
> I created a decorator to allow binding a function to a Table instance. 
>
> IMHO, this helps organizing models, creating something similar to 
> Django's managers. 
>
> To an example, see: https://gist.github.com/viniciusban/5497532 
>
> To get an scaffolding application with organized model files and this 
> decorator embedded, visit https://github.com/viniciusban/my_welcome 
>
> Hope this helps somebody. 
>
> Massimo, what do you think about embedding this decorator (or 
> something better) in web2py, to allow creating table methods? 
>
> -- 
> Vinicius Assef 
>

-- 

--- 
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] HTTP status codes

2013-05-01 Thread Anthony


> HTTP(750, 'Make my day')
>

No, the second argument is the response body, not the status code 
description. Currently, there is no way to specify a separate text 
description for a numeric status code (though, as shown in other examples, 
you can have a string status that includes both the code and the 
description -- but at the moment, spaces are not allowed in the 
description).

Anthony 

-- 

--- 
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] Janrain and ie10 problems

2013-05-01 Thread Russ King
I can't seem to get past the cross domain receiver page with web2py app 
using Janrain setup as per latest template app and ie10. It seems to work 
fine with Chrome, Firefox and ie9. Does this work for everybody else? - 
there seem to be older issues with Janrain and ie and some tweaks to older 
setups that called rpxnow rather than use_janrain are on web2py slices but 
would like some suggestions on best way forward and if anyone else has 
encountered or solved this issue?
 

-- 

--- 
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] HTTP status codes

2013-05-01 Thread Anthony
Feel free to comment: 
https://code.google.com/p/web2py/issues/detail?id=1469&start=100

On Wednesday, May 1, 2013 5:21:05 PM UTC-4, Michele Comitini wrote:
>
> you are right! that's horrible
>
> I would put a new parameter
>
> HTTP(status, body='', status_msg='')
>
> inside the __init__:
>
> if status_msg:
>defined_status[status] = status_msg
>
>
>
> 2013/5/1 Carl Roach >
>
>> Two parameters for supported codes, but check http.py to() code and 
>> you'll see parsing present for the "compressed" parameter I described.
>>  On 1 May 2013 22:02, "Michele Comitini" 
>> > 
>> wrote:
>>
>>> Shouldn't be:
>>>
>>> HTTP(750, 'Make my day')
>>>
>>> i.e. with the code as int and a description as str?
>>>
>>>
>>> 2013/5/1 Carl Roach >
>>>
 The existing code makes it possible to raise any 3-digit status code.

 raise HTTP('xxx Messsage_text')

 though, see above post, spaces aren't allowed in Message_text in 
 current regex.



 On Wednesday, 1 May 2013, Anthony wrote:

> There's more than just one missing -- 
> http://www.iana.org/assignments/http-status-codes/http-status-codes.xml 
> lists 
> 28 4xx codes alone. Perhaps we should add some of them explicitly, but we 
> should also make it possible to raise other codes.
>
> Anthony
>
> On Wednesday, May 1, 2013 3:34:00 PM UTC-4, Niphlod wrote:
>>
>> PS: having the missing one in gluon/http.py shouldn't be a 
>> performance-penalty. 
>> Send a patch for the one missing but avoid being "too much off the 
>> standards" (like a "750 Didn't bother to compile it")
>>
>>  -- 
>  
> --- 
> 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/03sPc8GVBG0/unsubscribe?hl=en
> .
> 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.
>  
>  
>
  -- 
  
 --- 
 You received this message because you are subscribed to the Google 
 Groups "web2py-users" group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to web2py+un...@googlegroups.com .
 For more options, visit https://groups.google.com/groups/opt_out.
  
  

>>>
>>>  -- 
>>>  
>>> --- 
>>> 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/03sPc8GVBG0/unsubscribe?hl=en.
>>> To unsubscribe from this group and all its topics, send an email to 
>>> web2py+un...@googlegroups.com .
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>  
>>>  
>>>
>>  -- 
>>  
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

-- 

--- 
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: ORM (?) : A Revisit, NOT a Rebuttal

2013-05-01 Thread Arnon Marcus
I am not re-defining terms - I understand them correctly.
An ORM is a "Mapping" between "Objects", and "Relations".

Here are the parts of the wikipedia pages, that are actually-relevant* * to 
this discussion (important parts in bold-text):

*ORM:*
"...Data management  tasks in 
object-oriented (OO) programming are typically implemented by manipulating *
objects  that are 
almost always non-scalar **
 values.* For example, consider an address book entry that represents *a 
single person along with zero or more phone numbers and zero or more 
addresses*. This could be modeled in an object-oriented implementation by a 
"Person object " 
with attributes/fields  to 
hold each data item that the entry comprises: the person's name, *a list of 
phone numbers, and a list of addresses.* The list of phone numbers would 
itself *contain "PhoneNumber objects" *and so on. The address book entry is 
treated as a single object by the programming language (it can be 
referenced by a single variable containing a pointer to the object, for 
instance). *Various methods can be associated with the object, such as a 
method to return the preferred phone number, the home address*, and so on."

The first thing to notice here, is that an ORM object-attribute can contain 
NON-SCALAR values - meaning, a link to a list of other objects. There is no 
feature in web2py that generates such an object.

The second thing to notice here, is that the attributes of an ORM object 
usually contain child-objects (plural) that represent fields from a 
different table than the parent-object. Again, there is no feature in 
web2py that can generate such an object. A JOIN operation may return row 
objects, each of which may contain sub-attributes that hold A SINGLE 
field-value 
from a foreign-table, but it is a *scalar-value*  - NOT another *
domain-entity-object* (with it's own attributes, etc.), NOR a SEQUENCE of 
*domain-entity 
objects* 

Here are some diagrams that presents it really well:







The crucial thing to notice here is that an ORM object-attribute can 
contain NON-SCALAR values - meaning, a link to a list of other objects, 
which themselves may contain links to other objects/sequences-of-objects, 
etc.


As for DAL, here is the part of the wilipedia page, that is relevant to 
this discussion:

"...*Popular use for database abstraction layers* are among object-oriented 
programming  
languages, 
which are similar to API level abstraction layers. In an object oriented 
language like C++ or Java, *a database can be represented through an **
object* *, whose 
methods and members* (or the equivalent thereof in other programming 
languages)* represent various functionalities of the database.* They also 
share the same advantages and disadvantages as API level interfaces."

As you can see, even wikipedia says that there is more to a DAL than just 
the SQL translation.

Here is another usage of the same "Three Letter Acronym" (DAL), that 
represents how an ORM is layered on-top of a DAL:




Obviously, THIS dal is not an abstraction-layer, but an access-layer, but 
it could very-well be substituted by an abstraction-layer that does the 
same thing.

Granted, this is a different form of an ORM, directly mapping 
class-attributes to table-fields, but in principal it is the same - an ORM 
is a layer on-top a DAL, that uses a DAL.



-- 

--- 
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: @make_member_of() decorator

2013-05-01 Thread Vinicius Assef
Yes, completely different.

Virtual fields/methods are defined at row level and receives row as
argument. @make_member_of() defines a method at table level.

For references, see this slide:
http://effectivedjango.com/slides/tutorial/models.html#5
And this documentation:
https://docs.djangoproject.com/en/1.5/topics/db/managers/

TL;DR version: managers are functions that make common queries in a
table, avoiding code repetition throughout an application.

--
Vinicius Assef


On Wed, May 1, 2013 at 6:52 PM, Anthony  wrote:
> Is this different from using Field.Method:
> http://web2py.com/books/default/chapter/29/06#New-style-virtual-fields
>
> Anthony
>
>
> On Wednesday, May 1, 2013 5:34:48 PM UTC-4, viniciusban wrote:
>>
>> I created a decorator to allow binding a function to a Table instance.
>>
>> IMHO, this helps organizing models, creating something similar to
>> Django's managers.
>>
>> To an example, see: https://gist.github.com/viniciusban/5497532
>>
>> To get an scaffolding application with organized model files and this
>> decorator embedded, visit https://github.com/viniciusban/my_welcome
>>
>> Hope this helps somebody.
>>
>> Massimo, what do you think about embedding this decorator (or
>> something better) in web2py, to allow creating table methods?
>>
>> --
>> Vinicius Assef
>
> --
>
> ---
> 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.
>
>

-- 

--- 
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: https for login

2013-05-01 Thread smaddox

>    request.requires_https()

Newbie question: Where to you actually insert this?

-- 

--- 
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: Webfaction account with multiple apps under 1 web2py install

2013-05-01 Thread Kenny Chung
Thank you as always, Anthony. Working great. ;)


On Wed, May 1, 2013 at 2:29 PM, Anthony  wrote:

> What if you add exclusive_domain=True to the BASE dict? I believe that
> prevents creating outgoing URLs like that, but not sure if it affects
> incoming requests.
>
> Anthony
>
>
> On Wednesday, May 1, 2013 12:37:11 PM UTC-4, Loïc wrote:
>>
>> I would like to understand too...
>> Maybe somebody else has an idea ?
>
>  --
>
> ---
> 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/1hSkZ4o99h4/unsubscribe?hl=en.
> 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.
>
>
>

-- 

--- 
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: ORM (?) : A Revisit, NOT a Rebuttal

2013-05-01 Thread villas
I am not as learned in these things but it seems to me that a DAL is a 
small black box,  whilst an ORM is a larger black box.

If I look inside the DAL 'black box',  I can just about figure out what's 
going on.  If I look inside an ORM black box,  it is already too complex 
(for me).

If we add the two black boxes together,  it would only be maintainable by 
someone of Massimo's skill level (and even he thought it was too complex 
for his needs,  hence the DAL!).  I cannot imagine that anyone would commit 
themselves to such a project.  

Perhaps we should try to list some of the benefits?  Otherwise we shall 
remain theorists in pursuit of a hypothetical abstraction - which never 
looks good on a CV.



On Wednesday, May 1, 2013 11:02:38 PM UTC+1, Arnon Marcus wrote:
>
> I am not re-defining terms - I understand them correctly.
> An ORM is a "Mapping" between "Objects", and "Relations".
>
> Here are the parts of the wikipedia pages, that are actually-relevant* * to 
> this discussion (important parts in bold-text):
>
> *ORM:*
> "...Data management  tasks 
> in object-oriented (OO) programming are typically implemented by 
> manipulating *objects 
> that 
> are almost always non-scalar
> ** values.* For example, consider an address book entry that represents *a 
> single person along with zero or more phone numbers and zero or more 
> addresses*. This could be modeled in an object-oriented implementation by 
> a "Person object " 
> with attributes/fields to 
> hold each data item that the entry comprises: the person's name, *a list 
> of phone numbers, and a list of addresses.* The list of phone numbers 
> would itself *contain "PhoneNumber objects" *and so on. The address book 
> entry is treated as a single object by the programming language (it can be 
> referenced by a single variable containing a pointer to the object, for 
> instance). *Various methods can be associated with the object, such as a 
> method to return the preferred phone number, the home address*, and so 
> on."
>
> The first thing to notice here, is that an ORM object-attribute can 
> contain NON-SCALAR values - meaning, a link to a list of other objects. 
> There is no feature in web2py that generates such an object.
>
> The second thing to notice here, is that the attributes of an ORM object 
> usually contain child-objects (plural) that represent fields from a 
> different table than the parent-object. Again, there is no feature in 
> web2py that can generate such an object. A JOIN operation may return row 
> objects, each of which may contain sub-attributes that hold A SINGLE 
> field-value 
> from a foreign-table, but it is a *scalar-value*  - NOT another *
> domain-entity-object* (with it's own attributes, etc.), NOR a SEQUENCE of 
> *domain-entity objects* 
>
> Here are some diagrams that presents it really well:
>
> 
>
> 
>
>
> 
>
> The crucial thing to notice here is that an ORM object-attribute can 
> contain NON-SCALAR values - meaning, a link to a list of other objects, 
> which themselves may contain links to other objects/sequences-of-objects, 
> etc.
>
>
> As for DAL, here is the part of the wilipedia page, that is relevant to 
> this discussion:
>
> "...*Popular use for database abstraction layers* are among object-oriented 
> programming  
> languages, 
> which are similar to API level abstraction layers. In an object oriented 
> language like C++ or Java, *a database can be represented through an **
> object* *, whose 
> methods and members* (or the equivalent thereof in other programming 
> languages)* represent various functionalities of the database.* They also 
> share the same advantages and disadvantages as API level interfaces."
>
> As you can see, even wikipedia says that there is more to a DAL than just 
> the SQL translation.
>
> Here is another usage of the same "Three Letter Acronym" (DAL), that 
> represents how an ORM is layered on-top of a DAL:
>
>
> 
>
>
> 
> Obviously, THIS dal is not an abstraction-layer, but an access-layer, but 
> it could very-well be substituted by an abstraction-layer that does the 
> same thing.
>
> Granted, this is a different form of an ORM, directly mapping 
> class-attribute

[web2py] Re: getting db instance from select()

2013-05-01 Thread lucas
agreed, and that is what i wound up doing.  thanx.  lucas

-- 

--- 
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 lost headers after deployment to server

2013-05-01 Thread San L


Based on this documentation

The request.env.http_* variables are parsed from the request HTTP header.

in http://web2py.com/books/default/chapter/29/04#request

I use request.env.http_mykey to get a variable in header. It works in my 
local. But request.env.http_mykey returns None in server. We are using 
nginx+ uwsgi. Something am I missing?

Thanks


this is stackoverflow link  
http://stackoverflow.com/questions/16327212/web2py-lost-headers-after-deployment-to-server




-- 

--- 
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: ORM (?) : A Revisit, NOT a Rebuttal

2013-05-01 Thread Anthony


> The first thing to notice here, is that an ORM object-attribute can 
> contain NON-SCALAR values - meaning, a link to a list of other objects. 
> There is no feature in web2py that generates such an object.
>
> The second thing to notice here, is that the attributes of an ORM object 
> usually contain child-objects (plural) that represent fields from a 
> different table than the parent-object. Again, there is no feature in 
> web2py that can generate such an object. A JOIN operation may return row 
> objects, each of which may contain sub-attributes that hold A SINGLE 
> field-value 
> from a foreign-table, but it is a *scalar-value*  - NOT another *
> domain-entity-object* (with it's own attributes, etc.), NOR a SEQUENCE of 
> *domain-entity objects* 
>

> ...
>  

The crucial thing to notice here is that an ORM object-attribute can 
> contain NON-SCALAR values - meaning, a link to a list of other objects, 
> which themselves may contain links to other objects/sequences-of-objects, 
> etc.
>

Although ORM's may do that, such a feature is not unique to the ORM 
pattern. In the web2py DAL, for example, in a Row object with a reference 
to another table, the reference field is actually a DAL.Reference object, 
not a scalar value (it includes the scalar value but also allows access to 
related records in the referenced table). Similarly, a Row object from a 
table that is referenced by another table includes an attribute that is a 
DAL.LazySet object (also not a scalar), which allows access to the records 
in the referencing table that reference the current Row object. The DAL 
also has list:-type fields, whose values are lists, including lists of 
DAL.Reference objects in the case of list:reference fields. Row objects can 
also include methods (i.e., "lazy" virtual fields).

Anthony


-- 

--- 
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: ORM (?) : A Revisit, NOT a Rebuttal

2013-05-01 Thread Arnon Marcus


Well, it seems like a semantic-issue. DAL and ORM are pretty abstract-terms.
>> Here is how interpret them:
>> DAL - A way to construct schemas and queries without writing SQL or DBAPI 
>> calls.
>> ORM - A way to construct domain-models using a DAL in a statefull manner.
>>
>
> I don't think you are understanding me, so let me try to be more clear. 
> Let's say an ORM is a particular design pattern for modeling data, and a 
> DAL is a different design pattern for modeling data. Each of those 
> different design patterns can nevertheless be used to implement similar 
> types of features. For example, you might want to query the database and 
> return a results set. This can be done in an ORM, and it can be done in a 
> DAL. The implementation and the syntax will be different in each case, but 
> they are both implementing a common feature. So, when I say the DAL 
> implements features that might otherwise be found in a typical ORM, I am 
> not saying the DAL implements an ORM design pattern, just that it 
> replicates functionality for which you might otherwise use an ORM. 
>

No, it does not do that. It implements very different functionality, that 
may have a similar API and the same terminology used, which honestly I find 
quite confusing - border-line misleading.
I have given a very specific and granular description of the differences of 
such functionalists between an ORM and web2py.
 

> For example, in an ORM, you can define a method in a class that returns a 
> value calculated from the fields of a database record. In the web2py DAL, 
> this same functionality can be achieved using a virtual field or lazy field.
>

There are no lazy-fields in web2py, and I find the terminology misleading - 
as I said - *lazyness *in the context of *database-access*, is a *
deferred-query* - NOT a *deferred-calculation* of the *results *of a query. 
The difference is to profound to overlook. Deferred calculations of 
field-results are generally useless - web-applications are generally 
I/O-Bound much more than CPU-Bound - so the benefits of deferring is mute 
in post-query calculations compared to benefits in deferred-queries that 
are used within the context of transaction-operation-optimizations - which 
is the context most people would thing of whenever they here the term *Lazy* 
thrown 
about a database-context,
 

> I don't know if the SQLA CORE has virtual fields, but if it doesn't, I 
> would suppose it leaves this kind of functionality to the ORM.
>

That's irellevant to the comparison of SQLA-Core vs. web2py-DAL, since I am 
not suggesting using the SQLA-Core and dumping it's ORM - quite the 
opposite - and since virtual-fields are actually much more beneficial when 
used within an ORM layer, as opposed to a DAL one. The only relevance for 
this point to this discussion, is the comparison of the sized of the 
code-bases. I get that this was what you meant.




> That looks like the definition of the SQLA ORM, not ORM's in general.
>

Not quite - look ar my comment to Derek down below.

>
> No, let's not. My point is not that any of those items properly belong to 
> either a DAL or an ORM, or that they can only be implemented with either a 
> DAL or an ORM design pattern. Rather, you had claimed that the SQLA CORE is 
> equivalent to the web2py DAL and that all 20,000+ lines of SQLA ORM code 
> must therefore be providing unique functionality not available in the DAL 
> (thus implying that the ORM must be useful). I was just suggesting that the 
> DAL might be doing more than the SQLA CORE (at least in some areas), and 
> that the DAL might possibly be offering some features for which you would 
> otherwise need the SQLA ORM.
>
>
You are saying that a lot of web2py's extra-features that extend on-top of 
the DAL, might not be included in SQLA's Core, but rather may represent a 
big portion of the 20K lines of code of the ORM, which would then suggest 
that the features I was excited about may actually represent a much minor 
portion of the 20K code-base, which would then suggest that they may be 
small, and therefore legitimate for being considered "useless". You could 
have said so more clearly (like I just did) and prevent the confusion.
Now, if you would have seen the lecture I gave Massimo the link to watch, 
you would have seen how complex these features might be, so I doubt they 
are implemented within a small code-base. But if they do, this would 
degrade your argument that this is such a "substantial-investment" as you 
called it...
But In either case, I would go for trying to use what they wrote, long 
before I would consider re-inventing it...
 
 

> The point is, many features found in DAL's and ORM's are not unique or 
> specific to the DAL or ORM design pattern. Each design pattern can be used 
> to implement many common types of functionality (the functionality may not 
> be identical, but at least similar, and used to satisfy the same goals).


Regarding all the features you claim are inhere

[web2py] psycopg2 or pg8000

2013-05-01 Thread Marco Túlio Cícero de M . Porto
Are there any advantages on one or another or are they basically the same
thing?
I'm using psycopg2 atm.

-- 
[]'s
Marco Tulio

-- 

--- 
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] psycopg2 or pg8000

2013-05-01 Thread Ovidio Marinho
Comparative::

http://blog.natesilva.com/post/250572698/python-postgresql-interfaces-pg8000-vs-psycopg2

Learn more about

http://wiki.python.org/moin/PostgreSQL




 Ovidio Marinho Falcao Neto
 Web Developer
 ovidio...@gmail.com
   83   8826 9088 - Oi
   83   9336 3782 - Claro
Brasil



2013/5/1 Marco Túlio Cícero de M. Porto 

> Are there any advantages on one or another or are they basically the same
> thing?
> I'm using psycopg2 atm.
>
> --
> []'s
> Marco Tulio
>
> --
>
> ---
> 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.
>
>
>

-- 

--- 
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: ORM (?) : A Revisit, NOT a Rebuttal

2013-05-01 Thread Arnon Marcus


On Wednesday, May 1, 2013 4:39:49 PM UTC-7, Anthony wrote:
>
>
> The first thing to notice here, is that an ORM object-attribute can 
>> contain NON-SCALAR values - meaning, a link to a list of other objects. 
>> There is no feature in web2py that generates such an object.
>>
>> The second thing to notice here, is that the attributes of an ORM object 
>> usually contain child-objects (plural) that represent fields from a 
>> different table than the parent-object. Again, there is no feature in 
>> web2py that can generate such an object. A JOIN operation may return row 
>> objects, each of which may contain sub-attributes that hold A SINGLE 
>> field-value 
>> from a foreign-table, but it is a *scalar-value*  - NOT another *
>> domain-entity-object* (with it's own attributes, etc.), NOR a SEQUENCE 
>> of *domain-entity objects* 
>>
>
>> ...
>>  
>
> The crucial thing to notice here is that an ORM object-attribute can 
>> contain NON-SCALAR values - meaning, a link to a list of other objects, 
>> which themselves may contain links to other objects/sequences-of-objects, 
>> etc.
>>
>
> Although ORM's may do that, such a feature is not unique to the ORM 
> pattern. In the web2py DAL, for example, in a Row object with a reference 
> to another table, the reference field is actually a DAL.Reference object, 
> not a scalar value (it includes the scalar value but also allows access to 
> related records in the referenced table).
>

In this case it does not reference a set of DAL fields.
 

> Similarly, a Row object from a table that is referenced by another table 
> includes an attribute that is a DAL.LazySet object (also not a scalar), 
> which allows access to the records in the referencing table that reference 
> the current Row object. 
>

I did not know that - what form of *Layziness* are we talking about here? 
Will it generate a query to fill-up the target rows?
In any case, it is stil a reference to something the WOULD generate a Rows 
object - it is not a reference to an already-exising domain-object (which 
may then have references to othe domain-objects, etc. - all already within 
memory) object as is in ORMS
 

> The DAL also has list:-type fields, whose values are lists, including 
> lists of DAL.Reference objects in the case of list:reference fields.
>

That's interesting, but that is not exactl the same - list-fields need to 
be supported in the database, but in any case, it is not comparable to 
being linked to relation ally-stored primary-keys - which would be how it 
would be implemented in an ORM.

 Row objects can also include custom methods (i.e., "lazy" virtual fields) 
> as well as virtual fields, which can contain complex objects.
>

Relates to the comment I gave you a couple of minutes ago...
These are complementary-auxiliary features (with in the 
web2py-implementation case, have questionable real-world-utility) which 
while they do go beyond a "simple" value, they are still scalar, as they 
ultimately result in a reference to a scalar-value - not a reference to a 
sequence of objects.
 

>
> Anthony
>
>
>

-- 

--- 
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] psycopg2 or pg8000

2013-05-01 Thread Marco Túlio Cícero de M . Porto
First link (the comparison), was written on May 20 2008 (5 years ago), so I
believe a few things have changed from that point to now.

Second link does not provide a comparison that could help. Although it's
interesting in itselft.

Thanks anyway for your time and help.

Cheers,
Marco Tulio


2013/5/1 Ovidio Marinho 

> Comparative::
>
>
> http://blog.natesilva.com/post/250572698/python-postgresql-interfaces-pg8000-vs-psycopg2
>
> Learn more about
>
> http://wiki.python.org/moin/PostgreSQL
>
>
>
>
>  Ovidio Marinho Falcao Neto
>  Web Developer
>  ovidio...@gmail.com
>83   8826 9088 - Oi
>83   9336 3782 - Claro
> Brasil
>
>
>
> 2013/5/1 Marco Túlio Cícero de M. Porto 
>
>> Are there any advantages on one or another or are they basically the same
>> thing?
>> I'm using psycopg2 atm.
>>
>> --
>> []'s
>> Marco Tulio
>>
>> --
>>
>> ---
>> 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.
>>
>>
>>
>
>  --
>
> ---
> 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.
>
>
>



-- 
[]'s
Marco Tulio

-- 

--- 
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.py -S a/c/f reports db error when no db should be touched

2013-05-01 Thread Vinicius Assef
I'm trying to execute web2py with this command:
$ python web2py.py -S bla/default/my

If I run this command before executing the app via browser, I receive
this following output: http://pastebin.com/ZC1DDEqK

I get same result when I remove databases folder. So, the problem is
the absense of databases folder.

BTW, the default.py/my() function has just a return 'blabla'
statement. It doesn't touch the db anyway.

If I run:
$ python web2py.py -S bla
Web2py shell opens without problem.

But when I run:
$ python web2py.py -S bla -M
I get the same result as the first scenario: db error.

Now, my questions:
1) Why I'm getting these errors when I try to execute an a/c/f via
web2py.py, even if not passing -M argument to web2py.py and a/c/f
doesn't touch the db?

2) Why Web2py cannot create my databases folder when running shell?

3) What am I doing wrong?

--
Vinicius Assef

-- 

--- 
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: ORM (?) : A Revisit, NOT a Rebuttal

2013-05-01 Thread Anthony


> So, when I say the DAL implements features that might otherwise be found 
>> in a typical ORM, I am not saying the DAL implements an ORM design pattern, 
>> just that it replicates functionality for which you might otherwise use an 
>> ORM. 
>>
>
> No, it does not do that. It implements very different functionality, that 
> may have a similar API and the same terminology used, which honestly I find 
> quite confusing - border-line misleading.
>

If by "functionality" you mean doing the exact same thing in the exact same 
way, then there aren't even two ORM's that can be said to have the same 
functionality. So what's your point -- that no two distinct software 
libraries can be said to have similar functionality? I don't know how many 
ways I can try to make the same point, so I guess I'll try one more time. 
By "functionality", I'm thinking of things like "querying a database to 
retrieve some records and converting them to a format that can be used in 
Python", and "inserting records in a database", and "updating records in a 
database". These are things you can do with a DAL and things you can do 
with an ORM. There are many other such things. They are not implemented in 
the same fashion, nor are they executed using the same abstractions within 
the application code, but they achieve similar goals. So, you can use the 
web2py DAL to do things that you might otherwise do with an ORM.
 

> For example, in an ORM, you can define a method in a class that returns a 
>> value calculated from the fields of a database record. In the web2py DAL, 
>> this same functionality can be achieved using a virtual field or lazy field.
>>
>
> There are no lazy-fields in web2py, and I find the terminology misleading 
> - as I said - *lazyness *in the context of *database-access*, is a *
> deferred-query* - NOT a *deferred-calculation* of the *results *of a 
> query.
>

In the context of Row fields, the term "lazy" means that the value is 
"filled in" sometime after creation (typically at access time). Whether 
that lazy "filling in" involves database access or not depends on the 
nature of the field. If the field is simply a "virtual" field calculated 
based on the values of other fields in the Row, then there is no sense in 
which you would be deferring database access, as the value is not stored in 
the database. In that case, you are simply deferring calculation. On the 
other hand, reference fields do allow one to access the referenced record, 
and the database access in that case is in fact deferred. Likewise, Row 
objects can include LazySet attributes that defer database access of 
referencing records. Finally, a web2py virtual field or method field can do 
whatever you want it to do, including deferred database queries of any 
sort. So yes, there *are* lazy fields in web2py, both of the 
deferred-calculation type and the deferred-database-access type. In any 
case, they're not officially called "lazy" fields in the API -- that's just 
a term that is commonly used.
 

> Deferred calculations of field-results are generally useless - 
> web-applications are generally I/O-Bound much more than CPU-Bound - so the 
> benefits of deferring is mute in post-query calculations compared to 
> benefits in deferred-queries that are used within the context of 
> transaction-operation-optimizations
>

Deferring calculations is certainly not useless, and you may even care more 
about being CPU-bound than I/O-bound if you're using an async web server, 
but even if we stipulate the above, that still doesn't change the 
definition of the word "lazy".
 

> which is the context most people would thing of whenever they here the 
> term *Lazy* thrown about a database-context
>

I don't know -- sounds like an empirical question. At least within the 
web2py community, though, I think the term is understood.
 

> I don't know if the SQLA CORE has virtual fields, but if it doesn't, I 
>> would suppose it leaves this kind of functionality to the ORM.
>>
>
> That's irellevant to the comparison of SQLA-Core vs. web2py-DAL, since I 
> am not suggesting using the SQLA-Core and dumping it's ORM 
>

I completely agree, which is why that point had nothing to do with a 
comparison of the DAL to SQLA Core. If you will recall, the point was that 
the DAL includes some functionality for which you might otherwise use an 
ORM. If the SQLA Core doesn't have virtual fields, then you need to jump to 
the ORM for that functionality. Hence, some of the 20,000+ lines of SQLA 
ORM code are for generating functionality already available via other means 
in the DAL -- hence, the sheer size of the SQLA ORM does not necessarily 
imply a high degree of usefulness over and above what you can do with the 
DAL.

- quite the opposite - and since virtual-fields are actually much more 
> beneficial when used within an ORM layer, as opposed to a DAL one.
>

I have no idea how you can justify that claim.
 

>  The only relevance for this point to this discussion, is the c

[web2py] Re: ORM (?) : A Revisit, NOT a Rebuttal

2013-05-01 Thread Anthony


> Although ORM's may do that, such a feature is not unique to the ORM 
>> pattern. In the web2py DAL, for example, in a Row object with a reference 
>> to another table, the reference field is actually a DAL.Reference object, 
>> not a scalar value (it includes the scalar value but also allows access to 
>> related records in the referenced table).
>>
>
> In this case it does not reference a set of DAL fields.
>

I'm not sure what you mean. A reference field references records, not 
fields.
 

>  
>
>> Similarly, a Row object from a table that is referenced by another table 
>> includes an attribute that is a DAL.LazySet object (also not a scalar), 
>> which allows access to the records in the referencing table that reference 
>> the current Row object. 
>>
>
> I did not know that - what form of *Layziness* are we talking about here? 
> Will it generate a query to fill-up the target rows?
> In any case, it is stil a reference to something the WOULD generate a Rows 
> object - it is not a reference to an already-exising domain-object (which 
> may then have references to othe domain-objects, etc. - all already within 
> memory) object as is in ORMS
>

Are you saying that when you select a set of records that include reference 
fields, the ORM automatically selects all the referenced records (and any 
records they may reference, and so on) and stores them in memory, even if 
you have not requested that? That sounds inefficient.
 

>  
>
>> The DAL also has list:-type fields, whose values are lists, including 
>> lists of DAL.Reference objects in the case of list:reference fields.
>>
>
> That's interesting, but that is not exactl the same - list-fields need to 
> be supported in the database, but in any case, it is not comparable to 
> being linked to relation ally-stored primary-keys - which would be how it 
> would be implemented in an ORM.
>

No, list fields do not have to be supported in the database (they are 
stored as strings) -- they are an abstraction provided by the DAL. 
list:reference fields do in fact store a list of primary keys (in fact, a 
list of objects that include the primary keys and know how to retrieve the 
associated records). web2py also has JSON fields, which I would say does 
not count as a scalar either.
 

>
>  Row objects can also include custom methods (i.e., "lazy" virtual 
>> fields) as well as virtual fields, which can contain complex objects.
>>
>
> Relates to the comment I gave you a couple of minutes ago...
> These are complementary-auxiliary features (with in the 
> web2py-implementation case, have questionable real-world-utility) which 
> while they do go beyond a "simple" value, they are still scalar, as they 
> ultimately result in a reference to a scalar-value - not a reference to a 
> sequence of objects.
>

No, you can define a virtual field whose value is any custom complex Python 
object you like, with its own methods, that may do or return whatever you 
like. They need not reference or return a scalar value. This is not a mere 
"auxiliary" feature but something that allows you to replicate 
functionality you might otherwise find in an ORM class.

Anthony

-- 

--- 
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.py -S a/c/f reports db error when no db should be touched

2013-05-01 Thread Anthony
If you specify a controller, it will automatically execute the models, even 
if you don't include -M (assuming if you want to be in the environment of 
the controller, you want the controller's usual environment, which includes 
the models).

Anthony

On Wednesday, May 1, 2013 9:58:55 PM UTC-4, viniciusban wrote:
>
> I'm trying to execute web2py with this command: 
> $ python web2py.py -S bla/default/my 
>
> If I run this command before executing the app via browser, I receive 
> this following output: http://pastebin.com/ZC1DDEqK 
>
> I get same result when I remove databases folder. So, the problem is 
> the absense of databases folder. 
>
> BTW, the default.py/my() function has just a return 'blabla' 
> statement. It doesn't touch the db anyway. 
>
> If I run: 
> $ python web2py.py -S bla 
> Web2py shell opens without problem. 
>
> But when I run: 
> $ python web2py.py -S bla -M 
> I get the same result as the first scenario: db error. 
>
> Now, my questions: 
> 1) Why I'm getting these errors when I try to execute an a/c/f via 
> web2py.py, even if not passing -M argument to web2py.py and a/c/f 
> doesn't touch the db? 
>
> 2) Why Web2py cannot create my databases folder when running shell? 
>
> 3) What am I doing wrong? 
>
> -- 
> Vinicius Assef 
>

-- 

--- 
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: @make_member_of() decorator

2013-05-01 Thread Anthony
Oh, right. Cool.

On Wednesday, May 1, 2013 6:13:17 PM UTC-4, viniciusban wrote:
>
> Yes, completely different. 
>
> Virtual fields/methods are defined at row level and receives row as 
> argument. @make_member_of() defines a method at table level. 
>
> For references, see this slide: 
> http://effectivedjango.com/slides/tutorial/models.html#5 
> And this documentation: 
> https://docs.djangoproject.com/en/1.5/topics/db/managers/ 
>
> TL;DR version: managers are functions that make common queries in a 
> table, avoiding code repetition throughout an application. 
>
> -- 
> Vinicius Assef 
>
>
> On Wed, May 1, 2013 at 6:52 PM, Anthony > 
> wrote: 
> > Is this different from using Field.Method: 
> > http://web2py.com/books/default/chapter/29/06#New-style-virtual-fields 
> > 
> > Anthony 
> > 
> > 
> > On Wednesday, May 1, 2013 5:34:48 PM UTC-4, viniciusban wrote: 
> >> 
> >> I created a decorator to allow binding a function to a Table instance. 
> >> 
> >> IMHO, this helps organizing models, creating something similar to 
> >> Django's managers. 
> >> 
> >> To an example, see: https://gist.github.com/viniciusban/5497532 
> >> 
> >> To get an scaffolding application with organized model files and this 
> >> decorator embedded, visit https://github.com/viniciusban/my_welcome 
> >> 
> >> Hope this helps somebody. 
> >> 
> >> Massimo, what do you think about embedding this decorator (or 
> >> something better) in web2py, to allow creating table methods? 
> >> 
> >> -- 
> >> Vinicius Assef 
> > 
> > -- 
> > 
> > --- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "web2py-users" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an 
> > email to web2py+un...@googlegroups.com . 
> > For more options, visit https://groups.google.com/groups/opt_out. 
> > 
> > 
>

-- 

--- 
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: web2py.py -S a/c/f reports db error when no db should be touched

2013-05-01 Thread Vinicius Assef
Even my contoller doesn't need a model?

Is it documented?

What about the inability to create databases folder running Web2py shell?



On Wed, May 1, 2013 at 11:29 PM, Anthony  wrote:
> If you specify a controller, it will automatically execute the models, even
> if you don't include -M (assuming if you want to be in the environment of
> the controller, you want the controller's usual environment, which includes
> the models).
>
> Anthony
>
>
> On Wednesday, May 1, 2013 9:58:55 PM UTC-4, viniciusban wrote:
>>
>> I'm trying to execute web2py with this command:
>> $ python web2py.py -S bla/default/my
>>
>> If I run this command before executing the app via browser, I receive
>> this following output: http://pastebin.com/ZC1DDEqK
>>
>> I get same result when I remove databases folder. So, the problem is
>> the absense of databases folder.
>>
>> BTW, the default.py/my() function has just a return 'blabla'
>> statement. It doesn't touch the db anyway.
>>
>> If I run:
>> $ python web2py.py -S bla
>> Web2py shell opens without problem.
>>
>> But when I run:
>> $ python web2py.py -S bla -M
>> I get the same result as the first scenario: db error.
>>
>> Now, my questions:
>> 1) Why I'm getting these errors when I try to execute an a/c/f via
>> web2py.py, even if not passing -M argument to web2py.py and a/c/f
>> doesn't touch the db?
>>
>> 2) Why Web2py cannot create my databases folder when running shell?
>>
>> 3) What am I doing wrong?
>>
>> --
>> Vinicius Assef
>
> --
>
> ---
> 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.
>
>

-- 

--- 
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: https for login

2013-05-01 Thread Anthony
Since it does a redirect if not over HTTPS, probably early in your first 
model file makes the most sense.

Anthony

On Wednesday, May 1, 2013 6:22:15 PM UTC-4, smaddox wrote:
>
>
> >request.requires_https() 
>
> Newbie question: Where to you actually insert this? 
>
>

-- 

--- 
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: web2py.py -S a/c/f reports db error when no db should be touched

2013-05-01 Thread Anthony
On Wednesday, May 1, 2013 10:36:54 PM UTC-4, viniciusban wrote:

> Even my contoller doesn't need a model?
>

But when you make an HTTP request to a controller, web2py always runs the 
(non-conditional) models, so it does the same when you request a shell in 
the controller environment. The idea of the shell is to put yourself in the 
same environment that you would get with a request.

>
> Is it documented? 
>

Don't think so. 

>
> What about the inability to create databases folder running Web2py shell? 
>

No, missing folders get creating when HTTP request come in, but not when 
starting a shell.

Anthony

-- 

--- 
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: Bootstrap typeahead

2013-05-01 Thread Annet


Wasn't know about that... It nice.
>
>
Bruno posted this reference:

 
https://groups.google.com/forum/?fromgroups=#!searchin/web2py/addy$20osmani/web2py/NVtqqTCNRsk/fGRM6gr2908J


Regards,

Annet

-- 

--- 
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] Solved -- Problems with special characters and pyfpdf

2013-05-01 Thread Martin Weissenboeck
Hi,
I have tried again to generate a pdf file from an htlm file with
someunicode characters.
There is my test program. It's a simplified version, in the original
program there is a lot of additional test lines.

def pp():
from gluon.contrib.pyfpdf import FPDF, HTMLMixin

class MyFPDF(FPDF, HTMLMixin):
def header(self): pass
def footer(self): pass

# create a small table with some data:
rows = [THEAD(TR(TH("Key",_width="70%"), TH("Value",_width="30%"))),
TBODY(TR(TD("Hello"),TD("60")),
  TR(TD("World äöü éè €"),TD("40")))]
table = TABLE(*rows, _border="0", _align="center", _width="50%")

pdf=MyFPDF()
pdf.add_font('DejaVu', '', 'DejaVuSansCondensed.ttf',  uni=True)
pdf.add_page()
pdf.set_font('DejaVu','',10) # set font method 1
# table =TAG.font(table, _face="DejaVu")  # set font method 2
html = str(XML(table, sanitize=False))
pdf.write_html(html)
response.headers['Content-Type'] = "application/pdf"
return pdf.output(dest='S')

I am sure that the font file is loaded, but it seems that the font is not
used.
I have tried two methods to change the font, but the results are the same.
It doesn't look like Sanserif and every Unicode-Character is printed with
every single utf-8 byte. Maybe it's only a small error, but I could not
find it.


Regards, Martin[image: Inline-Bild 3]


2013/4/30 Jurgis Pralgauskis 

> > Which font do you want to include?
>
> DejaVu - I guess it covers western languages.. (could be withouth
> bold/italics to save space)
> Another one could be for eastern chars (buy I don't know anything about
> them...)
>
> > I gave you contributor access
>
> Thanks  :)
>
>
> On Wed, May 1, 2013 at 12:22 AM, Mariano Reingart wrote:
>
>> Which font do you want to include?
>>
>> The font pack is 15MB, I don't know if it could be included with web2py.
>> Also, the problem is that no one is complete (you need several fonts
>> to cover west / east languages)
>>
>> https://pyfpdf.googlecode.com/files/fpdf_unicode_font_pack.zip
>>
>> BTW, thanks for you comments, I gave you contributor access, so you
>> can change the docs directly in the wiki if you like so:
>>
>> https://code.google.com/p/pyfpdf/w/list
>>
>> If you have any patch, also I'll be happy to review and include it ;-)
>>
>> Best regards,
>>
>> Mariano Reingart
>> http://www.sistemasagiles.com.ar
>> http://reingart.blogspot.com
>>
>>
>> On Sun, Apr 28, 2013 at 7:40 AM, Jurgis Pralgauskis
>>  wrote:
>> > by the way -- would it be possible to pack at least one ttf with web2py,
>> > and in normalize_text , when it notices unicode,
>> > automatically add (and set) default ttf font (if such is not set) to
>> render
>> > ok ?
>> >
>> >
>> >
>> > On Sun, Apr 28, 2013 at 12:18 PM, Jurgis Pralgauskis
>> >  wrote:
>> >>
>> >> SOLVED - the problem was that I needed to reload web2py -- for changed
>> >> html.py to make effect ;)
>> >>
>> >> one more issue
>> >> that after write_html(..)   it "forgets" the previously set font
>> (should
>> >> be at least mentioned in docs.. :)
>> >> https://code.google.com/p/pyfpdf/issues/detail?id=54#c2
>> >>
>> >>
>> >>
>> >>
>> >> On Sat, Apr 27, 2013 at 9:06 PM, Mariano Reingart 
>> >> wrote:
>> >>>
>> >>> Did you add the TTF unicode font with add_font?
>> >>> Can you post a complete example (ie a script.py just with the code to
>> >>> test), so I can reproduce it easily.
>> >>>
>> >>> Best regards,
>> >>>
>> >>> Mariano Reingart
>> >>> http://www.sistemasagiles.com.ar
>> >>> http://reingart.blogspot.com
>> >>>
>> >>>
>> >>> On Sat, Apr 27, 2013 at 7:30 AM, Jurgis Pralgauskis
>> >>>  wrote:
>> >>> > I see 2 lines were changed, the main
>> >>> >
>> >>> > - if 'face' in attrs and attrs['face'].lower() in self.font_list:
>> >>> > +   if 'face' in attrs:
>> >>> >
>> >>> > but I still get
>> >>> >
>> >>> >
>> >>> >   File
>> >>> >
>> "/home/jurgis/web2py/applications/apskaitele/controllers/default.py",
>> >>> > line 61, in pdftest
>> >>> >
>> >>> >
>> >>> > pdf.write_html(u"Ąžuolas"
>> >>> > )
>> >>> >
>> >>> >
>> >>> > File "/home/jurgis/web2py/gluon/contrib/fpdf/html.py", line 397, in
>> >>> > write_html
>> >>> >
>> >>> >   File "/usr/local/lib/python2.7/HTMLParser.py", line 114, in feed
>> >>> >
>> >>> > self.goahead(0)
>> >>> >   File "/usr/local/lib/python2.7/HTMLParser.py", line 152, in
>> goahead
>> >>> >
>> >>> > if i < j: self.handle_data(rawdata[i:j])
>> >>> >
>> >>> >   File "/home/jurgis/web2py/gluon/contrib/fpdf/html.py", line 122,
>> in
>> >>> > handle_data
>> >>> >
>> >>> >   File "/home/jurgis/web2py/gluon/contrib/fpdf/fpdf.py", line 822,
>> in
>> >>> > write
>> >>> >
>> >>> > txt = self.normalize_text(txt)
>> >>> >
>> >>> >   File "/home/jurgis/web2py/gluon/contrib/fpdf/fpdf.py", line 1012,
>> in
>> >>> > normalize_text
>> >>> >
>> >>> > txt = txt.encode('latin1')
>> >>> >
>> >>> > UnicodeEncodeError: 'latin-1' codec can't encode characters in
>> position
>> >>> > 0-1:
>> >>> > ordinal not in