[web2py:18409] Re: ReportLab in application modules?

2009-03-20 Thread vince

yes just pack the reportlab directory into library.zip and import like
this

from reportlab.lib.pagesizes import letter, A4

-vince

On Mar 19, 6:59 pm, carlo  wrote:
> Yes that is the folder I put in myapp modules (just the "reportlab"
> folder): did you try something like
>
> from applications.myapp.modules.reportlab import platypus
> or
> from applications.myapp.modules.reportlab.platypus import *
>
> I got an error about some non existing submodule (platypus.flowables
> for example)
>
> My web2py version is the source version.
>
> carlo
>
> On 18 Mar, 20:59, mdipierro  wrote:
>
> > When you unzip reportlab there is a lot of junk in there. There is
> > another subfolder called reportlab where the .py files are. That is
> > the one you need. If you are using the binary distribution you have to
> > put it in the zip file Libraries.zip (windows) or site-packages.zip
> > (mac)
>
> > On Mar 18, 1:23 pm, carlo  wrote:
>
> > > Are you sure about that?
> > > I put the reportlab folder in myapp.modules but when I try to import a
> > > submodule I get an error.
>
> > > carlo
>
> > > On 18 Mar, 19:05, mdipierro  wrote:
>
> > > > If you just unzip reportlab under web2py/ and rezip web2py it works.
>
> > > > reportlab does not need to be installed and only needs the binaries
> > > > for image manipulation.
>
> > > > Massimo
>
> > > > On Mar 18, 1:02 pm, carlo  wrote:
>
> > > > > thank you Tim.
>
> > > > > Would you suggest any other package to get pdf printing more easily
> > > > > integrated with a web2py app (Pisa??) ? I would like to ship my app
> > > > > with every necessary module without counting on Python system..
>
> > > > > carlo
>
> > > > > On 18 Mar, 18:42, Timothy Farrell  wrote:
>
> > > > > > Do you need to bundle reportlab with an app?
>
> > > > > > Reportlab requires some binary libaries that are not conducive 
> > > > > > Python's
> > > > > > true cross-platformness.  I would say the better way is to just say,
> > > > > > "This app requires Reportlabs 2.x"
>
> > > > > > -tim
>
> > > > > > carlo wrote:
> > > > > > > Anyone succedeed to get ReportLab modules installed under
> > > > > > > applications.myapp.modules (Windows)?
>
> > > > > > > carlo
>
> > > > > > --
> > > > > > Timothy Farrell 
> > > > > > Computer Guy
> > > > > > Statewide General Insurance Agency (www.swgen.com)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:18408] Re: Google Authentication + web2py on GAE

2009-03-20 Thread mdipierro

I'd love if somebody could port Auth to GAE.

On Mar 20, 9:06 pm, Tito Garrido  wrote:
> Yeah Joseph, something like that!
>
> Thanks!
>
> But, I'd like something more web2pythonic :D I think that we don't this
> implemented yet...
>
> Like
>
> auth = Auth(GAE(), db)
>
> I don't know... but here is an idea... :)
>
> Regards,
>
> Tito
>
>
>
> On Fri, Mar 20, 2009 at 6:58 AM, Joseph Jude  wrote:
>
> > I'm assuming that you want to validate the user via google auth and
> > then allow the authenticated user into your application. Sometime
> > back, i did this for a desktop based application updating a
> > application hosted in appengine (after authentication). I wrote abt it
> > here:
> >http://www.jjude.com/2008/09/18/authenticating-in-gae/
>
> > At first I obtained the uid/pwd from the user and sent it via header
> > to authenticate. By one of the comments from the user, I realized that
> > it is not a safe manner. Later I let the google auth to validate the
> > user and then allow the access accordingly. The code is also shared in
> > google code. You can pick it up.
>
> > Hope this helps.
>
> > Joseph
>
> > On Mar 20, 7:09 am, NguyendHEX  wrote:
> > > You can use user class from google
>
> > > from google.appengine.api import users
> > > user = users.get_current_user()
> > > if user:
> > > #user.email()
> > > else:
> > > #redirect to login: users.create_login_url()
>
> > > Hope this help
>
> > > On Mar 20, 6:56 am, Tito Garrido  wrote:
>
> > > > Is there a way to use Google Authentication + web2py on GAE?
>
> > > > Regards,
>
> > > > Tito
>
> > > > --
> > > > Linux User #387870
> > > > .
> > > >  _/_õ|__|
> > > > ..º[ .-.___.-._| . . . .
> > > > .__( o)__( o).:___
>
> --
> Linux User #387870
> .
>  _/_õ|__|
> ..º[ .-.___.-._| . . . .
> .__( o)__( o).:___
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:18407] Re: (possibly weird) Questions for web2py

2009-03-20 Thread mdipierro

> 3/ Templating
>
> a/ Is template inheritance supported? (I couldn't find any reference,
> but it might be caused by being tired)

Template inheritance as done by Django is ill-defined and I can
explain more.
You can do
{{extend 'another_template'}}
You can
{{include 'another_template'}}
You can create functions to define blocks before {{extend ...}}. This
is explained in the manual.

> b/ Is it possible to invoke Python functions from the template that
> are enhancing the template dictionary?

Yes if:
1) you define the function in models or
2) you define the funciton in controller and pass it to the view or
3) you import the function from the view
4) you create the function in the view {{def f(a)}}Helloe {{=a}}{{return}}

> Imagine a homepage that has a couple of 'widget' like fragments. These
> are not really part of the controller, so I'd like to just say in the
> template: invoke a function and place add the returned value to the
> dict used for rendering the template.
>
> c/ Is it possible to include in a template an HTML fragment generated
> as a result of a function invocation?

Yes {{=XML(fragment)}}

> It is a similar concept to the above one, the difference being that
> the 'widget' template is completely outside the current page (while in
> the above scenario the 'widget' template was part of the current
> template)
>
> 4/ Request/Response cycle interceptors
>
> Basically this is a way to plug in cross-cutting functionality that
> will be automatically triggered at specific moment of the request/
> response cycle:
>
> - before_request
> - before_controller
> - after_controller
> - before_view
> - after_view
> - after_request

You can do most of this this. In controller place

def mycaller(f):
  before_controller()
  d=f()
  after_controller()
  if isinstance(d,dict): d=response.render(d)
  after_view()
response._caller=mycaller

You can still do before request and after request using wsgi
middleware.

I apologize for my sketchy responses but I am on vacation and I have
limited connectivity. I suggest you ask your questions again in April.

Massimo


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:18406] Re: Feature Request: DECIMAL or NUMERIC type for database fields

2009-03-20 Thread mdipierro

try this:

class IS_DECIMAL:
   def __init__(self,decimals=2,error_message="Invalid"):
self.decimals=decimals
self.error_message=error_message
   def __call__(self,value):
try:
 value=int(float(value)*(10**self.decimals))
 return (value,None)
except:
 return (value,self.error_message)
def format(self,value):
return float(value)/10**self.decimals


On Mar 20, 7:41 pm, Joe  Barnhart  wrote:
> The easiest workaround is to use INTEGER and leave all amounts in
> cents, i.e. 123 instead of 1.23.  If all math is done with the implied
> decimal point on integers, you will never have floating-point round-
> off errors.  Only put in the decimal point when you are ready to
> display the value.  (Massimo -- Maybe a validator can help here?)
>
> -- Joe B.
>
> On Mar 20, 12:03 pm, Paco  wrote:
>
> > I've been trying web2py for a couple of days and I believe is just
> > great. I'm so excited that I'm planning to build my own accounting and
> > invoicing application, which is, in the other hand, not so complex in
> > my case.
>
> > I need (and I believe many more people do) a DECIMAL field type or
> > maybe a CURRENCY type since there are many applications that need
> > fixed precision numbers.
>
> > It seems to me that is shouldn't be very difficult to do since most
> > databases, including SQLite, support NUMERIC or DECIMAL types.
>
> > It would be a great new feature. Are there any plans to do such a
> > thing? Or maybe there is a nice workaround to do this in web2py?
>
> > Cheers,
> > Paco
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:18405] ajax and t2

