[web2py] Re: upgrade to latest version and error

2013-04-24 Thread Niphlod
seems that you have a very old installation of psycopg2 . upgrade that 
and you should be fine (pip install --upgrade psycopg2)

according to docs, server_version was added on psycopg2 2.0.12, and if I'm 
not mistaken  that should be well before 2 years ago.

On Wednesday, April 24, 2013 4:49:59 AM UTC+2, Auden RovelleQuartz wrote:
>
> Hello my application was working fine
>
> I upgraded to latest web2py version and get the following error: 
>
>
> Traceback (most recent call last):
>   File "gluon/restricted.py", line 212, in restricted
> exec ccode in environment
>   File "/home/www-data/web2py/applications/omniavx/models/db.py" 
> , line 4, in 
> 
> db = DAL("postgres://web2py:web2py@23.113.75.41/db1")
>   File "gluon/dal.py", line 7368, in __init__
> raise RuntimeError("Failure to connect, tried %d times:\n%s" % (attempts, 
> tb))
> RuntimeError: Failure to connect, tried 5 times:
> Traceback (most recent call last):
>   File "gluon/dal.py", line 7348, in __init__
> self._adapter = ADAPTERS[self._dbname](**kwargs)
>   File "gluon/dal.py", line 2634, in __init__
> if do_connect: self.reconnect()
>   File "gluon/dal.py", line 616, in reconnect
> self.after_connection_hook()
>   File "gluon/dal.py", line 572, in after_connection_hook
> self.after_connection()
>   File "gluon/dal.py", line 2639, in after_connection
> self.try_json()
>   File "gluon/dal.py", line 2652, in try_json
> supports_json = self.connection.server_version >= 90200
> AttributeError: 'psycopg2._psycopg.connection' object has no attribute 
> 'server_version'
>
>
> Does anyone have an idea what the issue could be? Thanks in advance!
>
>
>

-- 

--- 
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] virtual concatenated fields in represent function

2013-04-24 Thread Alex Glaros
Is there a way to concatenate fields in the represent function in the same 
way that countryTelephoneCode and countryName are in the "requires" 
validator below?

db.PartyPhoneNumberIntersection.countryTelephoneCode.requires = IS_IN_DB(db,db
.Country.countryTelephoneCode, '%(countryTelephoneCode)s %(countryName)s',
zero=T('choose one'))

thanks,

Alex Glaros

-- 

--- 
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: concatenated fields in represent function

2013-04-24 Thread Niphlod
represent can be a lambda so you can do all sort of crazy things.where 
are you stuck ?

-- 

--- 
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] twitter error using recipe from admin page

2013-04-24 Thread 黄祥
hi folks,

i'm trying to add twitter recent tweets that i learned from admin page. but 
when i'm implemented it returns an error :

Unable to download because:
local variable 'r' referenced before assignment

did anyone ever face the same situation? any hints, or solutions to solve 
this problems?

thanks a lot before

-- 

--- 
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] web2py chat example

2013-04-24 Thread Ricardo Pedroso
On Tue, Apr 23, 2013 at 11:37 PM, Arnon Marcus  wrote:

> How is this architected?

I'm not sure I understand what you want to know but
I suppose you are referring to the chat example and how it works:

1. You open the chat with your browser and it sends the last messages, this is a
"normal" request/response cycle, then...
2. An ajax request is made and if there are no new messages the server
holds the request indefinitely and only gives back a response when
there is a new message.
3. we've got the response, now go to 2 again.


> from what I understand, Tornado is a multithreaded event-loop, whith a 
> buil-in http-server, as a replacement for, say, apache.

No, tornado is not multithreaded, in fact it is not save share the
IOLoop between threads. see:
https://github.com/facebook/tornado/wiki/Threading-and-concurrency

Yes it has a builtin server, but you cannot compare with apache.
Apache is a general purpose server, tornado
is single thread and specific to call "tornado handlers", and with an
"adapter" call "WSGI handlers".


> Gevent is basically a similar idea, just with the event-loop implemented in 
> c, wrapped with a c-extension for python, and also has an http-server.

Short: Yes.

Long:

Very deep down, gevent and tornado use the same system, for example
epoll(Linux) / kqueue (BSD's).

gevent 0.x uses libevent, gevent 1.x they switch to libev, at least
last time I check.
libevent/libev are a layer to make easier  programming with async
events notifications,
with all the different mechanisms (epoll/kqueue/poll/select/...) -  (think DAL
to talk to different backends with an uniform API)

In tornado this layer is done in Python.

The really main difference between both is the way you program, with
gevent you can
do it in the "traditional/more natural" for the majority of
programmers (I am one of them :) ).
Gevent can achieve this by using coroutines through greenlets and
hiding them from you.
Even the event loop is hided from you.

With tornado you have to wrap your head around callbacks.
I think tornado recently introduced coroutines to simplify the
callback "mess", but
you have to explicit "yield" - Note: I'm not sure because I'm not
following tornado very close.

Other advantage I see with gevent is the clever monkey patching of
some python standard
libraries, making them and programs that uses them "green", this is
the reason that makes it
"WSGI friendly".

the best material about courotines for me is
http://www.dabeaz.com/coroutines/index.html,
if you are interested.

> Why do you need both?

Don't know, I never needed.

> How do they inter-operate?

Don't know, but maybe this can give you some ideas:
https://github.com/wil/gtornado


Ricardo

-- 

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

2013-04-24 Thread Cliff Kachinske
1) The code says it is possible to pass in linked_tables as a dictionary, 
in which case it will put the links together in the order produced by 
linked_tables.keys().  This may or may not give you what you want.  Quoting 
the Python web site, "The keys() method of a dictionary object returns a 
list of all the keys used in the dictionary, in arbitrary order (if you 
want it sorted, just apply the sorted() function to it)."

My suggestion is to just play with it.  As a starting point, try 
linked_tables = dict(sometable='id', othertable='id')

2) Check layout.html.  Again, spend some time playing with it. 

On Tuesday, April 23, 2013 9:49:42 PM UTC-4, funm...@gmail.com wrote:
>
> Hi all,
>
> I have a couple questions about the layout built by smartgrid. 
>
> 1) My smartgrid has a couple linked tables. They show up nicely as links 
> on the right hand side of the grid. Is there a way to control which linked 
> table to be listed first? It looks like that it is sorted by alphabetical 
> order from A to Z.  
>
> 2) when the page is built with the smartgrid, it shows the db name in the 
> upper left area. Is there a way to change it to something else?
>
> 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] cpdb.py not working...

2013-04-24 Thread Rocco
Hi all,

I've some trouble trying to migrate an app db from mysql to postgres using 
the cpdb.py script

My appname is "sviluppo" and it has all the tables defined inside 
"db_wizard.py".
Both the connection url (source and dest) are tested working

I used this command:
./web2py.py -S sviluppo -M  -R scripts/cpdb.py -A -f 
applications/sviluppo/databases 
\
-y 'mysql://sviluppo:password@localhost/sviluppo' -Y 
'postgres://web2py:password@192.168.0.23/sviluppo'

But I get this error:
web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2013
Version 2.4.5-stable+timestamp.2013.03.18.22.46.22
Database drivers available: SQLite(sqlite3), MySQL(pymysql), 
MySQL(MySQLdb), PostgreSQL(pg8000), MSSQL(pyodbc), DB2(pyodbc), 
Teradata(pyodbc), Ingres(pyodbc), IMAP(imaplib)
creating tables...
EXCEPTION: could not make a copy of the database
'NoneType' object is not iterable


The folder application/sviluppo/databases exists and it is not empy

I also tryed to save to sqlite ( -Y 'sqlite://storage.sqlite') with same 
failure.

Any suggestions?

Thanks, Rocco


-- 

--- 
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: Change record representation in crud form?

2013-04-24 Thread Loïc
Wel... 
I solved my problem using a custom widget. I don't know if it is the best 
solution, but it works.
The records are now represented like below : 
*
fruits
banana
apple
vegetables
potatoes
tomatoes*

Below my code for those who are interested :

*Create a "_widgets.py" file in models folder : *
class HierarchicalSelect(object):
def __init__(self, db, title_field):
self.options=[]
self.db = db
self.tablename = None
self.fieldname = None
self.title = title_field
self.type = None
self.parent=None
self.rows=None

def _childs_list(self, field, depth):
path = XML("")*depth
self.options.append((field['id'], path+field[self.title]))
[self._childs_list(child, (depth+1)) for child in self.rows.find(
lambda row: row.parent == field.id)]   

def widget(self, field, value):
print str(field)
self.tablename = field._table
self.fieldname = field.name
self.type = field.type
self.rows = self.db(self.tablename).select()
self.parent = field

root_fields = self.db(self.parent==None).select()
[self._childs_list(field,0) for field in self.rows.find(lambda row:row
.parent == None)] 

opt=[OPTION(name, _value=key) for key,name in self.options]
sel = SELECT(opt,_id="%s_%s" % (self.tablename, self.fieldname),
_class=self.type, 
_name=self.fieldname,
value=value)
return sel


*In your model file . *
foodSelector = HierarchicalSelect(db,db.food.name)
db.food.parent.widget = foodSelector .widget



Le mardi 23 avril 2013 10:59:10 UTC+2, Loïc a écrit :
>
> Hi All
>
> I have a model file : 
>
> db.define_table('food',
> Field('parent', 'reference food', label=T('Parent')),
> Field('name', unique=True, notnull=True, label=T('Name')),
> format='%(name)s'
> ) 
>
> Let's imagine I have some records in my db (fruits, vegetables, ...)
>
> In my controller, I create a form with
> form = crud.update(db.food,food,next=URL('default','index'))
>
> On my view, the "parent" field of the form is rendered as a "select" field 
> containing for example : 
> *fruits
> tomatoes
> banana
> apple
> potatoes
> vegetables*
>
> But I would like to see something like :
> *
> |
> |___fruits
> ||___banana
> ||___apple
> |___vegetables
>  |___potatoes
>  |___tomatoes*
>
> I thought I could change the representation of my field using the 
> "represent" attribute 
> db.food.parent.represent = lambda v: ...
> But the representation of the field doesn't change in the form.
>
> I wonder if I'm in the right direction, or if there an other way to do 
> what I'm trying...?
>
> Thank you
>

-- 

--- 
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: twitter error using recipe from admin page

2013-04-24 Thread Loïc
Can you show some code...?

Le mercredi 24 avril 2013 11:01:05 UTC+2, 黄祥 a écrit :
>
> hi folks,
>
> i'm trying to add twitter recent tweets that i learned from admin page. 
> but when i'm implemented it returns an error :
>
> Unable to download because:
> local variable 'r' referenced before assignment
>
> did anyone ever face the same situation? any hints, or solutions to solve 
> this problems?
>
> thanks a lot before
>

-- 

--- 
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] web2py x java

2013-04-24 Thread Ovidio Marinho
Leonel's right, if you want to compare frameworks java with python
frameworks oh yes you can talk in web2py x primefaces, for example. Yet the
architecture adopts java and python patterns can even use some standards of
design patterns, but some patterns java, as these are own when developing
JEE, EJB has own standards.

Portuguese:
Leonel está certo, se voce quer comparar frameworks java com frameworks
python ai sim você pode falar em web2py x primefaces , por exemplo. Mesmo
assim a arquitetura java adota padroes e o python pode até usar alguns
padroes de design patterns,mas alguns  padroes java, estes são proprios
como no caso do desenvolvimento JEE , EJB que tem seus proprios padrões.




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



2013/4/23 Marco Túlio Cícero de M. Porto 

> Does anyone has some written material comparing the development on Java
> (time, costs, processing, memory, etc) x development on Web2py ?
>
> Or if not, but has a solid point of view on that, could you comment a bit
> ? I wanted some info for a discussion on the use of those technologies on
> corporative systems.
>
> Thanks in advanced,
> 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] DAL select odd records

2013-04-24 Thread António Ramos
hello,
i have a table like

Name   date
 John   2013-01-01
John2013-01-01
Alex2013-02-02
Alex2013-02-03
Alex   2013-02-04

How do i select only alex because he has odd number of records?
I just want the name alex, i dont care how many.

-- 

--- 
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: Global (session) variable not updating (using components) until I refresh the page

2013-04-24 Thread AnnG
Yes, that is correct. I made the changes, (only minor adjustment to your 
solution was that I had to replace a 'default' with 'patient_scan_history' 
when setting response.js).

As usual, while writing my post I became slightly clearer in my head about 
where the problem lay, but didn't have the confidence to try anything until 
I heard back from this forum. During my searches, I found this helpful 
vimeo by 'mdipierro', which is related to your solution... 
http://vimeo.com/21363988

Thanks to all those who helped, I understand this a lot more now.

Ann

