Code documentation

LimeAPI

class Products.LimeAPI.LimeAPI.LimeAPI(id)

Lime API class. Implements the API Interface

base64decode(s)

Decode string by base64.decodestring

base64encode(s)

Encode string by base64.encodestring

checkREF()

Check referenses for it self.

console(s='')

Output string to stdout

exportData()

-||-

getFile(filename)

read file

getSiteMenus(ob=None)

Get all menus inside Lime that is tagged with LimeMenu

getTemplateIcons(ob=None)

...

getTemplateInfo(template='', REQUEST=None)

Get information about a template

getUniqueID(type=0)

A wrapper class for UUID http://docs.python.org/2/library/uuid.html Gets a uuid id can be used when getting a unique id for js or inserting into database This returns a uuid.uuid1()

getWidgets(ob=None, tojson=False)

Get widgets

get_defaultTemplate(ob=None)

Get the default template package?

get_templates(ob=None, meta_type=None, packageOnly=False, allTemplates=False)

Get a list of templates

guess_encoding(text)

Guess the encoding of a string, its good to know if its utf or latin.

i18nClear()

Clear all keys from the i18nCache, this is usefull when you have added new keys and want them to get displayed directly.

i18nDeploy(REQUEST={})

Prepare internal localization

installModule(module)

Install module

lime_md5Digest(s, salt='', pepper='', dohexdigest=0)

Creates MD5 hash of string s, with 2 optional salts; salt preceding the string, pepper following the string

lime_release()

show the Lime Release number

linkCheck()

TEST, DO NOT USE -||-

loggedin()

Returns the logged in user.

logout()

Logs the user out from system by removing the cookie __ginger_snap

manage_defaultTemplate(REQUEST=None)

Import the default template package

manage_import(REQUEST={})

test import TODO: Fix this as a permanent import method

manage_installModules(REQUEST)

Install modules

map_sqlresult_to_dict_list(sqlresult, names=None)

Same as above, only for resultset, and returns a list of dicts

moveSite()

A function for moving a site from path to path. This will update all the nessesry paths. Will return 1 if this is ok.

resolveOrderIds(REQUEST=None)

When the datamodel is updated to support orderId’s, we must look through the system and figure out all the objects’ actual order number

rot13(s)

Do rot13 ‘encoding’. Shifts chars 13 places right (applying rot13 twice will return the original string)

smart_str(s, encoding='utf-8', strings_only=False, errors='strict')

Returns a bytestring version of ‘s’, encoded as specified in ‘encoding’.

If strings_only is True, don’t convert (some) non-string-like objects.

smart_unicode(obj, *args)

Transforms a string to unicode.

uninstallModule(module)

Install module

validateCatalog()

functions to validate the persistance of zope catalog

validateSQLKeys()

check up all items

why(s='')

Output error message to stdout

LimeObject

LimeObject is the main object inside Lime. Every object inherits from this.

class Products.LimeAPI.LimeObject.LimeObject

Generic object manager

This class provides core behavior for collections of heterogeneous objects.

attr(id='', setter=None, lang='')

Get or set data value

cacheDelete(id, label='')

Remove something for the cache

cacheGet(id, label='', obj=None)

Get something for the cache

cacheSet(id, label='', value='', ttl=0)

Set something for the cache

contentType()

Return the content type for this object

edit(REQUEST)

edit-object

export(obj=None)

Export an object

find(obj)

Find objects inside Lime.

Args:
param count:how many documents we should return
param sql:If you want to search inside the sql or not
param raw:when you search by sql you may want to return the result not the LimeObject’s
You can use
  1. ZCatalog search
  2. Sql search

ZCatalog - default

Here you can search thru the Catalog of the system.

Sql - sql:True

Here you can search thru the Catalog of the system.

first(template='', meta_type='LimePage')

Return the first occurance of an object of the requested template type

flushCache()

” Clear the cache

formatDate(t=0, format='%d.%m.%Y %H:%M', rfc822=0, rfc3339=0, logException=0, localized=None)

See formatDate in LimeAPI

get(sql_id=None, path=None, restricted=1, rawmode=0, overridePublishFlags=0, langVariant=None, langOnly=0)

Get one item based on path or id.

getAccess(ignore=[])

getCustomizedHtml()

P

getExportAsZip(REQUEST=None)

Finalize the export by making the zip-file

getFirst(meta_type=None, rawMode=0, template='')

Get the first item of anything

getMacros(session=None)

– –

getMenuItems(meta_type=None, level=1, path=None, menus=None)

Get the menu items.

getTimeSpan(t=0)

Get time span in text.

get_breadcrumbs(html=True, physical=True)