2009-03-20 Thread Wes James

I have been looking at the ajax example (in web2py built in examples).
 I have been looking at how it would work with t2.  In the ajax
example it uses   for t2 to seem to work it
requires type=submit, but then the ajax does not work.  Anyone have
and example of using t2 and ajax?

thx,

-wj

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:18404] Re: Google Authentication + web2py on GAE

2009-03-20 Thread Tito Garrido
Yeah Joseph, something like that!

Thanks!

But, I'd like something more web2pythonic :D I think that we don't this
implemented yet...

Like

auth = Auth(GAE(), db)

I don't know... but here is an idea... :)

Regards,

Tito

On Fri, Mar 20, 2009 at 6:58 AM, Joseph Jude  wrote:

>
> I'm assuming that you want to validate the user via google auth and
> then allow the authenticated user into your application. Sometime
> back, i did this for a desktop based application updating a
> application hosted in appengine (after authentication). I wrote abt it
> here:
> http://www.jjude.com/2008/09/18/authenticating-in-gae/
>
> At first I obtained the uid/pwd from the user and sent it via header
> to authenticate. By one of the comments from the user, I realized that
> it is not a safe manner. Later I let the google auth to validate the
> user and then allow the access accordingly. The code is also shared in
> google code. You can pick it up.
>
> Hope this helps.
>
> Joseph
>
> On Mar 20, 7:09 am, NguyendHEX  wrote:
> > You can use user class from google
> >
> > from google.appengine.api import users
> > user = users.get_current_user()
> > if user:
> > #user.email()
> > else:
> > #redirect to login: users.create_login_url()
> >
> > Hope this help
> >
> > On Mar 20, 6:56 am, Tito Garrido  wrote:
> >
> > > Is there a way to use Google Authentication + web2py on GAE?
> >
> > > Regards,
> >
> > > Tito
> >
> > > --
> > > Linux User #387870
> > > .
> > >  _/_õ|__|
> > > ..º[ .-.___.-._| . . . .
> > > .__( o)__( o).:___
> >
>


-- 
Linux User #387870
.
 _/_õ|__|
..º[ .-.___.-._| . . . .
.__( o)__( o).:___

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:18403] Re: (possibly weird) Questions for web2py

2009-03-20 Thread Yarko Tymciurak
On Fri, Mar 20, 2009 at 6:48 PM, Alex Popescu <
the.mindstorm.mailingl...@gmail.com> wrote:

>
> On Mar 21, 1:27 am, mdipierro  wrote:
> > On Mar 20, 5:16 pm, Alex Popescu 
> > wrote:
> >
> >
> > > 1. Routing
> >
> > > According to the documentation URLs are solved according to the
> > > following rule:
> >
> > > protocol://netloc/application/controller/function[(/arg)*][?vars]
> >
> > > My question is: how difficult would be to eliminate the function part
> > > and basically route the request to a method defined in the controller
> > > corresponding to the HTTP request method name (i.e. GET -> get, POST -
> > > post, PUT -> put, etc.)?
> >
> > You cannot acoomplish soley with routes but you can have a catch all
> > action that checks
> >
> > if request.post_vars: call_post_action()
> >
>
> I'm not sure I'm following your answer. While I haven't spent too much
> time looking at the code my impression is that it should be as simple
> as making some minor changes to the way the Request object is
> initialized in gluon.main.wsgibase.


That is, going to something like
 protocol://netloc/application/default/index

(the default/index is default for an application - let's leave routes out of
this for the moment)

def index():
if request.post_vars:
   action=request.post_vars
if action == 'a':  a()

Maybe an example use case would help describe what you're looking for...


>
> Well, there might be something else needed too, but I haven't found it
> yet: generating the URLs.
>
> >
> >
> > > As far as I can tell, for a WSGI deployment the URL parsing happens in
> > > gluon.main.wsgibase, but I am wondering if there are other places I
> > > should look for.
> >
> > > Note: I am looking to build a very RESTful app and I'd like to have
> > > this clear convention in my app.
> > > 2. Models and Data Access
> >
> > > This part is a bit more complex to describe, but I hope you'll bare
> > > with me for a couple of paragraphs.
> >
> > > Currently the web2py models are very data centric (please keep in mind
> > > that I'm not saying that this is good or bad):
> >
> > > db.define_table('name', SQLField(...)
> >
> > > What I'd actually like would be to hide this part behind an object
> > > centric approach. I am aware of the fact that basically the approaches
> > > are quite different (ORM vs ActiveRecord), but I'm wondering if some
> > > metaclass magic would be able to allow me to preserve the current
> > > implementation while offering an object oriented perspective. A very
> > > basic example would be the data access layer implementation available
> > > in Google App Engine:
> >
> > > Model.gql('query')
> >
> > > Simply put the meta-magic will just have to hide the db functions
> > > behind some static Model methods.
> >
> > > Question: do you think that this is possible? how difficult would this
> > > be?
> >
> > This has been done in order to allow web2py to import Django models:
> > You can find the code here:
> http://mdp.cti.depaul.edu/AlterEgo/default/show/189
> >
>
> This looks like an excellent start. I think I can take it from there.
>
> While waiting for your comments on my previous questions I've figured
> 2 more:
>
> 3/ Templating
>
> a/ Is template inheritance supported? (I couldn't find any reference,
> but it might be caused by being tired)


for example, see views/generic:

   {{extend 'layout.html'}}


b/ Is it possible to invoke Python functions from the template that
> are enhancing the template dictionary?


   {{import my_template_helpers}}
   {{ for i in list_to_show:}}
  {{ output=my_template_helpers.someaction(i) }}
  {{ =T(output)}}
   {{pass}}

>
>
> Imagine a homepage that has a couple of 'widget' like fragments. These
> are not really part of the controller, so I'd like to just say in the
> template: invoke a function and place add the returned value to the
> dict used for rendering the template.
>
> c/ Is it possible to include in a template an HTML fragment generated
> as a result of a function invocation?


{{ =var }}
{{ =function_call( x ) }}
{{ =XML( some_otherwise_escaped_value ) }}

{{ import random
   i = random.randint(1,6)
 }}
  Look!  A random header!;
   H{{ =i }}
   {{ if i%2: }} is odd {{ else: }} is even {{ pass }}
  


>
>
> It is a similar concept to the above one, the difference being that
> the 'widget' template is completely outside the current page (while in
> the above scenario the 'widget' template was part of the current
> template)


Oh!  I think you meant this for above:

   {{ def foo():   return a+b}}
   {{ pass }}

   {{ =foo() }}


>
>
> 4/ Request/Response cycle interceptors
>
> Basically this is a way to plug in cross-cutting functionality that
> will be automatically triggered at specific moment of the request/
> response cycle:
>

I'm not sure what we're talking about here; wsgiserver ->
gluon.main.wsgibase which sets up the context, so I think you mean 

[web2py:18402] Re: Feature Request: DECIMAL or NUMERIC type for database fields

2009-03-20 Thread Joe Barnhart

The easiest workaround is to use INTEGER and leave all amounts in
cents, i.e. 123 instead of 1.23.  If all math is done with the implied
decimal point on integers, you will never have floating-point round-
off errors.  Only put in the decimal point when you are ready to
display the value.  (Massimo -- Maybe a validator can help here?)

-- Joe B.

On Mar 20, 12:03 pm, Paco  wrote:
> I've been trying web2py for a couple of days and I believe is just
> great. I'm so excited that I'm planning to build my own accounting and
> invoicing application, which is, in the other hand, not so complex in
> my case.
>
> I need (and I believe many more people do) a DECIMAL field type or
> maybe a CURRENCY type since there are many applications that need
> fixed precision numbers.
>
> It seems to me that is shouldn't be very difficult to do since most
> databases, including SQLite, support NUMERIC or DECIMAL types.
>
> It would be a great new feature. Are there any plans to do such a
> thing? Or maybe there is a nice workaround to do this in web2py?
>
> Cheers,
> Paco
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:18401] Re: (possibly weird) Questions for web2py

2009-03-20 Thread Alex Popescu

On Mar 21, 1:27 am, mdipierro  wrote:
> On Mar 20, 5:16 pm, Alex Popescu 
> wrote:
>
>
> > 1. Routing
>
> > According to the documentation URLs are solved according to the
> > following rule:
>
> > protocol://netloc/application/controller/function[(/arg)*][?vars]
>
> > My question is: how difficult would be to eliminate the function part
> > and basically route the request to a method defined in the controller
> > corresponding to the HTTP request method name (i.e. GET -> get, POST -
> > post, PUT -> put, etc.)?
>
> You cannot acoomplish soley with routes but you can have a catch all
> action that checks
>
> if request.post_vars: call_post_action()
>

I'm not sure I'm following your answer. While I haven't spent too much
time looking at the code my impression is that it should be as simple
as making some minor changes to the way the Request object is
initialized in gluon.main.wsgibase.

Well, there might be something else needed too, but I haven't found it
yet: generating the URLs.

>
>
> > As far as I can tell, for a WSGI deployment the URL parsing happens in
> > gluon.main.wsgibase, but I am wondering if there are other places I
> > should look for.
>
> > Note: I am looking to build a very RESTful app and I'd like to have
> > this clear convention in my app.
> > 2. Models and Data Access
>
> > This part is a bit more complex to describe, but I hope you'll bare
> > with me for a couple of paragraphs.
>
> > Currently the web2py models are very data centric (please keep in mind
> > that I'm not saying that this is good or bad):
>
> > db.define_table('name', SQLField(...)
>
> > What I'd actually like would be to hide this part behind an object
> > centric approach. I am aware of the fact that basically the approaches
> > are quite different (ORM vs ActiveRecord), but I'm wondering if some
> > metaclass magic would be able to allow me to preserve the current
> > implementation while offering an object oriented perspective. A very
> > basic example would be the data access layer implementation available
> > in Google App Engine:
>
> > Model.gql('query')
>
> > Simply put the meta-magic will just have to hide the db functions
> > behind some static Model methods.
>
> > Question: do you think that this is possible? how difficult would this
> > be?
>
> This has been done in order to allow web2py to import Django models:
> You can find the code here:http://mdp.cti.depaul.edu/AlterEgo/default/show/189
>

This looks like an excellent start. I think I can take it from there.

While waiting for your comments on my previous questions I've figured
2 more:

3/ Templating

a/ Is template inheritance supported? (I couldn't find any reference,
but it might be caused by being tired)

b/ Is it possible to invoke Python functions from the template that
are enhancing the template dictionary?

Imagine a homepage that has a couple of 'widget' like fragments. These
are not really part of the controller, so I'd like to just say in the
template: invoke a function and place add the returned value to the
dict used for rendering the template.

c/ Is it possible to include in a template an HTML fragment generated
as a result of a function invocation?

It is a similar concept to the above one, the difference being that
the 'widget' template is completely outside the current page (while in
the above scenario the 'widget' template was part of the current
template)

4/ Request/Response cycle interceptors

Basically this is a way to plug in cross-cutting functionality that
will be automatically triggered at specific moment of the request/
response cycle:

- before_request
- before_controller
- after_controller
- before_view
- after_view
- after_request

I think the Django synonym would be middleware classes.

Many thanks in advance,

./alex
--
.w( the_mindstorm )p.
  Alexandru Popescu


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:18400] Re: (possibly weird) Questions for web2py

2009-03-20 Thread mdipierro



On Mar 20, 5:16 pm, Alex Popescu 
wrote:
> Hi all,
>
> I've spent some time reading the available documentation on web2py
> (plus some more). I'll start by saying that I like a lot of things I'm
> seeing. Still, there are a couple of weird questions that I'd like to
> ask:
>
> 1. Routing
>
> According to the documentation URLs are solved according to the
> following rule:
>
> protocol://netloc/application/controller/function[(/arg)*][?vars]
>
> My question is: how difficult would be to eliminate the function part
> and basically route the request to a method defined in the controller
> corresponding to the HTTP request method name (i.e. GET -> get, POST -
> post, PUT -> put, etc.)?

You cannot acoomplish soley with routes but you can have a catch all
action that checks

if request.post_vars: call_post_action()

> As far as I can tell, for a WSGI deployment the URL parsing happens in
> gluon.main.wsgibase, but I am wondering if there are other places I
> should look for.
>
> Note: I am looking to build a very RESTful app and I'd like to have
> this clear convention in my app.

> 2. Models and Data Access
>
> This part is a bit more complex to describe, but I hope you'll bare
> with me for a couple of paragraphs.
>
> Currently the web2py models are very data centric (please keep in mind
> that I'm not saying that this is good or bad):
>
> db.define_table('name', SQLField(...)
>
> What I'd actually like would be to hide this part behind an object
> centric approach. I am aware of the fact that basically the approaches
> are quite different (ORM vs ActiveRecord), but I'm wondering if some
> metaclass magic would be able to allow me to preserve the current
> implementation while offering an object oriented perspective. A very
> basic example would be the data access layer implementation available
> in Google App Engine:
>
> Model.gql('query')
>
> Simply put the meta-magic will just have to hide the db functions
> behind some static Model methods.
>
> Question: do you think that this is possible? how difficult would this
> be?

This has been done in order to allow web2py to import Django models:
You can find the code here:
http://mdp.cti.depaul.edu/AlterEgo/default/show/189

> So far these are the only 2 reasons that I haven't signed yet for
> web2py. I also believe that 1st idea would be helpful to other web2py
> users looking for RESTful apps, while the 2nd one can be seen just as
> 'syntactic sugar' (there may be other small benefit like intellisense
> support in IDEs, readability, refactoring, etc.)
>
> Looking forward to your answer(s),
>
> ./alex
> --
> .w( the_mindstorm )p.
>   Alexandru Popescu
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:18399] Re: SQLTABLE showid?

2009-03-20 Thread mdipierro

You pass wot a SQLTABLE the result of a select. When doing the select
you choose the fields you want

items=db().select(db.table.field1,db.table.field2)
return dict(table=SQLTABLE(items))



On Mar 20, 12:21 pm, carlo  wrote:
> What's the best way/trick to have showid=False in SQLTABLE either?
>
> thank you
>
> carlo
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:18398] Re: Feature Request: DECIMAL or NUMERIC type for database fields

2009-03-20 Thread mdipierro

Unfortunatly not all databases support it and it would not be
portable. Please let me know if I am wrong.

Massimo

On Mar 20, 2:03 pm, Paco  wrote:
> I've been trying web2py for a couple of days and I believe is just
> great. I'm so excited that I'm planning to build my own accounting and
> invoicing application, which is, in the other hand, not so complex in
> my case.
>
> I need (and I believe many more people do) a DECIMAL field type or
> maybe a CURRENCY type since there are many applications that need
> fixed precision numbers.
>
> It seems to me that is shouldn't be very difficult to do since most
> databases, including SQLite, support NUMERIC or DECIMAL types.
>
> It would be a great new feature. Are there any plans to do such a
> thing? Or maybe there is a nice workaround to do this in web2py?
>
> Cheers,
> Paco
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:18397] Re: feature request:

2009-03-20 Thread mdipierro

python already provides smtplib. web2py has an interface to it.


from gluon.contrib.utils import
*
mail=Mail
()
mail.settings.server='smtp.gmail.com:
587'
 
mail.sender='y...@somewhere.com'
mail.login=None or
'username:password'
mail.send(to=
['y...@whatever.com'],subject='None',message='None')

You can put anywhere you like.


On Mar 20, 1:07 pm, Jason Brower  wrote:
> I think it would be awsome to come up with a email system.  So you could
> setup an internal or external email system.  Sending messages from user
> to user in the same system and so forth.
> I think it could provide a lot of functionality for intranet systems
> like schools and businesses.  And my personal interest is to have this
> for social networking systems.
> Any ideas and thoughts on it?
> Regards,
> Jason Brower
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:18396] Re: Integrating existing ping script [Using win32com module]

2009-03-20 Thread mdipierro

Tim is correct and web2py is push but,
1) an action can call another action in the same controller