On Tuesday, 23 April 2013 22:08:22 UTC+1, Anthony wrote:
>
> If I understand correctly, the user must actually enter a patient id in a 
> form in the first component, correct? If that's the case, then you should 
> not use LOAD() for the third component, as LOAD() automatically loads the 
> component as soon as the parent page has loaded. Instead, you want to 
> trigger the third component to load after the user submits the patient id 
> in the first component. To do that, you can leave the div for the third 
> component empty:
>
>
>
> Then, in the patient_details() function, you can return some Javascript 
> that will trigger the third component to be loaded after the form has been 
> submitted:
>
> def patient_details():
> ...
> if form.process().accepted:
> ...
> response.js = 'web2py_component("%s", "patient_scan_history");' %URL
> ('default', 'patient_scan_history.load')
> ...
> return dict(...)
>
> When the form is submitted and the patient id has been saved to the 
> session, the patient_details() function adds some Javascript to 
> response.js, which will be executed in the browser when the Ajax call 
> completes. The Javascript calls the patient_scan_history() component and 
> loads its contents into the "patient_scan_history" div.
>
> Anthony
>
> On Tuesday, April 23, 2013 8:42:39 AM UTC-4, AnnG wrote:
>>
>> Hi,
>> I have a main patient input page with 3 components on... 
>>
>>
>> 
>> {{=LOAD('patient', 'patient_details.load', ajax=True, 
>> target='patient_info')}}
>> 
>>  
>> {{=LOAD('phenotype_form', 'phenotype_form.load', ajax=True, 
>> target='phenotype_form')}}  
>> 
>>  
>> {{=LOAD('patient_scan_history', 'patient_scan_history.load', 
>> ajax=True, target='patient_scan_history')}}  
>> 
>> .
>>
>> ...and to work properly, 2 of those components (the first and third 
>> above) need a patient id, which is held in an input box (id="patient_id") 
>> on a form, in patient_details.load (first component above) ...
>>
>> 
>>   
>> 
>> 
>>  Patient ID  (or leave empty for new patient): > name="patient_id" id="patient_id" value={{=(patient_id or '')}}>
>> 
>> {{=study_response}}
>> 
>> 
>> Source: > value={{=patient_source}}> 
>> Diagnosis: > 'diagnosis' value={{=patient_diagnosis}}>  
>> 
>> 
>> 
>>   
>>   
>> 
>>
>> ... and here is the part of patient_load.py, where I can get the 
>> patient_id from request.vars.patient_id, and set a global variable 
>> session.patient_id to have the same value.
>>
>> if(request.vars.patient_id):
>> session.patient_id = int(request.vars.patient_id)
>> 
>> study_response = open_patient_images_clearcanvas(session.
>> patient_id)
>>
>> db = get_db()
>> 
>> rows = db((db.patient.patient_pk == db.patient_diagnosis.
>> patient_fk) & (db.patient_diagnosis.diagnosis_fk == db.diagnosis.
>> diagnosis_pk) & (db.patient.patient_pk == session.patient_id)).select(db.
>> patient.source, db.diagnosis.diagnosis_name)
>>
>> ...
>>
>>
>> The above patient_load component works OK.  
>> BUT  the third component, where I wish to load patient history, and which 
>> also requires a patient_id, wont work properly, as the session.patient_id 
>> above is not updated until i press refresh.
>> Here is my main patient_scan_history.py function
>>
>> def patient_scan_history(): 
>> patient_id = 1
>> if(session.patient_id):
>> patient_id = session.patient_id
>> db = get_db()
>> patient_scans = Patient_scan_history(db, patient_id)
>> patient_scan_history = patient_scans.get_patient_scan_history()
>> else:
>> return dict(html_table = None)
>> 
>> html_table = TABLE(  TR(*[TH(*headers) for headers inpatient_scan_history
>> ['headers']]), *[TR(*rows) for rows in patient_scan_history['table']]) 
>> 
>> return dict(html_table=html_table)
>>
>> ... and my patient_scan_history.load
>>
>> 
>>   
>>  {{=html_table}}
>>   
>> 
>>
>> So from the users point of view, the top component information loads as 
>> soon as there is a valid patient id and the submit ('search patient') 
>> button is pressed. But the third component is not updated at this point, 
>> and only shows the correct patient histo

[web2py] Re: DAL select odd records

2013-04-24 Thread Loïc


Hi
Maybe you could try something like

db().select(db.myTable.name=='Alex', groupby=db.myTable.name)



Le mercredi 24 avril 2013 13:24:01 UTC+2, Ramos a écrit :
>
> hello,
> i have a table like
>
> Name   date
>  John   2013-01-01
> John2013-01-01
> Alex2013-02-02
> Alex2013-02-03
> Alex   2013-02-04
>
> How do i select only alex because he has odd number of records?
> I just want the name alex, i dont care how many.
>  

-- 

--- 
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: concatenated fields in represent function

2013-04-24 Thread Anthony
db.PartyPhoneNumberIntersection.countryTelephoneCode.represent = \
lambda v, r: '%(countryTelephoneCode)s %(countryName)s' % r

Anthony

On Wednesday, April 24, 2013 4:08:25 AM UTC-4, Alex Glaros wrote:
>
> Is there a way to concatenate fields in the represent function in the same 
> way that countryTelephoneCode and countryName are in the "requires" 
> validator below?
>
> db.PartyPhoneNumberIntersection.countryTelephoneCode.requires = IS_IN_DB(
> db, db.Country.countryTelephoneCode, '%(countryTelephoneCode)s %(
> countryName)s',zero=T('choose one'))
>
> thanks,
>
> Alex Glaros
>

-- 

--- 
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] web2py chat example

2013-04-24 Thread Arnon Marcus
First of all, by "architecture" I was referring to the server-side, not the 
client-side.
Secondly, when I asked "how do you combine gevent and tornado", I was 
referring to your statements:

"web2py app based on tornado long polling chat example."

The only requirement is to run it with gevent."

This implies that you "are" using both, so I wondered how exactly.

Furthermore:
I think you are conflating the concepts of "synchronous vs. asynchronous" 
with the concepts of "blocking-IO vs. non-blocking IO".
I think you are also conflating the concepts of "threading" with the 
concept of "concurrency".

"synchronous vs. asynchronous" - Is about code-structure.
"blocking-IO vs. non-blocking IO" - is about performance and 
"semi-concurrency" capabilities.

It is impossible to make a non-blocking-IO kind of code, with just 
structuring it "asynchronously".
It is not just a matter of getting the GIL to context-switch - you need 
something extra for IO - you need a system-level callback-mechanism, that 
would wake-up your co-routines, and you need that this call-back mechanism 
would not block the co-routine that is using it, and finally you need a way 
for both of these requirements to co-exist - a co-routine mechanism that 
can use the non-blocking system-level callback.
Currently, the only way to achieve that in python, without any c-extension 
that wrangles the stack, is to use threads.
It has nothing to do with concurrency, and nothing to do with thread-safety 
(sharing data across threads, as you link denotes).
No. It is about having a way to relinquish the GIL to a system-callback, in 
a non-blocking way.
The mechanism that you mentioned (epoll/kqueue/select, or IOCPs in windows), 
are providing a system-level callback-mechanism for IO operations (a-la 
"preemptive-multitasking"), but they do NOT supply integration of that with 
a non-blocking co-routine in python (at least not to my knowledge). Again, 
without a c-extension, you NEED a "thread" to do that - and it is exactly 
what Tornado does (again, to the best of my knowledge from my research - I 
can find the reference that says that, if you like). The link you added, is 
not addressing this at all - it is simply denoting the shortcomings of 
threads in general in python (lack of "true concurrency"  due to the GIL), 
and the problems of threading in-general (data-sharing, locking, etc.).
But BOTH of these issues do NOT relate to the "specific-usage of threads" 
for "non-blocking-co-routines" - this is a separate issue.
You CAN (and that is what Tornado does) use threads only for THAT 
specific requirement  without expecting concurrency and without using 
shared-data across threads.
Gevent solved this issue very differently, WITHOUT threads, and it is for 
THAT reason that it requires a third-party c-extension. It is not just the 
event-loop - it is the "non-blocking-co-routines" that such libraries as 
libevent/libev 
(or libuv of node.js) are solving. Gevent is not just an event-loop, it 
uses the "greenlet" extension (which implements co-routines in a 
"collaborative-multitasking" 
model, a-la "stackless", which is something "threads" can-not do), as an 
abstraction over these c-compiled libraries, to connect a non-blocking 
event-loop to a collaboratively-multi-tasked-co-routine.
In short, only gevent can do this in c-python without threads.
All other pythonic-solutions who can do this, are NOT c-python 
("stackless-python", PyPy, Iron-Python, Jython, etc.)

So unless Tornado is doing something that nobody is aware of, it IS using 
threads to implement a non-blocking-co-routine-IO-event-loop.
It might not use threads for other things, and may not support using 
threads to communicate with it's co-routines, but that's a separate issue.


Back to the issue - you said that your solution is using Tornado, and 
"requires" gevent - how so?

-- 

--- 
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 x java

2013-04-24 Thread Marco Túlio Cícero de M . Porto
I'm aware of that.

but, when you opt to use java on your development environment, you'll there
are certain aspects that you'll have to take into account. For ex: Java
usually will use more processor and memory, costs on hosting java are way
more expensive than any other language/framework, development time is
increased.

I'm really comparing apples to oranges here, but I'd like to hear that. I
guess many of you used (or even still use) Java for web development. But in
a point you guys changed to web2py.

At that point, neither of you thought on "programming language x
framework". I believe most of you thought about "time/costs/cpu and memory
usage/development time" (and other issues). At that moment, you where also
comparing apples to oranges.

So, it really doesn't matter. Question here is, while trying to justify
"why not java" or "why web2py" for people who knew only java all their
lives, what would you say?

Pretty much that. Thanks again.
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] Re: DAL select odd records

2013-04-24 Thread Anthony
Not sure if this can be done completely with the DAL, but doing some 
post-processing in Python:

count = db.mytable.Name.count()
rows = db(db.mytable).select(db.mytable.Name, count, groupby=db.mytable.Name
)
odd_count_names = [r.mytable.Name for r in rows if r[count] % 1 == 0]

Anthony

On Wednesday, April 24, 2013 7:24:01 AM UTC-4, Ramos wrote:
>
> hello,
> i have a table like
>
> Name   date
>  John   2013-01-01
> John2013-01-01
> Alex2013-02-02
> Alex2013-02-03
> Alex   2013-02-04
>
> How do i select only alex because he has odd number of records?
> I just want the name alex, i dont care how many.
>  

-- 

--- 
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: DAL select odd records

2013-04-24 Thread António Ramos
Thanks
That is how i did it reading the book.



2013/4/24 Anthony 

> Not sure if this can be done completely with the DAL, but doing some
> post-processing in Python:
>
> count = db.mytable.Name.count()
> rows = db(db.mytable).select(db.mytable.Name, count, groupby=db.mytable.
> Name)
> odd_count_names = [r.mytable.Name for r in rows if r[count] % 1 == 0]
>
> Anthony
>
>
> On Wednesday, April 24, 2013 7:24:01 AM UTC-4, Ramos wrote:
>>
>> hello,
>> i have a table like
>>
>> Name   date
>>  John   2013-01-01
>> John2013-01-01
>> Alex2013-02-02
>> Alex2013-02-03
>> Alex   2013-02-04
>>
>> How do i select only alex because he has odd number of records?
>> I just want the name alex, i dont care how many.
>>
>  --
>
> ---
> 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] REF: Back button in web2py

2013-04-24 Thread software.ted
if i have a component calling another component item, what code can i use 
for the back button to get to the previous component?

-- 

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

2013-04-24 Thread Domagoj Kovač
Hi guys.

I have this code in my view:

{{if rows:}}

{{number_of_pages = int(math.floor(number_of_records/
settings["items_per_page"]))}}
{{if request.args:}}
{{current_page = int(request.args[0])}}
{{else:}}
{{current_page = 0}}
{{pass}}

Prikazujem: {{=settings[
"items_per_page"]*current_page}} - {{=settings["items_per_page"]*(current_page 
+ 1)}} od {{=number_of_records}}

{{for x in range(0, number_of_pages):}}
{{if current_page is x:}}
{{=A(x+1, _href=URL(request.controller, request.
function, args=[x]), _class="current")}}
{{else:}}
{{=A(x+1, _href=URL(request.controller, request.
function, args=[x]))}}
{{pass}}
{{pass}}



{{pass}}

This code is basically universal. If i want to make some kind of paging 
plug in, what would be the best approach? Easiest thing at the moment would 
be make just a view and move this code there and then include this view in 
every grid page.

-- 

--- 
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 x java

2013-04-24 Thread LightDot
I'd start by "why python and not java" and continue with "why a framework 
and not starting from scratch" and end with "why web2py and not some other 
python framework".

Everything else would be comparing the incomparable... it goes without 
saying, not everything is black and white, try to keep an open mind. You'll 
probably find enough existing sources to start with, then perhaps show a 
preliminary text to various groups and communities and people might provide 
comments... and you'll most likely start a flame war or two ;)

Regards,
Ales

On Wednesday, April 24, 2013 2:47:45 PM UTC+2, Marco Tulio wrote:
>
> I'm aware of that.
>
> but, when you opt to use java on your development environment, you'll 
> there are certain aspects that you'll have to take into account. For ex: 
> Java usually will use more processor and memory, costs on hosting java are 
> way more expensive than any other language/framework, development time is 
> increased. 
>
> I'm really comparing apples to oranges here, but I'd like to hear that. I 
> guess many of you used (or even still use) Java for web development. But in 
> a point you guys changed to web2py. 
>
> At that point, neither of you thought on "programming language x 
> framework". I believe most of you thought about "time/costs/cpu and memory 
> usage/development time" (and other issues). At that moment, you where also 
> comparing apples to oranges. 
>
> So, it really doesn't matter. Question here is, while trying to justify 
> "why not java" or "why web2py" for people who knew only java all their 
> lives, what would you say?
>
> Pretty much that. Thanks again. 
> 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] Re: REF: Back button in web2py

