コード例 #1
0
 def to_string(self, employee):
     '''Convert each Employee to a list of [name, value] pairs. 
     Note the final converter.to_string() call to ensure that the 
     contents of the returned lists are str-converted'''
     dict_items = employee.as_dict().items
     converter = converter_for(list)
     return converter.to_string([[key, value] \
                                 for key, value in dict_items()])
コード例 #2
0
ファイル: query_table.py プロジェクト: ilboud/waferslim
 def to_string(self, employee):
     '''Convert each Employee to a list of [name, value] pairs. 
     Note the final converter.to_string() call to ensure that the 
     contents of the returned lists are str-converted'''
     dict_items = employee.as_dict().items
     converter = converter_for(list)
     return converter.to_string([[key, value] \
                                 for key, value in dict_items()])
コード例 #3
0
    def query(self):
        
	s3 = boto.connect_s3()
	b = s3.get_bucket(self.bucket)

	res = [[['Path',x.key]] for x in b.list(self.prefix)]

        converter = converter_for(list)
	return converter.to_string(res)
コード例 #4
0
    def query(self):

        s3 = boto.connect_s3()

        bs = s3.get_all_buckets()
        res = [[['Name',x.name]] for x in bs]

        converter = converter_for(list)
        return converter.to_string(res)
コード例 #5
0
ファイル: converter_spec.py プロジェクト: cinegemadar/host
def converters_are_thread_local():
    ''' Registered converters should be thread-local: a converter registered
    in one thread should be isolated from those registered in other threads'''
    def yes_no():
        ''' method to register a converter in a separate thread '''
        register_converter(bool, YesNoConverter())
        other_converter = converter_for(bool)
        lancelot.Spec(other_converter).it().should_be(Type(YesNoConverter))

    yes_no_thread = threading.Thread(target=yes_no)
    yes_no_thread.start()
    yes_no_thread.join()
    lancelot.Spec(converter_for(bool)).it().should_be(Type(TrueFalseConverter))
コード例 #6
0
ファイル: converter_spec.py プロジェクト: cinegemadar/host
 def yes_no():
     ''' method to register a converter in a separate thread '''
     register_converter(bool, YesNoConverter())
     other_converter = converter_for(bool)
     lancelot.Spec(other_converter).it().should_be(Type(YesNoConverter))
コード例 #7
0
 def to_string(self, obj):
     dict_items = obj.as_dict().items
     converter = converter_for(list)
     return converter.to_string([[key, value]
                                 for key, value in dict_items()])