2)  it is possible to write a controller like

def index():
 return(functions=globals())

and a corresponding view that calls

{{=functions['myotherfunction']()}}

where myotherfuction is another action in the same controller.

I am not suggesting this is good practice. Just pointing out it is
possible.


On Mar 20, 12:18 pm, Timothy Farrell  wrote:
> I think you may be confusing push and pull MVC models.  web2py is a push
> model.  Consequently, views cannot call controllers, rather is the
> controller that is run and what it returns is applied to a predefined view.
>
> Instead of printing the output, assign it to a variable and wrap it in a
> dictionary.  Return said dictionary...like so:
>
> output = "Ping output goes here"
> return dict(pingout=output)
>
> If you don't have a view for your page, the default view will display
> the contents of the returned dictionary.  Otherwise, you can make a view
> that displays pingout like so:
>
> {{=pingout}}
>
> -tim
>
>
>
> dave_mcgee wrote:
> > Ok, I've worked on this some more and I've taken your recommendation
> > to use a pure Python implementation available here (http://
> > svn.pylucid.net/pylucid/CodeSnippets/ping.py)
>
> > I have this set as a default.py controller in my web2py environment
> > for my app project. Say, I wish to call this controller and run it
> > from my app view  (When a user visits default/index.html the results
> > from ping.py are displayed in it) - Is this hard to do?
>
> > Thanks for your help guys - this is a major learning curve for me
>
> > On Mar 20, 2:15 pm, dave_mcgee  wrote:
>
> >> Hi Tim! Thanks for the warm welcome and the assistance!
>
> >> Will work further on this today :)
>
> >> Regards,
> >> Dave
>
> >> On Mar 20, 12:56 pm, Timothy Farrell  wrote:
>
> >>> Welcome to web2py!  We're glad you're here.
>
> >>> 1) To install win32 python extensions, the easiest way is to download
> >>> and run the exe from:
>
> >>>http://sourceforge.net/project/platformdownload.php?group_id=78018
>
> >>> ...that corresponds to the version of Python you use.  Generally, when
> >>> you see a setup.py script, you use that to install the package by
> >>> upzipping the whole thing to a directory and then running: setup.py
> >>> install.  Some packages will complain if you don't have a compiler
> >>> installed because they want to compile some speedups.  In most cases you
> >>> can run: setup.py install --without-speedups ...to get around that.
>
> >>> 2) Nope.  I tested your script and it works just fine as it is.  But it
> >>> only accepts IP addresses (no domain names).
>
> >>> 3) I recommend that you use a more cross-platform solution.  See this
> >>> page:http://stackoverflow.com/questions/316866/ping-a-site-in-python
>
> >>> -tim
>
> >>> dave_mcgee wrote:
>
>  Hi everyone. I'm new enough to web2py so please be gentle! :)
>
>  I'm just involved in a small college project at the moment where we've
>  had an existing python script monitoring a number of nodes and
>  returning the results in the python GUI. I'm just moving onto trying
>  to integrate the project into a web2py web framework environment (I've
>  started today)
>
>  I'm currently reading through the manual but having difficulty getting
>  different pieces to work.
>
>  I wish to use the Win32 com module to integrate the functionality of
>  the ping command within my python script below. I'd apreciate it if
>  someone could guide me as how to integrate this script within a web
>  environment..
>
>  1) Is it as simple as importing setup.py into my project in Web2py
>  from the win32 folder I extracted off source forge?
>
>  2) Do I have to change any parameters, at all?
>
>  Any other help would be much apreciated! Script is below.. Thanks!
>
>  import win32com.client
>
>  wmi = win32com.client.GetObject(r"winmgmts:\\.\root\cimv2")
>
>  def Ping(host):
>      col_items = wmi.ExecQuery("Select * from Win32_PingStatus Where
>  Address = '%s'" % host)
>      for item in col_items:
>          if item.StatusCode == 0:
>  # success
>              print "Host ", item.Address
>              print "Recorded Hops: ", item.RecordRoute
>              print "Buffer Size: ", item.ReplySize
>              print "Response Time: ", item.ResponseTime
>              print "ResponseTimeToLive: ", item.ResponseTimeToLive
>              print "Timeout: ", item.Timeout
>              print "TimetoLive: ", item.TimetoLive
>
>  # ping node
>  Ping('192.168.1.3')
>
> >>> --
> >>> Timothy Farrell 
> >>> Computer Guy
> >>> Statewide General Insurance Agency (www.swgen.com)
>
> --
> Timothy Farrell 
> Computer Guy
> Statewide General Insurance Agency (www.swgen.com)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to

[web2py:18395] (possibly weird) Questions for web2py

2009-03-20 Thread Alex Popescu

Hi all,

I've spent some time reading the available documentation on web2py
(plus some more). I'll start by saying that I like a lot of things I'm
seeing. Still, there are a couple of weird questions that I'd like to
ask:

1. Routing

According to the documentation URLs are solved according to the
following rule:

protocol://netloc/application/controller/function[(/arg)*][?vars]

My question is: how difficult would be to eliminate the function part
and basically route the request to a method defined in the controller
corresponding to the HTTP request method name (i.e. GET -> get, POST -
> post, PUT -> put, etc.)?

As far as I can tell, for a WSGI deployment the URL parsing happens in
gluon.main.wsgibase, but I am wondering if there are other places I
should look for.

Note: I am looking to build a very RESTful app and I'd like to have
this clear convention in my app.

2. Models and Data Access

This part is a bit more complex to describe, but I hope you'll bare
with me for a couple of paragraphs.

Currently the web2py models are very data centric (please keep in mind
that I'm not saying that this is good or bad):

db.define_table('name', SQLField(...)

What I'd actually like would be to hide this part behind an object
centric approach. I am aware of the fact that basically the approaches
are quite different (ORM vs ActiveRecord), but I'm wondering if some
metaclass magic would be able to allow me to preserve the current
implementation while offering an object oriented perspective. A very
basic example would be the data access layer implementation available
in Google App Engine:

Model.gql('query')

Simply put the meta-magic will just have to hide the db functions
behind some static Model methods.

Question: do you think that this is possible? how difficult would this
be?

So far these are the only 2 reasons that I haven't signed yet for
web2py. I also believe that 1st idea would be helpful to other web2py
users looking for RESTful apps, while the 2nd one can be seen just as
'syntactic sugar' (there may be other small benefit like intellisense
support in IDEs, readability, refactoring, etc.)

Looking forward to your answer(s),

./alex
--
.w( the_mindstorm )p.
  Alexandru Popescu




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:18394] (possibly weird) Questions for web2py

2009-03-20 Thread Alex Popescu

Hi all,

I've spent some time reading the available documentation on web2py
(plus some more). I'll start by saying that I like a lot of things I'm
seeing. Still, there are a couple of weird questions that I'd like to
ask:

1. Routing

According to the documentation URLs are solved according to the
following rule:

protocol://netloc/application/controller/function[(/arg)*][?vars]

My question is: how difficult would be to eliminate the function part
and basically route the request to a method defined in the controller
corresponding to the HTTP request method name (i.e. GET -> get, POST -
> post, PUT -> put, etc.)?

As far as I can tell, for a WSGI deployment the URL parsing happens in
gluon.main.wsgibase, but I am wondering if there are other places I
should look for.

Note: I am looking to build a very RESTful app and I'd like to have
this clear convention in my app.

2. Models and Data Access

This part is a bit more complex to describe, but I hope you'll bare
with me for a couple of paragraphs.

Currently the web2py models are very data centric (please keep in mind
that I'm not saying that this is good or bad):

db.define_table('name', SQLField(...)

What I'd actually like would be to hide this part behind an object
centric approach. I am aware of the fact that basically the approaches
are quite different (ORM vs ActiveRecord), but I'm wondering if some
metaclass magic would be able to allow me to preserve the current
implementation while offering an object oriented perspective. A very
basic example would be the data access layer implementation available
in Google App Engine:

Model.gql('query')

Simply put the meta-magic will just have to hide the db functions
behind some static Model methods.

Question: do you think that this is possible? how difficult would this
be?

So far these are the only 2 reasons that I haven't signed yet for
web2py. I also believe that 1st idea would be helpful to other web2py
users looking for RESTful apps, while the 2nd one can be seen just as
'syntactic sugar' (there may be other small benefit like intellisense
support in IDEs, readability, refactoring, etc.)

Looking forward to your answer(s),

./alex
--
.w( the_mindstorm )p.
  Alexandru Popescu



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:18393] Re: SQLTABLE showid?

2009-03-20 Thread carlo

Hi Yarko,

I think you misunderstood SQLTable for SQLTABLE.

When using SQLFORM(db.mytable) you have the showid=False option to
escape the 'id' field in the form.

I was asking if there is a similar option for SQLTABLE but in this
very moment I see that you do not really need this; I have just to
call:

SQLTABLE(db().select
(db.mytable.field1,db.mytable.field2,db.mytable.field3))

and not

SQLTABLE(db().select(db.mtable.ALL))

sorry for my stupid question.

carlo

On 20 Mar, 21:59, Yarko Tymciurak  wrote:
> not sure what you are asking...
> there is no way to disable the 'id' field from being part of a table in the
> DAL;  if you are using an existing table, first be sure to set migrate=False
> in your table definition:
>
> db.define_table('some_existing_table', SQLField('some_field'),
> migrate=False)
>
> If your existing table does not have a field called 'id', then the best
> thing to do right now is to create a VIEW in your database server, and map
> whatever the primary key is in your table to be called "id" in this view,
> then create a web2py table definition which refers to this view.
>
> Hope that helps
>
> - Yarko
>
> On Fri, Mar 20, 2009 at 12:21 PM, carlo  wrote:
>
> > What's the best way/trick to have showid=False in SQLTABLE either?
>
> > thank you
>
> > carlo
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:18392] Re: Issue with tools.py auth_permission table definition

2009-03-20 Thread Yarko Tymciurak
... so you find the default db.py comments ("Define your tables below")  not
clear enough, is that correct?
Would changing the default (welcome)  db.py to look like something like this
help:

#---< your tables section
>---
## Define your tables below,   for example
##
## >>> db.define_table('mytable',SQLField('myfield','string'))



# your table definitions (define before the Auth Section) #

##
#---< END your tables section
>--


#-- Auth Section --
## Here is sample code if you need:
## - email capabilities
.

On Fri, Mar 20, 2009 at 2:54 PM, Fran  wrote:

>
> This definition includes:
>  db.auth_permission.table_name.requires = IS_IN_SET(db.tables)
>
> Problem is that db.tables is evaluated when the Auth class is
> instantiated
> => only contains those tables created up to that point in the model
>
> Workaround is to explictly call that line at the end of the model(s).
>
> Not sure how to fix the class definition to avoid this.
>
> If we can't then we should update documentation.
>
> F
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:18391] Feature Request: DECIMAL or NUMERIC type for database fields

2009-03-20 Thread Paco


I've been trying web2py for a couple of days and I believe is just
great. I'm so excited that I'm planning to build my own accounting and
invoicing application, which is, in the other hand, not so complex in
my case.

I need (and I believe many more people do) a DECIMAL field type or
maybe a CURRENCY type since there are many applications that need
fixed precision numbers.

It seems to me that is shouldn't be very difficult to do since most
databases, including SQLite, support NUMERIC or DECIMAL types.

It would be a great new feature. Are there any plans to do such a
thing? Or maybe there is a nice workaround to do this in web2py?

Cheers,
Paco

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:18390] Re: SQLTABLE showid?