2013-04-24 Thread LightDot
Ajax and browser back button functionality is a rather complex issue. I'm 
using a hacked version of history.js, but it's a pain... I have made a 
thread here a while ago, describing my approach: 
https://groups.google.com/forum/#!msg/web2py/U7aBJV2HTXI/nsNnYzgGsGsJ

Regards,
Ales

On Wednesday, April 24, 2013 3:00:41 PM UTC+2, software.ted wrote:
>
> if i have a component calling another component item, what code can i use 
> for the back button to get to the previous component?

-- 

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

2013-04-24 Thread Massimo Di Pierro
These links may interest you

http://web2py.com/books/default/chapter/29/12#Plugins
http://web2py.com/books/default/chapter/29/03#Adding-grids


On Wednesday, 24 April 2013 08:01:24 UTC-5, Domagoj Kovač wrote:
>
> Hi guys.
>
> I have this code in my view:
>
> {{if rows:}}
> 
> {{number_of_pages = int(math.floor(number_of_records/
> settings["items_per_page"]))}}
> {{if request.args:}}
> {{current_page = int(request.args[0])}}
> {{else:}}
> {{current_page = 0}}
> {{pass}}
> 
> Prikazujem: {{=settings[
> "items_per_page"]*current_page}} - 
> {{=settings["items_per_page"]*(current_page 
> + 1)}} od {{=number_of_records}}
> 
> {{for x in range(0, number_of_pages):}}
> {{if current_page is x:}}
> {{=A(x+1, _href=URL(request.controller,request
> .function, args=[x]), _class="current")}}
> {{else:}}
> {{=A(x+1, _href=URL(request.controller,request
> .function, args=[x]))}}
> {{pass}}
> {{pass}}
> 
> 
> 
> {{pass}}
>
> This code is basically universal. If i want to make some kind of paging 
> plug in, what would be the best approach? Easiest thing at the moment would 
> be make just a view and move this code there and then include this view in 
> every grid page.
>

-- 

--- 
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 to do a session.save() or session.commit()

2013-04-24 Thread Srinath G S
HI,

>From web2py book,
http://www.web2py.com/book/default/chapter/06

try:
 execute models, controller function and view
except:
 rollback all connections
 log the traceback
 send a ticket to the visitor
else:
 commit all connections
 save cookies, sessions and return the page

As per this, the sessions are saved almost when the request is about to be 
closed.

How to save session data manually? Probably I set something in session at the 
beginning of a function and I would want to save it immediately.

-- 

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

2013-04-24 Thread Domagoj Kovač
Thanks Massimo, 

I saw there is a system of plugins, but i wasn't sure are they the right 
choice for something like this. I will check them one more time.

-- 

--- 
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] Nice open source CMS (still maintained) in Web2py?

2013-04-24 Thread alastor . haissem
Hi Folks,

I discovered recently web2py and I really like it!

I wonder if it exist  a nice open source CMS (still maintained...) in 
web2py?
I don't need something overcomplicated. I prefer something basic but 
comfortable to use...

The goal is to create my personal website first, then contribute (if my 
skills are sufficient...)

Thank you

-- 

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




[web2py] Re: How to do a session.save() or session.commit()

2013-04-24 Thread Anthony
This just came up in another context. There's no way to do it via the 
public API, but I think it should work if you use one of the private 
methods:

session._try_store_in_db(request, response)  # for sessions in db
session._try_store_in_cookie_or_file(request, response)  # for sessions in 
cookies or files
session.forget(response)  # so it won't repeat the process at the end of 
the request

Anthony

On Wednesday, April 24, 2013 9:17:56 AM UTC-4, Srinath G S wrote:
>
> HI,
>
> From web2py book,
> http://www.web2py.com/book/default/chapter/06
>
> try:
>  execute models, controller function and view
> except:
>  rollback all connections
>  log the traceback
>  send a ticket to the visitor
> else:
>  commit all connections
>  save cookies, sessions and return the page
>
> As per this, the sessions are saved almost when the request is about to be 
> closed.
>
> How to save session data manually? Probably I set something in session at the 
> beginning of a function and I would want to save it immediately.
>
>

-- 

--- 
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 x java

2013-04-24 Thread Marco Túlio Cícero de M . Porto
I'm aware of that... but again, just trying to get enough to tell people
who've been working with Java for so long, to understand why web2py... your
reasoning sounds easier to understand, although I'd made it slightly
diferent:
1. "why a framework and not starting from scratch"
2. "why web2py and not some other framework". (instead of "python
framework", cause there are other cool frameworks out there that are not
python and worth mentioning)
3. and then "why python and not java" I guess...



it helped a bit... thanks.*
*
*
*
*
*


2013/4/24 LightDot 

> I'd start by "why python and not java" and continue with "why a framework
> and not starting from scratch" and end with "why web2py and not some other
> python framework".
>
> Everything else would be comparing the incomparable... it goes without
> saying, not everything is black and white, try to keep an open mind. You'll
> probably find enough existing sources to start with, then perhaps show a
> preliminary text to various groups and communities and people might provide
> comments... and you'll most likely start a flame war or two ;)
>
> Regards,
> Ales
>
>
> On Wednesday, April 24, 2013 2:47:45 PM UTC+2, Marco Tulio wrote:
>>
>> I'm aware of that.
>>
>> but, when you opt to use java on your development environment, you'll
>> there are certain aspects that you'll have to take into account. For ex:
>> Java usually will use more processor and memory, costs on hosting java are
>> way more expensive than any other language/framework, development time is
>> increased.
>>
>> I'm really comparing apples to oranges here, but I'd like to hear that. I
>> guess many of you used (or even still use) Java for web development. But in
>> a point you guys changed to web2py.
>>
>> At that point, neither of you thought on "programming language x
>> framework". I believe most of you thought about "time/costs/cpu and memory
>> usage/development time" (and other issues). At that moment, you where also
>> comparing apples to oranges.
>>
>> So, it really doesn't matter. Question here is, while trying to justify
>> "why not java" or "why web2py" for people who knew only java all their
>> lives, what would you say?
>>
>> Pretty much that. Thanks again.
>> 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.
>
>
>



-- 
[]'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] Re: twitter error using recipe from admin page

2013-04-24 Thread 黄祥
basically it's same like on the admin page, the different part is only the 
twitter user name.

*models/db.py*
TWITTER_HASH = "stifixid"

*controllers/default.py*
def twitter():
session.forget()
session._unlock(response)
import urllib
import gluon.tools
import gluon.contrib.simplejson as sj
try:
if TWITTER_HASH:
page = 
urllib.urlopen("http://search.twitter.com/search.json?q=%s"; % 
TWITTER_HASH).read()
data = sj.loads(page, encoding="utf-8")['results']
d = dict()
for e in data:
d[e["id"]] = e
r = reversed(sorted(d))
return dict(tweets=[d[k] for k in r])
else:
return 'disabled'
except Exception, e:
return DIV(T('Unable to download because:'), BR(), str(e))

def index():
return dict()

*views/default/index.html*
{{extend 'layout_default.html'}}



{{=T("Recent Tweets")}}
{{=T('loading...')}}
jQuery(document).ready(function(){jQuery('#tweets').load('{{=URL('twitter.load')}}');});



any idea why it's produce the errors? is it related to my twitter account? 
i'm trying to access my twitter account via twitter web is fine.
thanks and best regards

-- 

--- 
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] web2py chat example

2013-04-24 Thread Ricardo Pedroso
Hi Arnon,

On Wed, Apr 24, 2013 at 1:13 PM, Arnon Marcus  wrote:
> First of all, by "architecture" I was referring to the server-side, not the
> client-side.

the demo chat was running with:

$ cd 
$ nohup python anyserver.pt -s gevent

was running with gevent httpserver, no tornado involved in anything.


> Secondly, when I asked "how do you combine gevent and tornado", I was
> referring to your statements:
>
> "web2py app based on tornado long polling chat example."
> The only requirement is to run it with gevent."
>
> This implies that you "are" using both, so I wondered how exactly.

It's based in concept not in implementation.


> Furthermore:
> I think you are conflating the concepts of "synchronous vs. asynchronous"
> with the concepts of "blocking-IO vs. non-blocking IO".
> I think you are also conflating the concepts of "threading" with the concept
> of "concurrency".
>
> "synchronous vs. asynchronous" - Is about code-structure.
> "blocking-IO vs. non-blocking IO" - is about performance and
> "semi-concurrency" capabilities.

Those are subjective and context dependent terms that overlap.

I see them more like this:
blocking vs non-blocking synchronous vs non-blocking asynchronous


> So unless Tornado is doing something that nobody is aware of, it IS using
> threads to implement a non-blocking-co-routine-IO-event-loop.

Can you show me some example or point me to the source code of tornado
where this is been done? I'm curious.

> Back to the issue - you said that your solution is using Tornado, and
> "requires" gevent - how so?

It's not my solution :) it's just the tornado webchat example "ported"
to web2py running
on top of gevent, in fact I take the botlle webchat example that was
based (in concepts)
on tornado one, and I only adapted to web2py as an example.


Ricardo

-- 

--- 
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: Smartgrid layout question

2013-04-24 Thread fun man
Thanks Cliff.

I've tried a few combination, and it didn't get to what I want.

1) linked_tables=['demo_detail','achievement'].sort(reverse=True)
2) linked_tables=dict(demo_detail=id,achievement='id')

Case 1) - I still can't get achievement to listed first. My smartgrid shows
achievement first and then demo_detail.
Case 2) For the linked_tables=dict() one, the linked tables disappeared
from the smartgrid.

regards,


On Wed, Apr 24, 2013 at 5:32 PM, Cliff Kachinske  wrote:

> 1) The code says it is possible to pass in linked_tables as a dictionary,
> in which case it will put the links together in the order produced by
> linked_tables.keys().  This may or may not give you what you want.  Quoting
> the Python web site, "The keys() method of a dictionary object returns a
> list of all the keys used in the dictionary, in arbitrary order (if you
> want it sorted, just apply the sorted() function to it)."
>
> My suggestion is to just play with it.  As a starting point, try
> linked_tables = dict(sometable='id', othertable='id')
>
> 2) Check layout.html.  Again, spend some time playing with it.
>
>
> On Tuesday, April 23, 2013 9:49:42 PM UTC-4, funm...@gmail.com wrote:
>>
>> Hi all,
>>
>> I have a couple questions about the layout built by smartgrid.
>>
>> 1) My smartgrid has a couple linked tables. They show up nicely as links
>> on the right hand side of the grid. Is there a way to control which linked
>> table to be listed first? It looks like that it is sorted by alphabetical
>> order from A to Z.
>>
>> 2) when the page is built with the smartgrid, it shows the db name in the
>> upper left area. Is there a way to change it to something else?
>>
>> Thanks
>>
>>  --
>
> ---
> 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/52XMbp783Go/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] newbee - How to do for loading a file in my site

2013-04-24 Thread openoc80
Hi all,

It is very simple but i am quite blocked:
i did a site and I want to give the possibility to load some program and 
files.

exemple :
Repertory of my site
MySite
   /private 
 myProgram.exe
 myFile.txt

To load the myProgram.exe I put in my form this 

   http://127.0.0.1:8000/MySite/private/myProgram.exe";>Download
but i have one error 
" invalid controller (private/myProgram)"

Somebody can help me because I am quite lost.

ThanksPibol

-- 

--- 
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: Smartgrid layout question

2013-04-24 Thread fun man
sorry... i need some coffee. Typed the wrong name of table above.

Case 1) - I still can't get demo_detail to be listed first. My smartgrid
shows achievement first and then demo_detail.


On Wed, Apr 24, 2013 at 10:59 PM, fun man  wrote:

> Thanks Cliff.
>
> I've tried a few combination, and it didn't get to what I want.
>
> 1) linked_tables=['demo_detail','achievement'].sort(reverse=True)
> 2) linked_tables=dict(demo_detail=id,achievement='id')
>
> Case 1) - I still can't get achievement to listed first. My smartgrid
> shows achievement first and then demo_detail.
> Case 2) For the linked_tables=dict() one, the linked tables disappeared
> from the smartgrid.
>
> regards,
>
>
> On Wed, Apr 24, 2013 at 5:32 PM, Cliff Kachinske  wrote:
>
>> 1) The code says it is possible to pass in linked_tables as a dictionary,
>> in which case it will put the links together in the order produced by
>> linked_tables.keys().  This may or may not give you what you want.  Quoting
>> the Python web site, "The keys() method of a dictionary object returns a
>> list of all the keys used in the dictionary, in arbitrary order (if you
>> want it sorted, just apply the sorted() function to it)."
>>
>> My suggestion is to just play with it.  As a starting point, try
>> linked_tables = dict(sometable='id', othertable='id')
>>
>> 2) Check layout.html.  Again, spend some time playing with it.
>>
>>
>> On Tuesday, April 23, 2013 9:49:42 PM UTC-4, funm...@gmail.com wrote:
>>>
>>> Hi all,
>>>
>>> I have a couple questions about the layout built by smartgrid.
>>>
>>> 1) My smartgrid has a couple linked tables. They show up nicely as links
>>> on the right hand side of the grid. Is there a way to control which linked
>>> table to be listed first? It looks like that it is sorted by alphabetical
>>> order from A to Z.
>>>
>>> 2) when the page is built with the smartgrid, it shows the db name in
>>> the upper left area. Is there a way to change it to something else?
>>>
>>> Thanks
>>>
>>>  --
>>
>> ---
>> 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/52XMbp783Go/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: web2py x java

