Changes

→‎Code Examples: space in column1 before <nowiki> example
Line 151: Line 151:  
   }
 
   }
   −
Coding format may be embedded in a line of regular text with the <nowiki><code></nowiki><code>code text</code><nowiki></code></nowiki> wiki syntax.
+
* Coding format may be embedded in a line of regular text with the <nowiki><code></nowiki><code>code text</code><nowiki></code></nowiki> wiki syntax.
 +
 
 +
* Blocks of pre-existing code (often with structured linebreaks) may be preserved by entering a space before <code>&nbsp;<nowiki><nowiki></nowiki></code> in the first wiki page column as in this example:
 +
<nowiki><nowiki>class DatastoreResultSet(BaseResultSet):
 +
    """Encapsulates the result of a query on the datastore
 +
    """
 +
    def __init__(self, query, page_size):
 +
 
 +
        if query.get('query', '') and not query['query'].startswith('"'):
 +
            query_text = ''
 +
            words = query['query'].split(' ')
 +
            for word in words:
 +
                if word:
 +
                    if query_text:
 +
                        query_text += ' '
 +
                    query_text += word + '*'
 +
 
 +
            query['query'] = query_text
 +
 
 +
        BaseResultSet.__init__(self, query, page_size)
 +
 
 +
    def find(self, query):
 +
        entries, total_count = _get_datastore().find(query, PROPERTIES,
 +
                                                    byte_arrays=True)
 +
 
 +
        for entry in entries:
 +
            entry['mountpoint'] = '/'
 +
 
 +
        return entries, total_count</nowiki></nowiki>
 +
The result looks like the following:
 +
<nowiki>class DatastoreResultSet(BaseResultSet):
 +
    """Encapsulates the result of a query on the datastore
 +
    """
 +
    def __init__(self, query, page_size):
 +
 
 +
        if query.get('query', '') and not query['query'].startswith('"'):
 +
            query_text = ''
 +
            words = query['query'].split(' ')
 +
            for word in words:
 +
                if word:
 +
                    if query_text:
 +
                        query_text += ' '
 +
                    query_text += word + '*'
 +
 
 +
            query['query'] = query_text
 +
 
 +
        BaseResultSet.__init__(self, query, page_size)
 +
 
 +
    def find(self, query):
 +
        entries, total_count = _get_datastore().find(query, PROPERTIES,
 +
                                                    byte_arrays=True)
 +
 
 +
        for entry in entries:
 +
            entry['mountpoint'] = '/'
 +
 
 +
        return entries, total_count</nowiki>
    
== Tables ==
 
== Tables ==