2009-03-20 Thread Yarko Tymciurak
not sure what you are asking...
there is no way to disable the 'id' field from being part of a table in the
DAL;  if you are using an existing table, first be sure to set migrate=False
in your table definition:

db.define_table('some_existing_table', SQLField('some_field'),
migrate=False)

If your existing table does not have a field called 'id', then the best
thing to do right now is to create a VIEW in your database server, and map
whatever the primary key is in your table to be called "id" in this view,
then create a web2py table definition which refers to this view.

Hope that helps

- Yarko

On Fri, Mar 20, 2009 at 12:21 PM, carlo  wrote:

>
> What's the best way/trick to have showid=False in SQLTABLE either?
>
> thank you
>
> carlo
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:18389] Issue with tools.py auth_permission table definition

2009-03-20 Thread Fran

This definition includes:
 db.auth_permission.table_name.requires = IS_IN_SET(db.tables)

Problem is that db.tables is evaluated when the Auth class is
instantiated
=> only contains those tables created up to that point in the model

Workaround is to explictly call that line at the end of the model(s).

Not sure how to fix the class definition to avoid this.

If we can't then we should update documentation.

F
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:18388] feature request:

2009-03-20 Thread Jason Brower

I think it would be awsome to come up with a email system.  So you could
setup an internal or external email system.  Sending messages from user
to user in the same system and so forth.
I think it could provide a lot of functionality for intranet systems
like schools and businesses.  And my personal interest is to have this
for social networking systems.
Any ideas and thoughts on it?
Regards,
Jason Brower


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:18387] SQLTABLE showid?