2013-04-24 Thread 黄祥
On Wednesday, April 24, 2013 9:22:24 PM UTC+7, Marco Tulio wrote:

> I'm aware of that... but again, just trying to get enough to tell people 
> who've been working with Java for so long, to understand why web2py... your 
> reasoning sounds easier to understand, although I'd made it slightly 
> diferent:
> 1. "why a framework and not starting from scratch"
>
i think a framework is more faster to build the website rather than 
starting from scratch. please imagine you build a website from scratch 
where you have to define the function for website from scratch, yet in the 
other side people have already define the function that you've spent your 
worth time created it.
 

> 2. "why web2py and not some other framework". (instead of "python 
> framework", cause there are other cool frameworks out there that are not 
> python and worth mentioning)
>
yes, you are right, there are a lot of cool frameworks out there that are 
not python and worth mentioning, but IMHO, the people choose what is 
suitable with them or the client request. for example if you have a project 
that client request you to make a website that use java for example spring, 
if you deliver it by python web2py, hm, i think you'll get into trouble if 
the client is not accept it.
 

> 3. and then "why python and not java" I guess... 
>
> hm, everything is a plus and minus side. i don't want to talk about the 
minus side because i'm not expert in java nor python and i've threw away 
the negativity from my life, lol. again, IMHO, is same like above, people 
choose what is suitable with them or the client request.

please correct me if i'm wrong
best regards

>

-- 

--- 
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: newbee - How to do for loading a file in my site

2013-04-24 Thread Niphlod
the private dir is not "exposed" by default (the name "private" should have 
give you an hint :-P )..

if you need to do something like that (e.g. a fast way to give access to 
some static file) you'd better put them in the /static directory (in that 
case it will work with exactly the same code you used).

If you need something that "lists" whatever you have in a fixed directory 
of yours, you can use the Expose class

from gluon.tools import Expose
def list_my_dir():
path = os.path.join(request.folder, 'private', 'whatever') 
##you shouldn't expose the "private" directory, but if you decided to 
do so 
files = Expose(path=path, basename='wonderful')
return dict(files=files)



On Wednesday, April 24, 2013 5:00:33 PM UTC+2, open...@gmail.com wrote:
>
> Hi all,
>
> It is very simple but i am quite blocked:
> i did a site and I want to give the possibility to load some program and 
> files.
>
> exemple :
> Repertory of my site
> MySite
>/private 
>  myProgram.exe
>  myFile.txt
>
> To load the myProgram.exe I put in my form this 
>
>http://127.0.0.1:8000/MySite/private/myProgram.exe
> ">Download
> but i have one error 
> " invalid controller (private/myProgram)"
>
> Somebody can help me because I am quite lost.
>
> ThanksPibol
>

-- 

--- 
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] Check it out: PURE AJAX file uploads :D

2013-04-24 Thread select
in your client side js code use the js file api (this is for one file, but 
multi file upload can be done too)

$('#datafile-uploadfield').change(function() {
var upload_element = $(this)[0];
var file = upload_element.files[0];
if (file) {
  var reader = new FileReader();
  reader.readAsDataURL(file); //, "UTF-8");//TODO what encoding should 
be parsed???
  reader.onload = (function(theFile) {
return function(evt) {
  $.ajax({
url: '{{=URL("datafile_create")}}',
data: {
  data: evt.target.result,
  name: theFile.name
},
type: 'POST',
dataType: 'json',
success: function(data) {
  addDatafile(data);
}
  });
};
  })(file);
  reader.onerror = function(evt) {
alert(":( oh noo, we could not read your file");
  };
  //++counter;
}
  });

in you controller
def datafile_create():
splitcontents = request.vars.data.split(',')
import base64
file_content = base64.b64decode(splitcontents[1])
# create file like object
import StringIO
filelike_obj = StringIO.StringIO(file_content)
db_store = db.datafiles.file.store(filelike_obj, request.vars.name)
record_id = db.datafiles.insert(file=db_store)


in you db.py
db.define_table('datafiles',
 Field('file', 'upload', requires=IS_NOT_EMPTY()),
 )

== PURE AWESOMENESS

-- 

--- 
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: newbee - How to do for loading a file in my site

2013-04-24 Thread openoc80
Thanks Niphlod.

I thought that Private was for files  I was really wrong! I am going to 
put all my files in the static's repertory and to do some tests. 

thanks a lot and maybe write you soon!

Pibol

On Wednesday, April 24, 2013 5:00:33 PM UTC+2, open...@gmail.com wrote:
>
> Hi all,
>
> It is very simple but i am quite blocked:
> i did a site and I want to give the possibility to load some program and 
> files.
>
> exemple :
> Repertory of my site
> MySite
>/private 
>  myProgram.exe
>  myFile.txt
>
> To load the myProgram.exe I put in my form this 
>
>http://127.0.0.1:8000/MySite/private/myProgram.exe
> ">Download
> but i have one error 
> " invalid controller (private/myProgram)"
>
> Somebody can help me because I am quite lost.
>
> ThanksPibol
>

-- 

--- 
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] REF: Generated SQLFORM form behavior sought

2013-04-24 Thread Teddy Nyambe
Is there a way to make the form generated by SQLFORM return the current
fields saved in the DB instead of making the fields blank? What i want is
to return the record.

-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

--- 
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 hide comments column (w2p_fc) from SQLFORM.grid() when edit some record

2013-04-24 Thread Mark
SQLFORM.grid(, editargs=dict(comments=False))

or 

SQLFORM.grid(, formstyle='bootstrap')


On Monday, April 22, 2013 2:15:35 PM UTC-4, Christian Espinoza wrote:
>
> Hi guys, somebody know how hide the comments column at a edit form using 
> SQLFORM.grid() ??
>
> I can do it using jquery with:
>
> $("tr td:nth-child(3)").each(function(){this.remove()});
>
> But 'm finding a server side(controllers maybe) way to do it..
>  
> 
> 
>  id="velocities_id__label">Id:  "velocities_id">1
>  "velocities_customer" id="velocities_customer__label">Cliente: 
>  "velocities_customer" name="customer" disabled="disabled"> >Intsercom Ltda
> 
>  "velocities_name" id="velocities_name__label">Nombre:  class="w2p_fw"> ="text" value="Ciudad" size="18" maxlength="14"> >
>  "velocities_max" id="velocities_max__label">Velocidad Maxima: 
>  name="max" type="number" value="40" min="10" max="200" maxlength="5" size=
> "6">
>  id="delete_record__label">Marque para eliminar:  "w2p_fw"> "delete_this_record" type="checkbox" value="on"> >
>  >
> 
> 
>
> Thanks in advance.
> Christian.
>

-- 

--- 
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 to add class to a checkbox?

2013-04-24 Thread Tito Garrido
Hi Folks,

I was reading:
http://web2py.com/books/default/chapter/29/07?search=checkboxes#Widgets

I am trying to implement some checkboxes with a specific class using DIVs:
db.anuncio.equipamento.widget=lambda field,value:
SQLFORM.widgets.checkboxes.widget(field,value,_class="span2",style='divs')

The style parameter works but the _class does not, how can I add class to
my divs?

Regards,

Tito

-- 

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

-- 

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




[web2py] Re: REF: Generated SQLFORM form behavior sought

2013-04-24 Thread Niphlod
you mean an edit form ?
record = db.table(1)
form = SQLFORM(db.table, record)



On Wednesday, April 24, 2013 5:35:18 PM UTC+2, software.ted wrote:
>
> Is there a way to make the form generated by SQLFORM return the current 
> fields saved in the DB instead of making the fields blank? What i want is 
> to return the record.
>
> -- 
>
> ...
> Teddy Lubasi Nyambe
> Opensource Zambia
> Lusaka, ZAMBIA
>
> Cell: +260 97 7760473
> website: http://www.opensource.org.zm
>
> ~/
> Human Knowledge belongs to the world! - AntiTrust
>
> Man is a tool-using animal. Without tools he is nothing, with tools he is 
> all - Thomas Carlyle 1795-1881
>
> /~ 
>

-- 

--- 
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: Check it out: PURE AJAX file uploads :D

2013-04-24 Thread Niphlod
why the base64 ? I want my files submitted as binaries, if possibile.

On Wednesday, April 24, 2013 5:31:48 PM UTC+2, select wrote:
>
> in your client side js code use the js file api (this is for one file, but 
> multi file upload can be done too)
>
> $('#datafile-uploadfield').change(function() {
> var upload_element = $(this)[0];
> var file = upload_element.files[0];
> if (file) {
>   var reader = new FileReader();
>   reader.readAsDataURL(file); //, "UTF-8");//TODO what encoding 
> should be parsed???
>   reader.onload = (function(theFile) {
> return function(evt) {
>   $.ajax({
> url: '{{=URL("datafile_create")}}',
> data: {
>   data: evt.target.result,
>   name: theFile.name
> },
> type: 'POST',
> dataType: 'json',
> success: function(data) {
>   addDatafile(data);
> }
>   });
> };
>   })(file);
>   reader.onerror = function(evt) {
> alert(":( oh noo, we could not read your file");
>   };
>   //++counter;
> }
>   });
>
> in you controller
> def datafile_create():
> splitcontents = request.vars.data.split(',')
> import base64
> file_content = base64.b64decode(splitcontents[1])
> # create file like object
> import StringIO
> filelike_obj = StringIO.StringIO(file_content)
> db_store = db.datafiles.file.store(filelike_obj, request.vars.name)
> record_id = db.datafiles.insert(file=db_store)
>
>
> in you db.py
> db.define_table('datafiles',
>  Field('file', 'upload', requires=IS_NOT_EMPTY()),
>  )
>
> == PURE AWESOMENESS
>
>

-- 

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




Re: [web2py] Re: REF: Generated SQLFORM form behavior sought

2013-04-24 Thread Teddy Nyambe
yah that exactly, but when you add a new record, the saved record does not
show in the form. I want the fields to remain with saved content. Even when
i use the example u have givenbut when i click on a button with an id
with an existing record in the db it shows without any problem...when i
make changes the record remains in the fields.


On Wed, Apr 24, 2013 at 5:51 PM, Niphlod  wrote:

> you mean an edit form ?
> record = db.table(1)
> form = SQLFORM(db.table, record)
>
>
>
> On Wednesday, April 24, 2013 5:35:18 PM UTC+2, software.ted wrote:
>>
>> Is there a way to make the form generated by SQLFORM return the current
>> fields saved in the DB instead of making the fields blank? What i want is
>> to return the record.
>>
>> --
>> ..**..**
>> ...
>> Teddy Lubasi Nyambe
>> Opensource Zambia
>> Lusaka, ZAMBIA
>>
>> Cell: +260 97 7760473
>> website: http://www.opensource.org.zm
>>
>> ~/
>> Human Knowledge belongs to the world! - AntiTrust
>>
>> Man is a tool-using animal. Without tools he is nothing, with tools he is
>> all - Thomas Carlyle 1795-1881
>>
>> /~
>>
>  --
>
> ---
> 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.
>
>
>



-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

--- 
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: Nice open source CMS (still maintained) in Web2py?

2013-04-24 Thread Neil
Hello,

This topic came up last month, and if my memory serves me correctly there 
were a few options available. I'd recommend searching this group for "CMS", 
and take a look at some of the more recent posts.

Neil

On Wednesday, 24 April 2013 14:57:52 UTC+1, alastor...@gmail.com wrote:
>
> Hi Folks,
>
> I discovered recently web2py and I really like it!
>
> I wonder if it exist  a nice open source CMS (still maintained...) in 
> web2py?
> I don't need something overcomplicated. I prefer something basic but 
> comfortable to use...
>
> The goal is to create my personal website first, then contribute (if my 
> skills are sufficient...)
>
> Thank you
>

-- 

--- 
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: Check it out: PURE AJAX file uploads :D

2013-04-24 Thread select
readAsBinaryString and readAsArrayBuffer and readAsText
did not work, i just tested, but if you have a hint on how to make them 
work I would be very interested

On Wednesday, April 24, 2013 5:53:33 PM UTC+2, Niphlod wrote:
>
> why the base64 ? I want my files submitted as binaries, if possibile.
>
> On Wednesday, April 24, 2013 5:31:48 PM UTC+2, select wrote:
>>
>> in your client side js code use the js file api (this is for one file, 
>> but multi file upload can be done too)
>>
>> $('#datafile-uploadfield').change(function() {
>> var upload_element = $(this)[0];
>> var file = upload_element.files[0];
>> if (file) {
>>   var reader = new FileReader();
>>   reader.readAsDataURL(file); //, "UTF-8");//TODO what encoding 
>> should be parsed???
>>   reader.onload = (function(theFile) {
>> return function(evt) {
>>   $.ajax({
>> url: '{{=URL("datafile_create")}}',
>> data: {
>>   data: evt.target.result,
>>   name: theFile.name
>> },
>> type: 'POST',
>> dataType: 'json',
>> success: function(data) {
>>   addDatafile(data);
>> }
>>   });
>> };
>>   })(file);
>>   reader.onerror = function(evt) {
>> alert(":( oh noo, we could not read your file");
>>   };
>>   //++counter;
>> }
>>   });
>>
>> in you controller
>> def datafile_create():
>> splitcontents = request.vars.data.split(',')
>> import base64
>> file_content = base64.b64decode(splitcontents[1])
>> # create file like object
>> import StringIO
>> filelike_obj = StringIO.StringIO(file_content)
>> db_store = db.datafiles.file.store(filelike_obj, request.vars.name)
>> record_id = db.datafiles.insert(file=db_store)
>>
>>
>> in you db.py
>> db.define_table('datafiles',
>>  Field('file', 'upload', requires=IS_NOT_EMPTY()),
>>  )
>>
>> == PURE AWESOMENESS
>>
>>