Return the breadcrumbs for this object

getdata()

STUPID RULEZ

hasWidgets(section, **kwargs)

Return the number of widgets for the section

i18n(txt, lang=None, set=None, delete=False, all=False)

Get data from i18n ,

i18nTable(prefix='', lang=None, exact=False)

Get data from i18n ,

importItem(jobj=None, req=None, id='', dest=None, wrapper=None)

Import one item...

index_html(REQUEST=None)

The default render when opening the document

inline(id='', type='text')

Get or set data value

inx_dateModified()

Return the publish date

inx_publishDate()

Return the publish date

inx_userCreated()

Return the publish date

layoutSection(section='', **kwargs)
list(meta_type=None, template='', reversed=False, path=None, where=None, count=1000, start=0, sort=None, content=None, webuser=False, parent=False, level=0, checkChildren=False)
This function list object that are located under it self or i path is specified under that path.
Args:
meta_type (array): The types you want to return LimePage,LimeFolder. template (str): If we only should return pages with one desired template reversed (bool): If you want the list reversed, useful when sorting by date. path (str): The path you want to start, if no is obmited the system will list all objects under self. where (str): The ability to check with a simple eval check. count (int): How many you want back, default 1000 start (int): Where to start, if you are using pagination sort (str): If you want to sort the result, date, priority, alfa, or a eval check. level (int): If you want to search sub levels. This should not be used on all many levels or root object. This can take some time. checkChildren (bool): A simple check to see if sub-items have children.
Returns:
list. The return code:
[] – No items
[LimeObject,LimeObject] – A list of objects

A really great idea. A way you might use me is

>>> print public_fn_with_googley_docstring(name='foo', state=None)

0

BTW, this always returns 0. NEVER use with MyPublicClass.
log(data=None, key=None)

Log data inside the log table

metadata_for_filelike(filelike, mime=False)

Extract meta data from file

output(s='')

output something to console

param(param='', default=None, encode=True, type=None, separator=', ')

Removes and encodes params form the REQUEST @param type = [js,sql] is to protect and add extra checks.

public(obj=None, content=None, webuser=False)

Check if document is public or not.

publishDate(returnType=0)

If we have a date on, use that otherwice use the last modification date.

Args:
param returnType:
 0 = datetime object, 1 = float (seconds)
recoverObject(id, sql_id, meta_type, title='', langcode=None)

Recover a deleted object - do not insert if the id already exists

references(all=False)

Updates all the references inside Lime

render(REQUEST=None, **kwargs)

Render an item

renderGrid(data=None, template=None, **kwargs)
restoreObject(id)

Recover a deleted object - do not insert if the id already exists

seoDescription()

Get the description

seoKeywords()

Get the keywords of the object

seoTitle()

Get the seoTitle of the object

setAttrib(ob, name, value)
showFile()

Show one file from resources, this can be used to download files from the resources as well by adding ?download=1. This is will get the file from the files/.. directive. http://www.snapper.no/showFile?file=test/file.png

sql(obj)

Performes a sql query

This is a simple example:

site.sql({'sql':'select * from LimeObject'})                        

You can specify connection if you have several sql connections, this is done under parameter connection

They are three ways to get the result back
  1. Raw, no formatting just sql back
  2. Then the system will map the result back to a dict
  3. To a Lime object

The return value are a in raw, the database return object. If you specify zope, you will get the LimeObjects if you specify json you will get the result back in json.

store(dest=None)

Stores the object. This is based on what is in memory.

update(data='')

DEPRECATED

url(relative=True, dontfollow=False, localized=True, ignoreSitePath=False, langcode=None)

get the url of the object.

val(id='', setter=None, lang='', format=None)

Will get an item or set an item.

Args:
param id:the id you want to collect. The same as in the field definition.
param setter:if you want to set the value. to clear a value specify ‘’.
param lang:If you want to collect any different language then the one you are on.
view(REQUEST=None)

View a document revision

LimeForm

class Products.LimeForm.LimeForm.LimeForm

Generic form class

captcha_img(id=None)

return a captcha image

dbobj

alias of LimeFormLogDbObject

err()

Display the error text for the form

executeSuccessScript(REQUEST=None)

Execute the success script (if any)

form_fields()

Return all defined fields

getData(REQUEST=None)
index_html(REQUEST=None)

Render the form html

load(REQUEST=None)

Load a file from the log

render(render=True, **kwargs)

Render the form html

resubmit(REQUEST=None, returnJson=False)

Handle the resubmission of the form

submit(REQUEST=None, returnJson=False)

Handle the form submission

thx()

Display the thx text for the form

view(REQUEST=None)

View a certain form log entry

LimeFile