2009-03-20 Thread carlo

What's the best way/trick to have showid=False in SQLTABLE either?

thank you

carlo


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:18386] Re: Integrating existing ping script [Using win32com module]

2009-03-20 Thread Timothy Farrell

I think you may be confusing push and pull MVC models.  web2py is a push 
model.  Consequently, views cannot call controllers, rather is the 
controller that is run and what it returns is applied to a predefined view.

Instead of printing the output, assign it to a variable and wrap it in a 
dictionary.  Return said dictionary...like so:

output = "Ping output goes here"
return dict(pingout=output)

If you don't have a view for your page, the default view will display 
the contents of the returned dictionary.  Otherwise, you can make a view 
that displays pingout like so:

{{=pingout}}

-tim

dave_mcgee wrote:
> Ok, I've worked on this some more and I've taken your recommendation
> to use a pure Python implementation available here (http://
> svn.pylucid.net/pylucid/CodeSnippets/ping.py)
>
> I have this set as a default.py controller in my web2py environment
> for my app project. Say, I wish to call this controller and run it
> from my app view  (When a user visits default/index.html the results
> from ping.py are displayed in it) - Is this hard to do?
>
> Thanks for your help guys - this is a major learning curve for me
>
>
>
> On Mar 20, 2:15 pm, dave_mcgee  wrote:
>   
>> Hi Tim! Thanks for the warm welcome and the assistance!
>>
>> Will work further on this today :)
>>
>> Regards,
>> Dave
>>
>> On Mar 20, 12:56 pm, Timothy Farrell  wrote:
>>
>> 
>>> Welcome to web2py!  We're glad you're here.
>>>   
>>> 1) To install win32 python extensions, the easiest way is to download
>>> and run the exe from:
>>>   
>>> http://sourceforge.net/project/platformdownload.php?group_id=78018
>>>   
>>> ...that corresponds to the version of Python you use.  Generally, when
>>> you see a setup.py script, you use that to install the package by
>>> upzipping the whole thing to a directory and then running: setup.py
>>> install.  Some packages will complain if you don't have a compiler
>>> installed because they want to compile some speedups.  In most cases you
>>> can run: setup.py install --without-speedups ...to get around that.
>>>   
>>> 2) Nope.  I tested your script and it works just fine as it is.  But it
>>> only accepts IP addresses (no domain names).
>>>   
>>> 3) I recommend that you use a more cross-platform solution.  See this
>>> page:http://stackoverflow.com/questions/316866/ping-a-site-in-python
>>>   
>>> -tim
>>>   
>>> dave_mcgee wrote:
>>>   
 Hi everyone. I'm new enough to web2py so please be gentle! :)
 
 I'm just involved in a small college project at the moment where we've
 had an existing python script monitoring a number of nodes and
 returning the results in the python GUI. I'm just moving onto trying
 to integrate the project into a web2py web framework environment (I've
 started today)
 
 I'm currently reading through the manual but having difficulty getting
 different pieces to work.
 
 I wish to use the Win32 com module to integrate the functionality of
 the ping command within my python script below. I'd apreciate it if
 someone could guide me as how to integrate this script within a web
 environment..
 
 1) Is it as simple as importing setup.py into my project in Web2py
 from the win32 folder I extracted off source forge?
 
 2) Do I have to change any parameters, at all?
 
 Any other help would be much apreciated! Script is below.. Thanks!
 
 import win32com.client
 
 wmi = win32com.client.GetObject(r"winmgmts:\\.\root\cimv2")
 
 def Ping(host):
 col_items = wmi.ExecQuery("Select * from Win32_PingStatus Where
 Address = '%s'" % host)
 for item in col_items:
 if item.StatusCode == 0:
 # success
 print "Host ", item.Address
 print "Recorded Hops: ", item.RecordRoute
 print "Buffer Size: ", item.ReplySize
 print "Response Time: ", item.ResponseTime
 print "ResponseTimeToLive: ", item.ResponseTimeToLive
 print "Timeout: ", item.Timeout
 print "TimetoLive: ", item.TimetoLive
 
 # ping node
 Ping('192.168.1.3')
 
>>> --
>>> Timothy Farrell 
>>> Computer Guy
>>> Statewide General Insurance Agency (www.swgen.com)
>>>   
> >
>   

-- 
Timothy Farrell 
Computer Guy
Statewide General Insurance Agency (www.swgen.com)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:18385] Re: Integrating existing ping script [Using win32com module]