-- 

--- 
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: Check it out: PURE AJAX file uploads :D

2013-04-24 Thread Niphlod
it's not that I don't like the use of native js api, but if the tradeoff is 
transmitting as base64 that's not an implementation I want to use (given 
that there are plenty of "drop-loaders" out there). 
Base64 the contents means wasting a net 33% of bandwith.

-- 

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




[web2py] Re: How to add class to a checkbox?

2013-04-24 Thread Anthony
With the "divs" style, the parent element of the checkboxes is a CAT(), 
which doesn't produce an HTML element (and therefore can't take any HTML 
attributes, such as a class). Maybe try:

db.anuncio.equipamento.widget = \
lambda field, value: DIV(SQLFORM.widgets.checkboxes.widget(field, 
value,style
='divs'), _class="span2")

Anthony

On Wednesday, April 24, 2013 11:50:28 AM UTC-4, Tito Garrido wrote:
>
> Hi Folks,
>
> I was reading:
> http://web2py.com/books/default/chapter/29/07?search=checkboxes#Widgets
>
> I am trying to implement some checkboxes with a specific class using DIVs:
> db.anuncio.equipamento.widget=lambda field,value: 
> SQLFORM.widgets.checkboxes.widget(field,value,_class="span2",style='divs')
>
> The style parameter works but the _class does not, how can I add class to 
> my divs?
>
> Regards,
>
> Tito
>
> -- 
>
> Linux User #387870
> .
>  _/_õ|__|
> ..º[ .-.___.-._| . . . .
> .__( o)__( o).:___ 
>

-- 

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




Re: [web2py] Re: REF: Generated SQLFORM form behavior sought

2013-04-24 Thread Niphlod
I think you need to be more clear...either you want to:
- add a new record --> if you want to "preload" default values you just 
have to set them beforehand
- edit an existing record --> it's obvious that what you edit (and submit) 
has the same value of the next attempt to edit the same record

On Wednesday, April 24, 2013 6:00:11 PM UTC+2, software.ted wrote:
>
> yah that exactly, but when you add a new record, the saved record does not 
> show in the form. I want the fields to remain with saved content. Even when 
> i use the example u have givenbut when i click on a button with an id 
> with an existing record in the db it shows without any problem...when i 
> make changes the record remains in the fields.
>
>
> On Wed, Apr 24, 2013 at 5:51 PM, Niphlod  >wrote:
>
>> you mean an edit form ?
>> record = db.table(1)
>> form = SQLFORM(db.table, record)
>>
>>
>>
>> On Wednesday, April 24, 2013 5:35:18 PM UTC+2, software.ted wrote:
>>>
>>> Is there a way to make the form generated by SQLFORM return the current 
>>> fields saved in the DB instead of making the fields blank? What i want is 
>>> to return the record.
>>>
>>> -- 
>>> ..**..**
>>> ...
>>> Teddy Lubasi Nyambe
>>> Opensource Zambia
>>> Lusaka, ZAMBIA
>>>
>>> Cell: +260 97 7760473
>>> website: http://www.opensource.org.zm
>>>
>>> ~/
>>> Human Knowledge belongs to the world! - AntiTrust
>>>
>>> Man is a tool-using animal. Without tools he is nothing, with tools he 
>>> is all - Thomas Carlyle 1795-1881
>>>
>>> /~ 
>>>
>>  -- 
>>  
>> --- 
>> 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.
>>  
>>  
>>
>
>
>
> -- 
>
> ...
> Teddy Lubasi Nyambe
> Opensource Zambia
> Lusaka, ZAMBIA
>
> Cell: +260 97 7760473
> website: http://www.opensource.org.zm
>
> ~/
> Human Knowledge belongs to the world! - AntiTrust
>
> Man is a tool-using animal. Without tools he is nothing, with tools he is 
> all - Thomas Carlyle 1795-1881
>
> /~ 
>

-- 

--- 
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: Check it out: PURE AJAX file uploads :D

2013-04-24 Thread select
so what do these drop loaders do to make pure ajax file uploads, i was not 
aware of that o_O

On Wednesday, April 24, 2013 6:19:09 PM UTC+2, Niphlod wrote:
>
> it's not that I don't like the use of native js api, but if the tradeoff 
> is transmitting as base64 that's not an implementation I want to use (given 
> that there are plenty of "drop-loaders" out there). 
> Base64 the contents means wasting a net 33% of bandwith.
>
>

-- 

--- 
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: concatenated fields in represent function

2013-04-24 Thread Alex Glaros
Thanks Niphlod and Anthony,

it worked perfectly.

(note to total beginners, Anthony's backslash "\" means use a soft, not 
hard return")

much appreciated,

Alex

On Wednesday, April 24, 2013 5:00:00 AM UTC-7, Anthony wrote:
>
> db.PartyPhoneNumberIntersection.countryTelephoneCode.represent = \
> lambda v, r: '%(countryTelephoneCode)s %(countryName)s' % r
>
> Anthony
>
> On Wednesday, April 24, 2013 4:08:25 AM UTC-4, Alex Glaros wrote:
>>
>> Is there a way to concatenate fields in the represent function in the 
>> same way that countryTelephoneCode and countryName are in the "requires" 
>> validator below?
>>
>> db.PartyPhoneNumberIntersection.countryTelephoneCode.requires = IS_IN_DB(
>> db, db.Country.countryTelephoneCode, '%(countryTelephoneCode)s %(
>> countryName)s',zero=T('choose one'))
>>
>> thanks,
>>
>> Alex Glaros
>>
>

-- 

--- 
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: Check it out: PURE AJAX file uploads :D

2013-04-24 Thread select
so i basically missed what is going on right now because I did not looked 
at the problem for half a year 
http://caniuse.com/xhr2
xhr2 is supported by almost all browsers and xhr2 supports sending files :D
implementations are here 
http://stackoverflow.com/a/10811427/1436151
http://stackoverflow.com/questions/4856917/jquery-upload-progress-and-ajax-file-upload/4943774#4943774


On Wednesday, April 24, 2013 6:24:55 PM UTC+2, select wrote:
>
> so what do these drop loaders do to make pure ajax file uploads, i was not 
> aware of that o_O
>
> On Wednesday, April 24, 2013 6:19:09 PM UTC+2, Niphlod wrote:
>>
>> it's not that I don't like the use of native js api, but if the tradeoff 
>> is transmitting as base64 that's not an implementation I want to use (given 
>> that there are plenty of "drop-loaders" out there). 
>> Base64 the contents means wasting a net 33% of bandwith.
>>
>>

-- 

--- 
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] auth.messages.verify_email html template

2013-04-24 Thread Cristoffer Fairweather
First off, thanks to the community for a well written framework. The 
documentation is very nice and full of examples.

I thought I'd ask here, as I couldn't be the only want who didn't want a 
text "verify email" to be sent out in lieu of nice, colorful, css heavy 
html emails.
I want do the following to set an email template for 
auth.messages.verify_email. 
message = 'Click on the link https://' +request.env.http_host 
+URL(r=request,c='default',f='user',args=['verify_email']) 
+ '/%(key)s to verify your email'
context = dict(message=message)
auth.messages.verify_email  = 
response.render('emailtemplates/standard_email.html', context)

The problem is, because I have CSS in the template, I get the following 
error.
 unsupported format character ';' (0x3b) at 
index 316

Anyone else have this problem? I thought about modifying tool.py to use
self.messages.verify_email_context['key'] = key
message = 
response.render(self.message.verify_email_template,self.messages.verify_email_context)
 
#and put {{=key}} in the template
instead of
message=self.messages.verify_email  % dict(key=key)




A similar question was asked here, but I didn't get any resolution from the 
answer, as I'm having issues.
https://groups.google.com/forum/?fromgroups=#!newtopic/web2py/web2py/WehiJB0HURM

-- 

--- 
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: Custom User Registration

2013-04-24 Thread Cristoffer Fairweather
Looking in gluon > tools.py, it seems that when a registration is taking 
place, it doesn't call any framework code to execute a registration.
Rather, it simply does the registration actions inline, under form.accepts.

/gluon/tools.py +2308
if form.accepts(request, session, formname='register',
onvalidation=onvalidation, 
hideerror=self.settings.hideerror):

It's a little hacky to just copy the code out to where you want to use it, 
but unless we propose moving it to another method in Auth, we're not going 
to have a way to reuse the existing code.


On Tuesday, April 23, 2013 6:04:04 PM UTC-7, Mike D wrote:
>
> Is there a way to do user registration manually and still get all the 
> goodies that come with web2py registration (email verification, admin 
> approval, etc)? Something similar to login_bare() but for registration? 
> Just adding a user to the auth_user table doesn't trigger any of the 
> automatic stuff. 
>
> The reason I ask is I have a desktop client that talks to my web2py server 
> via JSON RPC and I'd like to enable users to register from there without 
> having to do everything else myself.
>
> 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: concatenated fields in represent function

2013-04-24 Thread Alex Glaros
Anthony, doesn't there have to be some sort of pointer to the correct 
reference record in the lookup table?

Here is a real example below (different fields and table than first 
example).

I tried to put "db.Country" in front of the lookup table field names, but 
the syntax is wrong.  Now that you can see the lookup table, could you 
please write out the complete syntax?

in '%(db.Country.countryTelephoneCode)s %(db.Country.countryName)s'

db.define_table('Country', ## Lookup table
Field('countryName','string'), 
Field('countryCode','string'),
Field('countryTelephoneCode','integer'))
## 
--
db.define_table('PhoneNumber',
Field('countryTelephoneCode','reference Country'), 
Field('telephoneNumber','integer'))
## ^^^
db.PhoneNumber.countryTelephoneCode.represent = lambda v, r: 
'%(db.Country.countryTelephoneCode)s 
%(db.Country.countryName)s' % r

Thanks,

Alex


On Wednesday, April 24, 2013 5:00:00 AM UTC-7, Anthony wrote:
>
> db.PartyPhoneNumberIntersection.countryTelephoneCode.represent = \
> lambda v, r: '%(countryTelephoneCode)s %(countryName)s' % r
>
> Anthony
>
> On Wednesday, April 24, 2013 4:08:25 AM UTC-4, Alex Glaros wrote:
>>
>> Is there a way to concatenate fields in the represent function in the 
>> same way that countryTelephoneCode and countryName are in the "requires" 
>> validator below?
>>
>> db.PartyPhoneNumberIntersection.countryTelephoneCode.requires = IS_IN_DB(
>> db, db.Country.countryTelephoneCode, '%(countryTelephoneCode)s %(
>> countryName)s',zero=T('choose one'))
>>
>> thanks,
>>
>> Alex Glaros
>>
>

-- 

--- 
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: concatenated fields in represent function

2013-04-24 Thread Anthony
Sorry, try:

db.PartyPhoneNumberIntersection.countryTelephoneCode.represent = \
lambda id, r: '%(countryTelephoneCode)s %(countryName)s' % db.Country(id
)

Anthony

On Wednesday, April 24, 2013 1:18:51 PM UTC-4, Alex Glaros wrote:
>
> Anthony, doesn't there have to be some sort of pointer to the correct 
> reference record in the lookup table?
>
> Here is a real example below (different fields and table than first 
> example).
>
> I tried to put "db.Country" in front of the lookup table field names in 
> the "represent" clause, but the syntax is wrong.  Now that you can see the 
> lookup table, could you please write out the complete syntax?
>
> db.define_table('Country', ## Lookup table
> Field('countryName','string'), 
> Field('countryCode','string'),
> Field('countryTelephoneCode','integer'))
> ## 
> --
> db.define_table('PhoneNumber',
> Field('countryTelephoneCode','reference Country'), 
> Field('telephoneNumber','integer'))
> ## ^^^
> db.PhoneNumber.countryTelephoneCode.represent = lambda v, r: 
> '%(db.Country.countryTelephoneCode)s 
> %(db.Country.countryName)s' % r
>
> Thanks,
>
> Alex
>
>
> On Wednesday, April 24, 2013 5:00:00 AM UTC-7, Anthony wrote:
>>
>> db.PartyPhoneNumberIntersection.countryTelephoneCode.represent = \
>> lambda v, r: '%(countryTelephoneCode)s %(countryName)s' % r
>>
>> Anthony
>>
>> On Wednesday, April 24, 2013 4:08:25 AM UTC-4, Alex Glaros wrote:
>>>
>>> Is there a way to concatenate fields in the represent function in the 
>>> same way that countryTelephoneCode and countryName are in the "requires" 
>>> validator below?
>>>
>>> db.PartyPhoneNumberIntersection.countryTelephoneCode.requires = IS_IN_DB
>>> (db, db.Country.countryTelephoneCode, '%(countryTelephoneCode)s %(
>>> countryName)s',zero=T('choose one'))
>>>
>>> thanks,
>>>
>>> Alex Glaros
>>>
>>