2009-03-20 Thread dave_mcgee

Ok, I've worked on this some more and I've taken your recommendation
to use a pure Python implementation available here (http://
svn.pylucid.net/pylucid/CodeSnippets/ping.py)

I have this set as a default.py controller in my web2py environment
for my app project. Say, I wish to call this controller and run it
from my app view  (When a user visits default/index.html the results
from ping.py are displayed in it) - Is this hard to do?

Thanks for your help guys - this is a major learning curve for me



On Mar 20, 2:15 pm, dave_mcgee  wrote:
> Hi Tim! Thanks for the warm welcome and the assistance!
>
> Will work further on this today :)
>
> Regards,
> Dave
>
> On Mar 20, 12:56 pm, Timothy Farrell  wrote:
>
> > Welcome to web2py!  We're glad you're here.
>
> > 1) To install win32 python extensions, the easiest way is to download
> > and run the exe from:
>
> >http://sourceforge.net/project/platformdownload.php?group_id=78018
>
> > ...that corresponds to the version of Python you use.  Generally, when
> > you see a setup.py script, you use that to install the package by
> > upzipping the whole thing to a directory and then running: setup.py
> > install.  Some packages will complain if you don't have a compiler
> > installed because they want to compile some speedups.  In most cases you
> > can run: setup.py install --without-speedups ...to get around that.
>
> > 2) Nope.  I tested your script and it works just fine as it is.  But it
> > only accepts IP addresses (no domain names).
>
> > 3) I recommend that you use a more cross-platform solution.  See this
> > page:http://stackoverflow.com/questions/316866/ping-a-site-in-python
>
> > -tim
>
> > dave_mcgee wrote:
> > > Hi everyone. I'm new enough to web2py so please be gentle! :)
>
> > > I'm just involved in a small college project at the moment where we've
> > > had an existing python script monitoring a number of nodes and
> > > returning the results in the python GUI. I'm just moving onto trying
> > > to integrate the project into a web2py web framework environment (I've
> > > started today)
>
> > > I'm currently reading through the manual but having difficulty getting
> > > different pieces to work.
>
> > > I wish to use the Win32 com module to integrate the functionality of
> > > the ping command within my python script below. I'd apreciate it if
> > > someone could guide me as how to integrate this script within a web
> > > environment..
>
> > > 1) Is it as simple as importing setup.py into my project in Web2py
> > > from the win32 folder I extracted off source forge?
>
> > > 2) Do I have to change any parameters, at all?
>
> > > Any other help would be much apreciated! Script is below.. Thanks!
>
> > > import win32com.client
>
> > > wmi = win32com.client.GetObject(r"winmgmts:\\.\root\cimv2")
>
> > > def Ping(host):
> > >     col_items = wmi.ExecQuery("Select * from Win32_PingStatus Where
> > > Address = '%s'" % host)
> > >     for item in col_items:
> > >         if item.StatusCode == 0:
> > > # success
> > >             print "Host ", item.Address
> > >             print "Recorded Hops: ", item.RecordRoute
> > >             print "Buffer Size: ", item.ReplySize
> > >             print "Response Time: ", item.ResponseTime
> > >             print "ResponseTimeToLive: ", item.ResponseTimeToLive
> > >             print "Timeout: ", item.Timeout
> > >             print "TimetoLive: ", item.TimetoLive
>
> > > # ping node
> > > Ping('192.168.1.3')
>
> > --
> > Timothy Farrell 
> > Computer Guy
> > Statewide General Insurance Agency (www.swgen.com)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:18384] Re: Nested queries

2009-03-20 Thread Speedbird

Excellent thanks Yarko.

On Mar 20, 8:14 am, Yarko Tymciurak  wrote:
> On Fri, Mar 20, 2009 at 9:41 AM, Speedbird  wrote:
>
> > In this particular line (I just assigned it to a variable for
> > exmpanation purposes)::
>
> > recs = db().select(db.jobs.description,u1.name,u2.name, left=(u1.on
> > (db.jobs.user1==u1.id),u2.on(db.jobs.user2==u2.id)))
>
> > How do you reference "u1.name" or "u2.name"? - Consider the following:
>
> > row1_desc = recs[0].description
> > row1_name = recs[0].name # <--- What Name
>
> in both inner and out joins, select returns unambiguous elements, e.g.:
>
>     for row in recs:
>          print row.u1.name, row.u2.name, row.jobs.description
>
> - Yarko
>
>
>
>
>
> > Or am I way off base here?
>
> > Thanks in advance for any help!
>
> > jf/sb
>
> > On Mar 17, 8:15 am, ls1  wrote:
> > > Thanks a lot. Works great!
>
> > > Small correction, aliases should be with 'db.' prefix:
>
> > > u1=db.users.with_alias('u1')
> > > u2=db.users.with_alias('u2')
> > > db().select(db.jobs.description,u1.name,u2.name,
> > left=(u1.on(db.jobs.user1==u1.id),u2.on(db.jobs.user2==u2.id)))
>
> > > On 17 Mar, 16:05, mdipierro  wrote:
>
> > > > This should do it:
>
> > > > u1=users.with_alias('u1')
> > > > u2=users.with_alias('u2')
> > > > db().select(db.jobs.description,u1.name,u2.name,
> > > >   left=(u1.on(db.jobs.user1==u1.id),u2.on(db.jobs.user2==u2.id)))
>
> > > > On Mar 17, 9:48 am, ls1  wrote:
>
> > > > > Let's consider following tables:
>
> > > > > db.define_table('users', SQLField('name'))
> > > > > id1=db.users.insert(name='user A')
> > > > > id2=db.users.insert(name='user B')
>
> > > > > db.define_table('jobs',
> > > > >                        SQLField('description'),
> > > > >                        SQLField('user1',db.users),
> > > > >                        SQLField('user2',db.users))
> > > > > db.jobs.user1.requires=IS_IN_DB(db,'users.id','%(name)s')
> > > > > db.jobs.user2.requires=IS_IN_DB(db,'users.id','%(name)s')
>
> > > > > db.jobs.insert(description='some job to do', user1=id1, user2=id2)
>
> > > > > Simple query like this will give me name of user1:
> > > > > db(db.jobs.user1==db.users.id).select(db.jobs.description,
> > > > > db.users.name)
>
> > > > > Question: how to make query to show 'description' from table 'jobs'
> > > > > together with names of the 2 users taken from table users?
> > > > > something like:  jobs.description   user1.name    user2.name- Hide
> > quoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:18383] Re: Marketing suggestion

2009-03-20 Thread ma...@rockiger.com

Blackmailing was not intented,
I want to apologize for that.
The name is fine for me. I know and love the project already.
Also the name is SEO-optimzed.


>
> As for "..he should..."  --- there are some interesting psychology books on
> the language of emotional blackmail ;-)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:18382] Re: Nested queries

2009-03-20 Thread Yarko Tymciurak
On Fri, Mar 20, 2009 at 9:41 AM, Speedbird  wrote:

>
> In this particular line (I just assigned it to a variable for
> exmpanation purposes)::
>
> recs = db().select(db.jobs.description,u1.name,u2.name, left=(u1.on
> (db.jobs.user1==u1.id),u2.on(db.jobs.user2==u2.id)))
>
> How do you reference "u1.name" or "u2.name"? - Consider the following:
>
> row1_desc = recs[0].description
> row1_name = recs[0].name # <--- What Name


in both inner and out joins, select returns unambiguous elements, e.g.:

for row in recs:
 print row.u1.name, row.u2.name, row.jobs.description

- Yarko

>
>
> Or am I way off base here?
>
> Thanks in advance for any help!
>
> jf/sb
>
>
> On Mar 17, 8:15 am, ls1  wrote:
> > Thanks a lot. Works great!
> >
> > Small correction, aliases should be with 'db.' prefix:
> >
> > u1=db.users.with_alias('u1')
> > u2=db.users.with_alias('u2')
> > db().select(db.jobs.description,u1.name,u2.name,
> left=(u1.on(db.jobs.user1==u1.id),u2.on(db.jobs.user2==u2.id)))
> >
> > On 17 Mar, 16:05, mdipierro  wrote:
> >
> >
> >
> > > This should do it:
> >
> > > u1=users.with_alias('u1')
> > > u2=users.with_alias('u2')
> > > db().select(db.jobs.description,u1.name,u2.name,
> > >   left=(u1.on(db.jobs.user1==u1.id),u2.on(db.jobs.user2==u2.id)))
> >
> > > On Mar 17, 9:48 am, ls1  wrote:
> >
> > > > Let's consider following tables:
> >
> > > > db.define_table('users', SQLField('name'))
> > > > id1=db.users.insert(name='user A')
> > > > id2=db.users.insert(name='user B')
> >
> > > > db.define_table('jobs',
> > > >SQLField('description'),
> > > >SQLField('user1',db.users),
> > > >SQLField('user2',db.users))
> > > > db.jobs.user1.requires=IS_IN_DB(db,'users.id','%(name)s')
> > > > db.jobs.user2.requires=IS_IN_DB(db,'users.id','%(name)s')
> >
> > > > db.jobs.insert(description='some job to do', user1=id1, user2=id2)
> >
> > > > Simple query like this will give me name of user1:
> > > > db(db.jobs.user1==db.users.id).select(db.jobs.description,
> > > > db.users.name)
> >
> > > > Question: how to make query to show 'description' from table 'jobs'
> > > > together with names of the 2 users taken from table users?
> > > > something like:  jobs.description   user1.nameuser2.name- Hide
> quoted text -
> >
> > - Show quoted text -
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:18381] Re: Domain logic

2009-03-20 Thread mdipierro

yes

On Mar 19, 1:40 am, desfrenes  wrote:
> ok... so basically I can create classes that will use the DAL
> instead ?
> Can I still define these classes in db.py ?
>
> On 19 mar, 07:36, mdipierro  wrote:
>
> > You cannot because web2py has DAL not an ORM. This means records are
> > not objects, they are dictionaries.
>
> > You can define functions
>
> > def myCustomMethod(record):
> >     return record.my_favorite_field
>
> > for record in db().select(.): print myCustomMethod(record)
>
> > Massimo
>
> > On Mar 19, 1:23 am, Desfrênes Mickaël  wrote:
>
> > > Hello web2py fans,
>
> > > I was playing with web2py and I thought "where can I put my domain logic 
> > > ?".
> > > Models/db.py only defines tables and fields but what if I want to add some
> > > logic on top ? Should I define classes that will use db like this:
>
> > > import db
>
> > > class myClass:
> > >     def doSmth(self):
> > >         # use db.table here
>
> > > In other frameworks I would just add methods to classes that inherits from
> > > Record class like this:
>
> > > class myClass extends Doctrine_Record
> > > {
> > >     public function setTableDefinition()
> > >     {
> > >         $this->hasColumn('name','string');
> > >     }
>
> > >    // add some logic here
> > >    public function myCustomMethod()
> > >    {
> > >         /// do something here.
> > >    }
>
> > > }
>
> > > thanks for the advice.
>
> > > Mickaël.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:18380] Re: Nested queries

2009-03-20 Thread Speedbird

In this particular line (I just assigned it to a variable for
exmpanation purposes)::

recs = db().select(db.jobs.description,u1.name,u2.name, left=(u1.on
(db.jobs.user1==u1.id),u2.on(db.jobs.user2==u2.id)))

How do you reference "u1.name" or "u2.name"? - Consider the following:

row1_desc = recs[0].description
row1_name = recs[0].name # <--- What Name

Or am I way off base here?

Thanks in advance for any help!

jf/sb