-- 

--- 
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 x java

2013-04-24 Thread Marco Túlio Cícero de M . Porto
thanks for taking your time to give your point of view... couldn't read
your name though.. are those characters chinese? Could be japanese, but
since japanese kanji are based on chinese, it would be a fair mistake by an
outsider.. :)




2013/4/24 黄祥 

> On Wednesday, April 24, 2013 9:22:24 PM UTC+7, Marco Tulio wrote:
>
>> I'm aware of that... but again, just trying to get enough to tell people
>> who've been working with Java for so long, to understand why web2py... your
>> reasoning sounds easier to understand, although I'd made it slightly
>> diferent:
>> 1. "why a framework and not starting from scratch"
>>
> i think a framework is more faster to build the website rather than
> starting from scratch. please imagine you build a website from scratch
> where you have to define the function for website from scratch, yet in the
> other side people have already define the function that you've spent your
> worth time created it.
>
>
>> 2. "why web2py and not some other framework". (instead of "python
>> framework", cause there are other cool frameworks out there that are not
>> python and worth mentioning)
>>
> yes, you are right, there are a lot of cool frameworks out there that are
> not python and worth mentioning, but IMHO, the people choose what is
> suitable with them or the client request. for example if you have a project
> that client request you to make a website that use java for example spring,
> if you deliver it by python web2py, hm, i think you'll get into trouble if
> the client is not accept it.
>
>
>> 3. and then "why python and not java" I guess...
>>
>> hm, everything is a plus and minus side. i don't want to talk about the
> minus side because i'm not expert in java nor python and i've threw away
> the negativity from my life, lol. again, IMHO, is same like above, people
> choose what is suitable with them or the client request.
>
> please correct me if i'm wrong
> best regards
>
>>  --
>
> ---
> 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] using scheduler: entry in scheduler_run "disappears"

2013-04-24 Thread DeanK
I've been debating using the baked in scheduler and figured I'd try it out 
first before fighting to get celery running with web2py.  I have a task 
that uses Popen to run an external program, processes the result, and 
returns.  When I run this with the scheduler, an entry in scheduler_run is 
created.  From what i can tell once the task completes, the entry 
disappears.  The entry in scheduler_task says "COMPLETE" for the task, but 
I have no insight into what just happened since there isn't an entry in 
scheduler_run for the task!  Thoughts on what is going on or how to debug? 
 Thanks,

Dean

-- 

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




[web2py] Re: using scheduler: entry in scheduler_run "disappears"

2013-04-24 Thread Niphlod
it's by design if the function doesn't return a value, then you don't 
need a record to store the result ^_^
try returning something from your function and you'll see that the record 
will remain.

e.g.
you have
def mytask():
# do something
 



switch it to
def mytask():
# do something
return 1



On Wednesday, April 24, 2013 8:15:39 PM UTC+2, DeanK wrote:
>
> I've been debating using the baked in scheduler and figured I'd try it out 
> first before fighting to get celery running with web2py.  I have a task 
> that uses Popen to run an external program, processes the result, and 
> returns.  When I run this with the scheduler, an entry in scheduler_run is 
> created.  From what i can tell once the task completes, the entry 
> disappears.  The entry in scheduler_task says "COMPLETE" for the task, but 
> I have no insight into what just happened since there isn't an entry in 
> scheduler_run for the task!  Thoughts on what is going on or how to debug? 
>  Thanks,
>
> Dean

-- 

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




[web2py] Re: using scheduler: entry in scheduler_run "disappears"

2013-04-24 Thread DeanK
haha brilliant.  Thanks for the quick response.

My task only operates on the db and internally after an external matlab 
call to chug on data so i wasn't returning anything.  A simple return 1 did 
the trick.

Also I'm using your ComfortScheduler plugin that i found while searching 
the message board.  Thanks for that as well.  So far it works pretty well. 
 I'll send you a message if i run into any issues.

Thanks again,
Dean


On Wednesday, April 24, 2013 2:37:26 PM UTC-4, Niphlod wrote:
>
> it's by design if the function doesn't return a value, then you don't 
> need a record to store the result ^_^
> try returning something from your function and you'll see that the record 
> will remain.
>
> e.g.
> you have
> def mytask():
> # do something
>  
>
>
>
> switch it to
> def mytask():
> # do something
> return 1
>
>
>
> On Wednesday, April 24, 2013 8:15:39 PM UTC+2, DeanK wrote:
>>
>> I've been debating using the baked in scheduler and figured I'd try it 
>> out first before fighting to get celery running with web2py.  I have a task 
>> that uses Popen to run an external program, processes the result, and 
>> returns.  When I run this with the scheduler, an entry in scheduler_run is 
>> created.  From what i can tell once the task completes, the entry 
>> disappears.  The entry in scheduler_task says "COMPLETE" for the task, but 
>> I have no insight into what just happened since there isn't an entry in 
>> scheduler_run for the task!  Thoughts on what is going on or how to debug? 
>>  Thanks,
>>
>> Dean
>
>

-- 

--- 
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: concatenated fields in represent function

2013-04-24 Thread Alex Glaros
That looks like an improvement Anthony but now receive this error

 format requires a mapping

There is data in all of the fields (there are no "None" values).

The represent  field names the above table are as follows:

db.PhoneNumber.countryTelephoneCode.represent = lambda id, r: 
'%(countryTelephoneCode)s 
%(countryName)s' % db.Country(id)

any ideas?

thanks,

Alex

On Wednesday, April 24, 2013 10:47:07 AM UTC-7, Anthony wrote:
>
> Sorry, try:
>
> db.PartyPhoneNumberIntersection.countryTelephoneCode.represent = \
> lambda id, r: '%(countryTelephoneCode)s %(countryName)s' % db.Country(
> id)
>
> Anthony
>
> On Wednesday, April 24, 2013 1:18:51 PM UTC-4, Alex Glaros wrote:
>>
>> Anthony, doesn't there have to be some sort of pointer to the correct 
>> reference record in the lookup table?
>>
>> Here is a real example below (different fields and table than first 
>> example).
>>
>> I tried to put "db.Country" in front of the lookup table field names in 
>> the "represent" clause, but the syntax is wrong.  Now that you can see the 
>> lookup table, could you please write out the complete syntax?
>>
>> db.define_table('Country', ## Lookup table
>> Field('countryName','string'), 
>> Field('countryCode','string'),
>> Field('countryTelephoneCode','integer'))
>> ## 
>> --
>> db.define_table('PhoneNumber',
>> Field('countryTelephoneCode','reference Country'), 
>> Field('telephoneNumber','integer'))
>> ## ^^^
>> db.PhoneNumber.countryTelephoneCode.represent = lambda v, r: 
>> '%(db.Country.countryTelephoneCode)s 
>> %(db.Country.countryName)s' % r
>>
>> Thanks,
>>
>> Alex
>>
>>
>> On Wednesday, April 24, 2013 5:00:00 AM UTC-7, Anthony wrote:
>>>
>>> db.PartyPhoneNumberIntersection.countryTelephoneCode.represent = \
>>> lambda v, r: '%(countryTelephoneCode)s %(countryName)s' % r
>>>
>>> Anthony
>>>
>>> On Wednesday, April 24, 2013 4:08:25 AM UTC-4, Alex Glaros wrote:

 Is there a way to concatenate fields in the represent function in the 
 same way that countryTelephoneCode and countryName are in the "requires" 
 validator below?

 db.PartyPhoneNumberIntersection.countryTelephoneCode.requires =IS_IN_DB
 (db, db.Country.countryTelephoneCode, '%(countryTelephoneCode)s %(
 countryName)s',zero=T('choose one'))

 thanks,

 Alex Glaros

>>>

-- 

--- 
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] CAS provider: additional fields only picked up at creation of local user

2013-04-24 Thread mjm
The docs at 
http://web2py.com/books/default/chapter/29/09#Central-Authentication-Service 
say: "Thanks to CAS 2.0 all fields that are readable on the provider and 
have a corresponding field in the auth_user table of the consumer will be 
copied automatically."

This is correct but does not mention that the contents of the additional 
field are only copied to the corresponding local field when the user logs 
in the first time, ie when the local user is created. When the original 
field (in the CAS provider) changes and the user later logs in locally the 
contents of the changed field are not copied again. 
This may be by design but may be confusing (it was to me). I suggest 
appending the docs. 

Also does anyone know what the local auth_cas table is for?

TIA

Marcel

-- 

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




[web2py] Re: using scheduler: entry in scheduler_run "disappears"

2013-04-24 Thread Niphlod
no probl, submit ideas too ^_^

On Wednesday, April 24, 2013 8:45:39 PM UTC+2, DeanK wrote:
>
> haha brilliant.  Thanks for the quick response.
>
> My task only operates on the db and internally after an external matlab 
> call to chug on data so i wasn't returning anything.  A simple return 1 did 
> the trick.
>
> Also I'm using your ComfortScheduler plugin that i found while searching 
> the message board.  Thanks for that as well.  So far it works pretty well. 
>  I'll send you a message if i run into any issues.
>
> Thanks again,
> Dean
>
>
> On Wednesday, April 24, 2013 2:37:26 PM UTC-4, Niphlod wrote:
>>
>> it's by design if the function doesn't return a value, then you don't 
>> need a record to store the result ^_^
>> try returning something from your function and you'll see that the record 
>> will remain.
>>
>> e.g.
>> you have
>> def mytask():
>> # do something
>>  
>>
>>
>>
>> switch it to
>> def mytask():
>> # do something
>> return 1
>>
>>
>>
>> On Wednesday, April 24, 2013 8:15:39 PM UTC+2, DeanK wrote:
>>>
>>> I've been debating using the baked in scheduler and figured I'd try it 
>>> out first before fighting to get celery running with web2py.  I have a task 
>>> that uses Popen to run an external program, processes the result, and 
>>> returns.  When I run this with the scheduler, an entry in scheduler_run is 
>>> created.  From what i can tell once the task completes, the entry 
>>> disappears.  The entry in scheduler_task says "COMPLETE" for the task, but 
>>> I have no insight into what just happened since there isn't an entry in 
>>> scheduler_run for the task!  Thoughts on what is going on or how to debug? 
>>>  Thanks,
>>>
>>> Dean
>>
>>

-- 

--- 
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: concatenated fields in represent function

2013-04-24 Thread Anthony
Hmm, that works for me. Does it work if you do:

db.PhoneNumber.countryTelephoneCode.represent = \
lambda id, r: '%(countryTelephoneCode)s %(countryName)s' % db.Country(id
).as_dict()

Also, confirm that all values in db.PhoneNumber.countryTelephoneCode do in 
fact reference existing records in the db.Country table. The error you got 
would typically arise if db.Country(id) doesn't return a record.

Finally, consider renaming db.PhoneNumber.countryTelephoneCode to 
db.PhoneNumber.Country or db.PhoneNumber.Country_id -- it actually stores a 
record id from the Country table, not a countryTelephoneCode. The name 
makes the code somewhat confusing to follow.

Anthony

On Wednesday, April 24, 2013 2:48:41 PM UTC-4, Alex Glaros wrote:
>
> That looks like an improvement Anthony but now receive this error
>
>  format requires a mapping
>
> There is data in all of the fields (there are no "None" values).
>
> The represent  field names in the above table are as follows:
>
> db.PhoneNumber.countryTelephoneCode.represent = lambda id, r: 
> '%(countryTelephoneCode)s 
> %(countryName)s' % db.Country(id)
>
> any ideas?
>
> thanks,
>
> Alex
>
> On Wednesday, April 24, 2013 10:47:07 AM UTC-7, Anthony wrote:
>>
>> Sorry, try:
>>
>> db.PartyPhoneNumberIntersection.countryTelephoneCode.represent = \
>> lambda id, r: '%(countryTelephoneCode)s %(countryName)s' % db.Country
>> (id)
>>
>> Anthony
>>
>> On Wednesday, April 24, 2013 1:18:51 PM UTC-4, Alex Glaros wrote:
>>>
>>> Anthony, doesn't there have to be some sort of pointer to the correct 
>>> reference record in the lookup table?
>>>
>>> Here is a real example below (different fields and table than first 
>>> example).
>>>
>>> I tried to put "db.Country" in front of the lookup table field names in 
>>> the "represent" clause, but the syntax is wrong.  Now that you can see the 
>>> lookup table, could you please write out the complete syntax?
>>>
>>> db.define_table('Country', ## Lookup table
>>> Field('countryName','string'), 
>>> Field('countryCode','string'),
>>> Field('countryTelephoneCode','integer'))
>>> ## 
>>> --
>>> db.define_table('PhoneNumber',
>>> Field('countryTelephoneCode','reference Country'), 
>>> Field('telephoneNumber','integer'))
>>> ## ^^^
>>> db.PhoneNumber.countryTelephoneCode.represent = lambda v, r: 
>>> '%(db.Country.countryTelephoneCode)s 
>>> %(db.Country.countryName)s' % r
>>>
>>> Thanks,
>>>
>>> Alex
>>>
>>>
>>> On Wednesday, April 24, 2013 5:00:00 AM UTC-7, Anthony wrote:

 db.PartyPhoneNumberIntersection.countryTelephoneCode.represent = \
 lambda v, r: '%(countryTelephoneCode)s %(countryName)s' % r

 Anthony

 On Wednesday, April 24, 2013 4:08:25 AM UTC-4, Alex Glaros wrote:
>
> Is there a way to concatenate fields in the represent function in the 
> same way that countryTelephoneCode and countryName are in the "requires" 
> validator below?
>
> db.PartyPhoneNumberIntersection.countryTelephoneCode.requires =IS_IN_DB
> (db, db.Country.countryTelephoneCode, '%(countryTelephoneCode)s %(
> countryName)s',zero=T('choose one'))
>
> thanks,
>
> Alex Glaros
>


-- 

--- 
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] Use DAL connection pool for MongoDB?

2013-04-24 Thread mjm
DAL now supports MongoDB which is nice for auth and forms. But I'd like to 
use the MongoDB query facilities (and maybe GridFS). 
Is it possible to obtain a connection to the database through DAL or should 
just use pymongo's MongoClient, as if it was another application?

TIA

Marcel

-- 

--- 
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] again: sqlite "database locked"

2013-04-24 Thread Martin Weissenboeck
I know, this topic has been discussed several times. Sometimes I get this
message.

(1) I want to use a "try - except" statement to catch this message. Has
anybody tried it? Where should the "try - except" go?
(2) If this does not work: which database would be better than sqlite?

Regards, Martin

-- 

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




[web2py] using scheduler, submitting task from a running task doesn't show up in scheduler_task

2013-04-24 Thread DeanK
So I've read through the documentation twice and could have skipped over 
some key point, but i'm having an issue submitting a task from a task.

I've stupefied my to paste it here, but basically from a controller i'm 
doing this:

scheduler.queue_task(my_parent_task,
pvars=dict(arg1=val,arg2=val))



...in scheduler.py:

def my_parent_task(arg1,arg2):
for batch in things_to_do: 
print "submitting job"
r = scheduler.queue_task(my_child_task,
pvars=dict(arg1= arg1,arg2=batch))
print r

return 1


def my_child_task(arg1,arg2):
print "in child task!"
return 1





>From the output of the parent task, if I print the row returned from 
scheduling the child task there are no errors and the tasks get assigned 
ids:

submitting job 
 
submitting job 
 
submitting job



If i look in scheduler_task the parent task id 26 is present but none of 
the child tasks.  If i resubmit my parent task it does in fact get assigned 
ID 30 so mysql is autoincrementing the column. 

Is there something i'm missing again where this is expected behavior?  I'd 
really like to be able to chain tasks together.  Thanks,

Dean


-- 

--- 
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: again: sqlite "database locked"

2013-04-24 Thread Niphlod
1) if you can't reproduce the error with a specific "line" of your code 
that triggers it, then is quite unuseful to try:catch every single db 
operation.
BTW, this is what you'd need to do
try:
db(somequery).select()
except:
#handle the exception
pass
try:
db(somequery).update(somefield='something')
db.commit()
except:
db.rollback()
#handle exception

2. Pretty much anything else beside Access and maybe Firebird embedded.


I'm a strong user (believer, evangelist, etc) of Postgresql, that is by far 
the most SQL compliant, extensible, hookable, opensource mvcc rdbms out 
there. On web2py's side, it's maybe the most tested. 
That being said, Mysql support is there too, if you want to jump on the 
Mysql (better to jump on the MariaDB one for sure) bandwagon for any 
reason. When you'll face strange lockings, outrageous execution times, 
transaction isolation problems, unsupported "rather standard queries", etc, 
and no-one will be able to explain the reasons behind those issues, you'll 
remember "Niphlod said that" :-P . 
I saw too many people jumping off cliffs for choosing Mysql too early in 
the process pushed by **buzzwords** and  **benchmarks** realizing too late 
that "if mysql really worked out as advertised " they wouldn't had to 
switch backends.


>

-- 

--- 
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: Nice open source CMS (still maintained) in Web2py?

2013-04-24 Thread Derek
The builtin wiki works as a CMS.. other than that, instantpress.

1) create a new app
2) edit default.py so that

   def index(): return auth.wiki()

3) navigate to http:///yourappname

https://groups.google.com/forum/#!topic/web2py/Y84vndej0jI/discussion

On Wednesday, April 24, 2013 6:57:52 AM UTC-7, alastor...@gmail.com wrote:
>
> Hi Folks,
>
> I discovered recently web2py and I really like it!
>
> I wonder if it exist  a nice open source CMS (still maintained...) in 
> web2py?
> I don't need something overcomplicated. I prefer something basic but 
> comfortable to use...
>
> The goal is to create my personal website first, then contribute (if my 
> skills are sufficient...)
>
> Thank you
>

-- 

--- 
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] SQL Server Connection String Please HELP

2013-04-24 Thread Derek
Don't need pyodbc, web2py comes with pypyodbc.

On Tuesday, April 23, 2013 5:35:03 PM UTC-7, Richard wrote:
>
> Did you install pyodbc?
>
> Also, your connection string seems to me doubtfull :
>
> Mine start like that :
> db=DAL()
>
> You should stick with db since it is a convention for us and may make help 
> you easier when we will need to read you code...
>
> But as long as you didn't rename DAL you should have something like that 
> as a connection string :
>
> db = DAL('mssql://username:password@localhost:portnumber/databaseNAME')
>
> And for sure you need pyodbc
>
> Richard
>
>
>
> On Tue, Apr 23, 2013 at 11:42 AM, ab234vv 
> > wrote:
>
>> Hello,
>>  
>> I am trying to learn web2py to display some stored procedures from my SQL 
>> server
>>  
>> I have managed to set up the environment, work with some sample 
>> exampleshowever I am stuck with trying to set up the connection.
>>  
>> What is the connection string? Currently I am using something like this:
>>  
>> b = SQLDB('mssql://username:password@localhost:portnumber/databaseNAME')
>>  
>> Can someone give me a some examples or link to any information where I 
>> can see how a simple program connects to a SQL SERVER DB and selects a few 
>> records from a table and displays them...
>>  
>> I have been researching to find examples, but I have not found anything 
>> specific to my problem,
>>  
>> My apologies if its a repeated question or the nature of the question is 
>> broad...
>>  
>> 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.




Re: [web2py] Re: again: sqlite "database locked"

2013-04-24 Thread Martin Weissenboeck
thx :-)
M


2013/4/24 Niphlod 

> 1) if you can't reproduce the error with a specific "line" of your code
> that triggers it, then is quite unuseful to try:catch every single db
> operation.
> BTW, this is what you'd need to do
> try:
> db(somequery).select()
> except:
> #handle the exception
> pass
> try:
> db(somequery).update(somefield='something')
> db.commit()
> except:
> db.rollback()
> #handle exception
>
> 2. Pretty much anything else beside Access and maybe Firebird embedded.
>
> 
> I'm a strong user (believer, evangelist, etc) of Postgresql, that is by
> far the most SQL compliant, extensible, hookable, opensource mvcc rdbms out
> there. On web2py's side, it's maybe the most tested.
> That being said, Mysql support is there too, if you want to jump on the
> Mysql (better to jump on the MariaDB one for sure) bandwagon for any
> reason. When you'll face strange lockings, outrageous execution times,
> transaction isolation problems, unsupported "rather standard queries", etc,
> and no-one will be able to explain the reasons behind those issues, you'll
> remember "Niphlod said that" :-P .
> I saw too many people jumping off cliffs for choosing Mysql too early in
> the process pushed by **buzzwords** and  **benchmarks** realizing too late
> that "if mysql really worked out as advertised " they wouldn't had to
> switch backends.
> 
>
>>  --
>
> ---
> 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: using scheduler, submitting task from a running task doesn't show up in scheduler_task

2013-04-24 Thread Niphlod
you're probably missing the part where a task gets executed in a 
"shell-like" environment, whose most-notable difference is that inside a 
task you have to manually db.commit().

While a db.commit() is ensured "automatically" at the end of every request 
in the normal web environment by web2py, inside a task you may want to 
commit() or rollback() "as per requirements".

That's the reason why queue_task() doesn't enforce a db.commit()  in a 
normal environment your task queued by the "web" is committed only if there 
aren't exceptions. Perfect! (you don't want to queue tasks if the 
controller function that generated it threw an exception)
 
A "tasks fired by tasks" is a perfect example: what if you want to queue 
your tasks only if the "parent" completed correctly ?

e.g.

def parent_task():
... do_something
... queue_task(child_task, ...)
1/0
...whoopsie!

def child_task():
"""I must run only if parent_task() completed correctly"""
... do_something()

so, just db.commit() at the end of parent_task and you're good to go.

PS: restating over and over (in case it's not clear). Whatever you do in 
your tasks involving a database must be commit()ed. This involves queueing 
new tasks cause you're using the database to queue them.

-- 

--- 
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] SQL Server Connection String Please HELP

2013-04-24 Thread Tim Richardson


>
>  
>> b = SQLDB('mssql://username:password@localhost:portnumber/databaseNAME')
>>  
>> Can someone give me a some examples or link to any information where I 
>> can see how a simple program connects to a SQL SERVER DB and selects a few 
>> records from a table and displays them...
>>  
>> I have been researching to find examples, but I have not found anything 
>> specific to my problem,
>>  
>>
>>  
>>
>
this is how I access a local server. The machine is server-win2003.

db = DAL('mssql://*user*:*pass*@server-win2003\hcnsql07/vcidat') 

In this case, the SQL Server has an instance name of hcnsql07
and the database is vcidat
Probably that part of the connection string is the trickiest (the server 
name and instance). I use Microsoft SQL Server Management Studio to connect 
to the database to prove to myself that  I know exactly the name of the 
server. In case you didn't know, there are free "Express" editions of 
Management Studio for download.

-- 

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




[web2py] Re: using scheduler, submitting task from a running task doesn't show up in scheduler_task

2013-04-24 Thread DeanK


> A "tasks fired by tasks" is a perfect example: what if you want to queue 
> your tasks only if the "parent" completed correctly ?


This makes perfect sense.  Also I forget that the "message passing" is 
being done through the database.  I added a db.commit() at the end of the 
parent task and all is right with the world.

You're saving my life today! Thanks,