On Mar 17, 8:15 am, ls1  wrote:
> Thanks a lot. Works great!
>
> Small correction, aliases should be with 'db.' prefix:
>
> u1=db.users.with_alias('u1')
> u2=db.users.with_alias('u2')
> db().select(db.jobs.description,u1.name,u2.name, 
> left=(u1.on(db.jobs.user1==u1.id),u2.on(db.jobs.user2==u2.id)))
>
> On 17 Mar, 16:05, mdipierro  wrote:
>
>
>
> > This should do it:
>
> > u1=users.with_alias('u1')
> > u2=users.with_alias('u2')
> > db().select(db.jobs.description,u1.name,u2.name,
> >   left=(u1.on(db.jobs.user1==u1.id),u2.on(db.jobs.user2==u2.id)))
>
> > On Mar 17, 9:48 am, ls1  wrote:
>
> > > Let's consider following tables:
>
> > > db.define_table('users', SQLField('name'))
> > > id1=db.users.insert(name='user A')
> > > id2=db.users.insert(name='user B')
>
> > > db.define_table('jobs',
> > >                        SQLField('description'),
> > >                        SQLField('user1',db.users),
> > >                        SQLField('user2',db.users))
> > > db.jobs.user1.requires=IS_IN_DB(db,'users.id','%(name)s')
> > > db.jobs.user2.requires=IS_IN_DB(db,'users.id','%(name)s')
>
> > > db.jobs.insert(description='some job to do', user1=id1, user2=id2)
>
> > > Simple query like this will give me name of user1:
> > > db(db.jobs.user1==db.users.id).select(db.jobs.description,
> > > db.users.name)
>
> > > Question: how to make query to show 'description' from table 'jobs'
> > > together with names of the 2 users taken from table users?
> > > something like:  jobs.description   user1.name    user2.name- Hide quoted 
> > > text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:18379] Re: Integrating existing ping script [Using win32com module]

2009-03-20 Thread dave_mcgee

Hi Tim! Thanks for the warm welcome and the assistance!

Will work further on this today :)

Regards,
Dave

On Mar 20, 12:56 pm, Timothy Farrell  wrote:
> Welcome to web2py!  We're glad you're here.
>
> 1) To install win32 python extensions, the easiest way is to download
> and run the exe from:
>
> http://sourceforge.net/project/platformdownload.php?group_id=78018
>
> ...that corresponds to the version of Python you use.  Generally, when
> you see a setup.py script, you use that to install the package by
> upzipping the whole thing to a directory and then running: setup.py
> install.  Some packages will complain if you don't have a compiler
> installed because they want to compile some speedups.  In most cases you
> can run: setup.py install --without-speedups ...to get around that.
>
> 2) Nope.  I tested your script and it works just fine as it is.  But it
> only accepts IP addresses (no domain names).
>
> 3) I recommend that you use a more cross-platform solution.  See this
> page:http://stackoverflow.com/questions/316866/ping-a-site-in-python
>
> -tim
>
>
>
> dave_mcgee wrote:
> > Hi everyone. I'm new enough to web2py so please be gentle! :)
>
> > I'm just involved in a small college project at the moment where we've
> > had an existing python script monitoring a number of nodes and
> > returning the results in the python GUI. I'm just moving onto trying
> > to integrate the project into a web2py web framework environment (I've
> > started today)
>
> > I'm currently reading through the manual but having difficulty getting
> > different pieces to work.
>
> > I wish to use the Win32 com module to integrate the functionality of
> > the ping command within my python script below. I'd apreciate it if
> > someone could guide me as how to integrate this script within a web
> > environment..
>
> > 1) Is it as simple as importing setup.py into my project in Web2py
> > from the win32 folder I extracted off source forge?
>
> > 2) Do I have to change any parameters, at all?
>
> > Any other help would be much apreciated! Script is below.. Thanks!
>
> > import win32com.client
>
> > wmi = win32com.client.GetObject(r"winmgmts:\\.\root\cimv2")
>
> > def Ping(host):
> >     col_items = wmi.ExecQuery("Select * from Win32_PingStatus Where
> > Address = '%s'" % host)
> >     for item in col_items:
> >         if item.StatusCode == 0:
> > # success
> >             print "Host ", item.Address
> >             print "Recorded Hops: ", item.RecordRoute
> >             print "Buffer Size: ", item.ReplySize
> >             print "Response Time: ", item.ResponseTime
> >             print "ResponseTimeToLive: ", item.ResponseTimeToLive
> >             print "Timeout: ", item.Timeout
> >             print "TimetoLive: ", item.TimetoLive
>
> > # ping node
> > Ping('192.168.1.3')
>
> --
> Timothy Farrell 
> Computer Guy
> Statewide General Insurance Agency (www.swgen.com)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:18378] Re: Integrating existing ping script [Using win32com module]

2009-03-20 Thread Timothy Farrell

Welcome to web2py!  We're glad you're here.

1) To install win32 python extensions, the easiest way is to download 
and run the exe from:

http://sourceforge.net/project/platformdownload.php?group_id=78018

...that corresponds to the version of Python you use.  Generally, when 
you see a setup.py script, you use that to install the package by 
upzipping the whole thing to a directory and then running: setup.py 
install.  Some packages will complain if you don't have a compiler 
installed because they want to compile some speedups.  In most cases you 
can run: setup.py install --without-speedups ...to get around that.

2) Nope.  I tested your script and it works just fine as it is.  But it 
only accepts IP addresses (no domain names).

3) I recommend that you use a more cross-platform solution.  See this 
page: http://stackoverflow.com/questions/316866/ping-a-site-in-python

-tim

dave_mcgee wrote:
> Hi everyone. I'm new enough to web2py so please be gentle! :)
>
> I'm just involved in a small college project at the moment where we've
> had an existing python script monitoring a number of nodes and
> returning the results in the python GUI. I'm just moving onto trying
> to integrate the project into a web2py web framework environment (I've
> started today)
>
> I'm currently reading through the manual but having difficulty getting
> different pieces to work.
>
> I wish to use the Win32 com module to integrate the functionality of
> the ping command within my python script below. I'd apreciate it if
> someone could guide me as how to integrate this script within a web
> environment..
>
> 1) Is it as simple as importing setup.py into my project in Web2py
> from the win32 folder I extracted off source forge?
>
> 2) Do I have to change any parameters, at all?
>
> Any other help would be much apreciated! Script is below.. Thanks!
>
>
> import win32com.client
>
> wmi = win32com.client.GetObject(r"winmgmts:\\.\root\cimv2")
>
> def Ping(host):
> col_items = wmi.ExecQuery("Select * from Win32_PingStatus Where
> Address = '%s'" % host)
> for item in col_items:
> if item.StatusCode == 0:
> # success
> print "Host ", item.Address
> print "Recorded Hops: ", item.RecordRoute
> print "Buffer Size: ", item.ReplySize
> print "Response Time: ", item.ResponseTime
> print "ResponseTimeToLive: ", item.ResponseTimeToLive
> print "Timeout: ", item.Timeout
> print "TimetoLive: ", item.TimetoLive
>
> # ping node
> Ping('192.168.1.3')
>
> >
>   

-- 
Timothy Farrell 
Computer Guy
Statewide General Insurance Agency (www.swgen.com)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:18377] Re: Google Authentication + web2py on GAE

2009-03-20 Thread Joseph Jude

I'm assuming that you want to validate the user via google auth and
then allow the authenticated user into your application. Sometime
back, i did this for a desktop based application updating a
application hosted in appengine (after authentication). I wrote abt it
here:
http://www.jjude.com/2008/09/18/authenticating-in-gae/

At first I obtained the uid/pwd from the user and sent it via header
to authenticate. By one of the comments from the user, I realized that
it is not a safe manner. Later I let the google auth to validate the
user and then allow the access accordingly. The code is also shared in
google code. You can pick it up.

Hope this helps.

Joseph

On Mar 20, 7:09 am, NguyendHEX  wrote:
> You can use user class from google
>
> from google.appengine.api import users
> user = users.get_current_user()
> if user:
> #user.email()
> else:
> #redirect to login: users.create_login_url()
>
> Hope this help
>
> On Mar 20, 6:56 am, Tito Garrido  wrote:
>
> > Is there a way to use Google Authentication + web2py on GAE?
>
> > Regards,
>
> > Tito
>
> > --
> > Linux User #387870
> > .
> >  _/_õ|__|
> > ..º[ .-.___.-._| . . . .
> > .__( o)__( o).:___
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---