Dean

 
On Wednesday, April 24, 2013 5:14:46 PM UTC-4, Niphlod wrote:
>
> you're probably missing the part where a task gets executed in a 
> "shell-like" environment, whose most-notable difference is that you have to 
> manually db.commit().
>
> While a db.commit() is ensured "automatically" at the end of every request 
> in the normal web environment by web2py, inside a task you may want to 
> commit() or rollback() "as per requirements".
>
> That's the reason why queue_task() doesn't enforce a db.commit()  in a 
> normal environment your task queued by the "web" is committed only if there 
> aren't exceptions. Perfect! (you don't want to queue tasks if the 
> controller function that generated it threw an exception)
>  
> A "tasks fired by tasks" is a perfect example: what if you want to queue 
> your tasks only if the "parent" completed correctly ?
>
> e.g.
>
> def parent_task():
> ... do_something
> ... queue_task(child_task, ...)
> 1/0
> ...whoopsie!
>
> def child_task():
> """I must run only if parent_task() completed correctly"""
> ... do_something()
>
> so, just db.commit() at the end of parent_task and you're good to go.
>
> PS: restating over and over (in case it's not clear). Whatever you do in 
> your tasks involving a database must be commit()ed. This involves queueing 
> new tasks cause you're using the database to queue them.
>
>
On Wednesday, April 24, 2013 5:14:46 PM UTC-4, Niphlod wrote:
>
> you're probably missing the part where a task gets executed in a 
> "shell-like" environment, whose most-notable difference is that you have to 
> manually db.commit().
>
> While a db.commit() is ensured "automatically" at the end of every request 
> in the normal web environment by web2py, inside a task you may want to 
> commit() or rollback() "as per requirements".
>
> That's the reason why queue_task() doesn't enforce a db.commit()  in a 
> normal environment your task queued by the "web" is committed only if there 
> aren't exceptions. Perfect! (you don't want to queue tasks if the 
> controller function that generated it threw an exception)
>  
> A "tasks fired by tasks" is a perfect example: what if you want to queue 
> your tasks only if the "parent" completed correctly ?
>
> e.g.
>
> def parent_task():
> ... do_something
> ... queue_task(child_task, ...)
> 1/0
> ...whoopsie!
>
> def child_task():
> """I must run only if parent_task() completed correctly"""
> ... do_something()
>
> so, just db.commit() at the end of parent_task and you're good to go.
>
> PS: restating over and over (in case it's not clear). Whatever you do in 
> your tasks involving a database must be commit()ed. This involves queueing 
> new tasks cause you're using the database to queue them.
>
>
On Wednesday, April 24, 2013 5:14:46 PM UTC-4, Niphlod wrote:
>
> you're probably missing the part where a task gets executed in a 
> "shell-like" environment, whose most-notable difference is that you have to 
> manually db.commit().
>
> While a db.commit() is ensured "automatically" at the end of every request 
> in the normal web environment by web2py, inside a task you may want to 
> commit() or rollback() "as per requirements".
>
> That's the reason why queue_task() doesn't enforce a db.commit()  in a 
> normal environment your task queued by the "web" is committed only if there 
> aren't exceptions. Perfect! (you don't want to queue tasks if the 
> controller function that generated it threw an exception)
>  
> A "tasks fired by tasks" is a perfect example: what if you want to queue 
> your tasks only if the "parent" completed correctly ?
>
> e.g.
>
> def parent_task():
> ... do_something
> ... queue_task(child_task, ...)
> 1/0
> ...whoopsie!
>
> def child_task():
> """I must run only if parent_task() completed correctly"""
> ... do_something()
>
> so, just db.commit() at the end of parent_task and you're good to go.
>
> PS: restating over and over (in case it's not clear). Whatever you do in 
> your tasks involving a database must be commit()ed. This involves queueing 
> new tasks cause you're using the database to queue them.
>
>

-- 

--- 
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: concatenated fields in represent function

2013-04-24 Thread Alex Glaros
Anthony,

It works.  Did not need the ".as_dict()"

The problem was with my data.  I still don't know what's wrong with that 
table, but tried your statement on a different table with different fields 
and it worked.

Thanks for the great tips.

Alex



On Wednesday, April 24, 2013 12:18:35 PM UTC-7, Anthony wrote:
>
> Hmm, that works for me. Does it work if you do:
>
> db.PhoneNumber.countryTelephoneCode.represent = \
> lambda id, r: '%(countryTelephoneCode)s %(countryName)s' % db.Country(
> id).as_dict()
>
> Also, confirm that all values in db.PhoneNumber.countryTelephoneCode do in 
> fact reference existing records in the db.Country table. The error you got 
> would typically arise if db.Country(id) doesn't return a record.
>
> Finally, consider renaming db.PhoneNumber.countryTelephoneCode to 
> db.PhoneNumber.Country or db.PhoneNumber.Country_id -- it actually stores a 
> record id from the Country table, not a countryTelephoneCode. The name 
> makes the code somewhat confusing to follow.
>
> Anthony
>
> On Wednesday, April 24, 2013 2:48:41 PM UTC-4, Alex Glaros wrote:
>>
>> That looks like an improvement Anthony but now receive this error
>>
>>  format requires a mapping
>>
>> There is data in all of the fields (there are no "None" values).
>>
>> The represent  field names in the above table are as follows:
>>
>> db.PhoneNumber.countryTelephoneCode.represent = lambda id, r: 
>> '%(countryTelephoneCode)s 
>> %(countryName)s' % db.Country(id)
>>
>> any ideas?
>>
>> thanks,
>>
>> Alex
>>
>> On Wednesday, April 24, 2013 10:47:07 AM UTC-7, Anthony wrote:
>>>
>>> Sorry, try:
>>>
>>> db.PartyPhoneNumberIntersection.countryTelephoneCode.represent = \
>>> lambda id, r: '%(countryTelephoneCode)s %(countryName)s' % db.
>>> Country(id)
>>>
>>> Anthony
>>>
>>> On Wednesday, April 24, 2013 1:18:51 PM UTC-4, Alex Glaros wrote:

 Anthony, doesn't there have to be some sort of pointer to the correct 
 reference record in the lookup table?

 Here is a real example below (different fields and table than first 
 example).

 I tried to put "db.Country" in front of the lookup table field names in 
 the "represent" clause, but the syntax is wrong.  Now that you can see the 
 lookup table, could you please write out the complete syntax?

 db.define_table('Country', ## Lookup table
 Field('countryName','string'), 
 Field('countryCode','string'),
 Field('countryTelephoneCode','integer'))
 ## 
 --
 db.define_table('PhoneNumber',
 Field('countryTelephoneCode','reference Country'), 
 Field('telephoneNumber','integer'))
 ## ^^^
 db.PhoneNumber.countryTelephoneCode.represent = lambda v, r: 
 '%(db.Country.countryTelephoneCode)s 
 %(db.Country.countryName)s' % r

 Thanks,

 Alex


 On Wednesday, April 24, 2013 5:00:00 AM UTC-7, Anthony wrote:
>
> db.PartyPhoneNumberIntersection.countryTelephoneCode.represent = \
> lambda v, r: '%(countryTelephoneCode)s %(countryName)s' % r
>
> Anthony
>
> On Wednesday, April 24, 2013 4:08:25 AM UTC-4, Alex Glaros wrote:
>>
>> Is there a way to concatenate fields in the represent function in the 
>> same way that countryTelephoneCode and countryName are in the "requires" 
>> validator below?
>>
>> db.PartyPhoneNumberIntersection.countryTelephoneCode.requires =IS_IN_DB
>> (db, db.Country.countryTelephoneCode, '%(countryTelephoneCode)s %(
>> countryName)s',zero=T('choose one'))
>>
>> thanks,
>>
>> Alex Glaros
>>
>

-- 

--- 
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] pyfpdf_from_html doesn't work (leaves html)?

2013-04-24 Thread Jurgis Pralgauskis
Hi 


the code from pypdf wiki examples works  
http://code.google.com/p/pyfpdf/wiki/Web2Py
(downloaded via http://pyfpdf.googlecode.com/files/web2py.app.fpdf.w2p )

pdf=MyFPDF()
pdf.add_page()
pdf.write_html(str(XML(table, sanitize=False)))
response.headers['Content-Type']='application/pdf'
return pdf.output(dest='S')


but pyfpdf_from_html(...) gives just html code (with .pdf extension) -- no 
conversion to pdf?? - why could it be...
https://github.com/globaleaks/web2py/blob/master/gluon/contrib/generics.py#L56

pdf=MyFPDF()
pdf.add_page()
html = sanitize(html, escape=False)   should have better list of 
allowed tags
pdf.write_html(html,image_map=image_map)
return XML(pdf.output(dest='S'))


I don't see where it defines 
response.headers['Content-Type']='application/pdf'

and I suspect theres no need to return as XML(..)?
return XML(pdf.output(dest='S'))


tested on pythonanywhere  and localy...
ps.: in generic.pdf  I set explicitly pyfpdf_from_html  instead 
of pdf_from_html

-- 

--- 
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 chat example

2013-04-24 Thread Arnon Marcus
Well, as for the whole confusion-thing, next time you should write 
"inspired by" instead of "based on" to disambiguate your meaning.

As for threading/non-blocking, it appears that this is a very large subject.
Non-blocking IO is a holy-grail of IO-bound applications such as 
web-servers.
However it is not always achievable for all I/O operations on all OS's.
For example, you CAM use non-blocking sockets, and basically poll them, but 
there are other I/O operations that are more problematic, such as 
the infamous "getaddrinfo()":
http://stackoverflow.com/questions/6998309/is-there-a-non-blocking-method-for-host-resolution-in-winapi
 

Here is what Tornado has to offer on that regard:
http://www.tornadoweb.org/en/stable/netutil.html?highlight=thread#tornado.netutil.Resolver

You'll notice there is no single-threaded-non-blocking option there, but 
there IS a non-blocking-threaded one:
http://www.tornadoweb.org/en/stable/netutil.html?highlight=thread#tornado.netutil.ThreadedResolver

As for inter-thread communication, here is another snippet:
http://www.tornadoweb.org/en/stable/ioloop.html?highlight=thread

Tornado today has many different approaches and target-usages, so it's not 
a one-size-fits-all - each has it's own trade-offs. For example, you can do 
sub-processing:
http://www.tornadoweb.org/en/stable/process.html?highlight=process#tornado.process.Subprocess

But even gevent can't handle some cases, especially in windows - even with 
the help of gipc:
http://gehrcke.de/gipc/#technotes

I still think that for the most-part, gevent can handle more cases better, 
because it relies on a c-extension to circumvent locking issues in ways 
that pure python (hence tornado's i/o-loop) can not.

So although Tornado is being presented as a "single-threaded-non-blocking" 
web-server, it is still limited in it's extent of non-blocking-I/O in some 
regards, and features some non-single-process/thread workarounds.
So the whole "asynch" story is really irrelevant - it's not the issue of 
merely substituting threads with co-routines - that by itself does not give 
you non-blocking capabilities - it is the issue of "how do you make 
co-routines that can replace threads/processes while still being 
non-blocking".

-- 

--- 
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: twitter error using recipe from admin page

2013-04-24 Thread 黄祥
it seems the twitter code from admin page is limited for certain days or 
weeks. the other things is it didn't support link for example 
http://whateverurl.com
did anyone know how to fix it?
thank you so much

-- 

--- 
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 x java

2013-04-24 Thread 黄祥
On Thursday, April 25, 2013 1:12:13 AM UTC+7, Marco Tulio wrote:

> thanks for taking your time to give your point of view... 
>
no worries, bud, that's what community are for.
 

> couldn't read your name though.. are those characters chinese? Could be 
> japanese, but since japanese kanji are based on chinese, it would be a fair 
> mistake by an outsider.. :)
>
yes, that's my name in chinese, japanese also use that character too with 
the difference pronounciation from chinese.

best regards

stifan kristi

>

-- 

--- 
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] REF: File Upload does not work on a component loaded using ajax....

2013-04-24 Thread Teddy Nyambe
I have experimented with this and i think there is something wrong...

*Controllers*:

def index():
 return locals()
def post():
form = SQLFORM(db.pics, upload=URL('download'))
if form.process().accepted:
response.flash = 'Data saved'
elif form.process().accepted:
response.flash = 'Error with form'
return dict(form=form)
def download():
return response.download(request, db)

Views:

View-
   -albums
 + index.html

{{extend 'layout.html'}}

{{=A('Upload Picture', component=URL('album','post.load'),
target='photo-space', _class='btn')}}


+ post.load

{{=form}}

The funny thing is when if i access the post normally and not as a
component the file is being uploaded and but as a component as shown in the
code above, the image is not being uploaded and the database field for
image is empty but the name of the picture is added.

Any thought on this or its by design that its not working!?


-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

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




Re: [web2py] Re: REF: Generated SQLFORM form behavior sought

2013-04-24 Thread Johann Spies
What about using the keepvalues option:

>From the book:

form.accepts(vars, session=None, formname='default',
 keepvalues=False, onvalidation=None,
 dbio=True, hideerror=False):

Change keepvalues to True

Regards
Johann


On 24 April 2013 18:23, Niphlod  wrote:

> I think you need to be more clear...either you want to:
> - add a new record --> if you want to "preload" default values you just
> have to set them beforehand
> - edit an existing record --> it's obvious that what you edit (and submit)
> has the same value of the next attempt to edit the same record
>
>
> On Wednesday, April 24, 2013 6:00:11 PM UTC+2, software.ted wrote:
>
>> yah that exactly, but when you add a new record, the saved record does
>> not show in the form. I want the fields to remain with saved content. Even
>> when i use the example u have givenbut when i click on a button with an
>> id with an existing record in the db it shows without any problem...when i
>> make changes the record remains in the fields.
>>
>>
>> On Wed, Apr 24, 2013 at 5:51 PM, Niphlod  wrote:
>>
>>> you mean an edit form ?
>>> record = db.table(1)
>>> form = SQLFORM(db.table, record)
>>>
>>>
>>>
>>> On Wednesday, April 24, 2013 5:35:18 PM UTC+2, software.ted wrote:

 Is there a way to make the form generated by SQLFORM return the current
 fields saved in the DB instead of making the fields blank? What i want is
 to return the record.

 --
 ....
 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he
 is all - Thomas Carlyle 1795-1881

 /~

>>>  --
>>>
>>> ---
>>> 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
>>> .
>>>
>>>
>>>
>>
>>
>>
>> --
>> ..**..**
>> ...
>> Teddy Lubasi Nyambe
>> Opensource Zambia
>> Lusaka, ZAMBIA
>>
>> Cell: +260 97 7760473
>> website: http://www.opensource.org.zm
>>
>> ~/
>> Human Knowledge belongs to the world! - AntiTrust
>>
>> Man is a tool-using animal. Without tools he is nothing, with tools he is
>> all - Thomas Carlyle 1795-1881
>>
>> /~
>>
>  --
>
> ---
> 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.
>
>
>



-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)

-- 

--- 
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] SQL Server Connection String Please HELP

2013-04-24 Thread Marian
I had big problems with the connection to a mssql server.


My working connection string is this:

mssql://DRIVER={SQL Server};SERVER=HOST\DATABASE,PORT;UID=USER;PWD=PASSWORD


On Wednesday, April 24, 2013 11:16:58 PM UTC+2, Tim Richardson wrote:
>
>
>
>>  
>>> b = SQLDB('mssql://username:password@localhost:portnumber/databaseNAME')
>>>  
>>> Can someone give me a some examples or link to any information where I 
>>> can see how a simple program connects to a SQL SERVER DB and selects a few 
>>> records from a table and displays them...
>>>  
>>> I have been researching to find examples, but I have not found anything 
>>> specific to my problem,
>>>  
>>>
>>>  
>>>
>>
> this is how I access a local server. The machine is server-win2003.
>
> db = DAL('mssql://*user*:*pass*@server-win2003\hcnsql07/vcidat') 
>
> In this case, the SQL Server has an instance name of hcnsql07
> and the database is vcidat
> Probably that part of the connection string is the trickiest (the server 
> name and instance). I use Microsoft SQL Server Management Studio to connect 
> to the database to prove to myself that  I know exactly the name of the 
> server. In case you didn't know, there are free "Express" editions of 
> Management Studio for download.
>

-- 

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