omeroweb.webgateway package

Submodules

omeroweb.webgateway.admin module

omeroweb.webgateway.marshal module

omeroweb.webgateway.middleware module

class omeroweb.webgateway.middleware.GZipMiddleware

Bases: object

This middleware compresses content if the browser allows gzip compression. It sets the Vary header accordingly, so that caches will base their storage on the Accept-Encoding header.

process_response(request, response)

omeroweb.webgateway.models module

omeroweb.webgateway.plategrid module

Module to encapsulate operations concerned with displaying the contents of a plate as a grid.

class omeroweb.webgateway.plategrid.PlateGrid(conn, pid, fid, thumbprefix='')

Bases: object

A PlateGrid object encapsulates a PlateI reference and provides a number of methods useful for displaying the contents of the plate as a grid.

metadata

omeroweb.webgateway.urls module

omeroweb.webgateway.urls.annotations = <RegexURLPattern webgateway_annotations ^annotations/(?P<objtype>[\w.]+)/(?P<objid>\d+)/$>

Retrieve annotations for object specified by object type and identifier, optionally traversing object model graph.

omeroweb.webgateway.urls.archived_files = <RegexURLPattern archived_files ^archived_files/download/(?:(?P<iid>[0-9]+)/)?$>

This url will download the Original Image File(s) archived at import time. If it’s a single file, this will be downloaded directly. For multiple files, they are assembled into a zip file on the fly, and this is downloaded.

omeroweb.webgateway.urls.copy_image_rdef_json = ('^copyImgRDef/$', 'webgateway.views.copy_image_rdef_json')

Copy the rendering settings from one image to a list of images, specified in request by ‘fromid’ and list of ‘toids’. See L{views.copy_image_rdef_json}

omeroweb.webgateway.urls.datasetDetail_json = ('^dataset/(?P<did>[0-9]+)/detail/$', 'webgateway.views.datasetDetail_json')

json method: returns details of specified Dataset. See L{views.datasetDetail_json}. Returns E.g {“description”: “”, “type”: “Dataset”, “id”: 901, “name”: “example”}

  • webgateway/dataset/<did>/detail params are:
  • did: Dataset ID
omeroweb.webgateway.urls.full_viewer = <RegexURLPattern webgateway_full_viewer ^img_detail/(?P<iid>[0-9]+)/$>

Returns html page displaying full image viewer and image details, rendering settings etc. See L{views.full_viewer}.

  • webgateway/img_detail/<iid>/ params are:
  • iid: Image ID.
omeroweb.webgateway.urls.get_image_rdef_json = ('^getImgRDef/$', 'webgateway.views.get_image_rdef_json')

Gets rendering definition from the ‘session’ if saved. Returns json dict of ‘c’, ‘m’, ‘z’, ‘t’.

omeroweb.webgateway.urls.get_image_rdefs_json = <RegexURLPattern webgateway_get_image_rdefs_json ^get_image_rdefs_json/(?P<img_id>[0-9]+)/$>

This url will retrieve all rendering definitions for a given image (id)

omeroweb.webgateway.urls.get_rois_json = <RegexURLPattern webgateway_get_rois_json ^get_rois_json/(?P<imageId>[0-9]+)/$>

gets all the ROIs for an Image as json. Image-ID is request: imageId=123 [{‘id’:123, ‘shapes’:[{‘type’:’Rectangle’, ‘theZ’:5, ‘theT’:0, ‘x’:250,

‘y’:100, ‘width’:10 ‘height’:45} ]
omeroweb.webgateway.urls.get_shape_json = <RegexURLPattern webgateway_get_shape_json ^get_shape_json/(?P<roiId>[0-9]+)/(?P<shapeId>[0-9]+)/$>

gets a Shape as json. ROI-ID, Shape-ID is request: roiId=123 and shapeId=123 {‘type’:’Rectangle’, ‘theZ’:5, ‘theT’:0, ‘x’:250, ‘y’:100, ‘width’:10, ‘height’:45}

omeroweb.webgateway.urls.histogram_json = <RegexURLPattern histogram_json ^histogram_json/(?P<iid>[0-9]+)/channel/(?P<theC>[0-9]+)/>

Gets a histogram of 256 columns (grey levels) for the chosen channel of an image. A single plane is specified by ?theT=1&theZ=2.

omeroweb.webgateway.urls.imageData_json = ('^imgData/(?P<iid>[0-9]+)/(?:(?P<key>[^/]+)/)?$', 'webgateway.views.imageData_json')

json method: returns details of specified Image. See L{views.imageData_json}. Returns E.g {“description”: “”, “type”: “Dataset”, “id”: 901, “name”: “example”}

  • webgateway/imgData/<iid>/<key> params are:

  • did: Dataset ID

  • key: Optional key of selected attributes to return. E.g. meta,

    pixel_range, rdefs, split_channel, size etc

omeroweb.webgateway.urls.listDatasets_json = ('^proj/(?P<pid>[0-9]+)/children/$', 'webgateway.views.listDatasets_json')

json method: returns list of Datasets belonging to specified Project. See L{views.listDatasets_json}. Returns E.g list of {“child_count”: 4, “description”: “”, “type”: “Dataset”, “id”: 901,

“name”: “example”}
  • webgateway/proj/<pid>/children params are:
  • pid: Project ID
omeroweb.webgateway.urls.listLuts_json = ('^luts/$', 'webgateway.views.listLuts_json')

json method: returning list of all lookup tables available for rendering engine. E.g. list of {path: “/luts/”, size: 800, id: 37, name: “cool.lut”},

omeroweb.webgateway.urls.listProjects_json = ('^proj/list/$', 'webgateway.views.listProjects_json')

json method: returning list of all projects available to current user. See L{views.listProjects_json} . List of E.g. {“description”: “”, “id”: 651, “name”: “spim”}

omeroweb.webgateway.urls.list_compatible_imgs_json = ('^compatImgRDef/(?P<iid>[0-9]+)/$', 'webgateway.views.list_compatible_imgs_json')

json method: returns list of IDs for images that have channels compatible with the specified image, such that rendering settings can be copied from the image to those returned. Images are selected from the same project that the specified image is in.

  • webgateway/compatImgRDef/<iid>/ params are:
  • iid: Image ID.
omeroweb.webgateway.urls.object_table_query = <RegexURLPattern webgateway_object_table_query ^table/(?P<objtype>[\w.]+)/(?P<objid>\d+)/query/$>

Query bulk annotations table attached to an object specified by object type and identifier, optionally traversing object model graph.

omeroweb.webgateway.urls.open_with_options = <RegexURLPattern open_with_options ^open_with/$>

This makes the settings.OPEN_WITH configuration available via json

omeroweb.webgateway.urls.original_file_paths = <RegexURLPattern original_file_paths ^original_file_paths/(?P<iid>[0-9]+)/$>

Get a json dict of original file paths. ‘repo’ is a list of path/name strings for original files in managed repo ‘client’ is a list of paths for original files on the client when imported

omeroweb.webgateway.urls.projectDetail_json = ('^proj/(?P<pid>[0-9]+)/detail/$', 'webgateway.views.projectDetail_json')

json method: returns details of specified Project. See L{views.projectDetail_json}. Returns E.g {“description”: “”, “type”: “Project”, “id”: 651, “name”: “spim”}

  • webgateway/proj/<pid>/detail params are:
  • pid: Project ID
omeroweb.webgateway.urls.render_birds_eye_view = ('^render_birds_eye_view/(?P<iid>[0-9]+)/(?:(?P<size>[0-9]+)/)?$', 'webgateway.views.render_birds_eye_view')

Returns a bird’s eye view JPEG of the OMERO Image. See L{views.render_birds_eye_view}. Uses current rendering settings. Params in render_birds_eye_view/<iid>/ are:

  • iid: Image ID

  • size: Maximum size of the longest side of the resulting bird’s eye

    view.

omeroweb.webgateway.urls.render_col_plot = ('^render_col_plot/(?P<iid>[0-9]+)/(?P<z>[0-9]+)/(?P<t>[0-9]+)/(?P<x>[0-9]+)/(?:(?P<w>[0-9]+)/)?$', 'webgateway.views.render_col_plot')

Returns a gif graph of pixel values for a column of an image plane. See L{views.render_col_plot}. Channels can be turned on/off using request. E.g. c=-1,2,-3,-4 Params in render_col_plot/<iid>/<z>/<t>/<x>/<w> are:

  • iid: Image ID
  • z: Z index
  • t: T index
  • x: X position of pixel column
  • w: Optional line width of plot
omeroweb.webgateway.urls.render_image = ('^render_image/(?P<iid>[0-9]+)/(?:(?P<z>[0-9]+)/)?(?:(?P<t>[0-9]+)/)?$', 'webgateway.views.render_image')

Returns a jpeg of the OMERO image. See L{views.render_image}. Rendering settings can be specified in the request parameters. See L{views.getImgDetailsFromReq} for details. Params in render_image/<iid>/<z>/<t>/ are:

  • iid: Image ID
  • z: Z index
  • t: T index
omeroweb.webgateway.urls.render_image_region = ('^render_image_region/(?P<iid>[0-9]+)/(?P<z>[0-9]+)/(?P<t>[0-9]+)/$', 'webgateway.views.render_image_region')

Returns a jpeg of the OMERO image, rendering only a region specified in query string as region=x,y,width,height. E.g. region=0,512,256,256 See L{views.render_image_region}. Rendering settings can be specified in the request parameters. Params in render_image/<iid>/<z>/<t>/ are:

  • iid: Image ID
  • z: Z index
  • t: T index
omeroweb.webgateway.urls.render_movie = ('^render_movie/(?P<iid>[0-9]+)/(?P<axis>[zt])/(?P<pos>[0-9]+)/$', 'webgateway.views.render_movie')

Generates a movie file from the image, spanning Z or T frames. See L{views.render_movie} Returns the file or redirects to temp file location. Params in render_movie/<iid>/<axis>/<pos> are:

  • iid: Image ID
  • axis: ‘z’ or ‘t’ dimension that movie plays
  • pos: The T index (for ‘z’ movie) or Z index (for ‘t’ movie)
omeroweb.webgateway.urls.render_ome_tiff = ('^render_ome_tiff/(?P<ctx>[^/]+)/(?P<cid>[0-9]+)/$', 'webgateway.views.render_ome_tiff')

Generates an OME-TIFF of an Image (or zip for multiple OME-TIFFs) and returns the file or redirects to a temp file location. See L{views.render_ome_tiff} Params in render_ome_tiff/<ctx>/<cid> are:

  • ctx: The container context. ‘p’ for Project, ‘d’ for Dataset or ‘i’
Image.
  • cid: ID of container.
omeroweb.webgateway.urls.render_roi_thumbnail = ('^render_roi_thumbnail/(?P<roiId>[0-9]+)/?$', 'webgateway.views.render_roi_thumbnail')

Returns a thumbnail jpeg of the OMERO ROI. See L{views.render_roi_thumbnail}. Uses current rendering settings.

omeroweb.webgateway.urls.render_row_plot = ('^render_row_plot/(?P<iid>[0-9]+)/(?P<z>[0-9]+)/(?P<t>[0-9]+)/(?P<y>[0-9]+)/(?:(?P<w>[0-9]+)/)?$', 'webgateway.views.render_row_plot')

Returns a gif graph of pixel values for a row of an image plane. See L{views.render_row_plot}. Channels can be turned on/off using request. E.g. c=-1,2,-3,-4 Params in render_row_plot/<iid>/<z>/<t>/<y>/<w> are:

  • iid: Image ID
  • z: Z index
  • t: T index
  • y: Y position of pixel row
  • w: Optional line width of plot
omeroweb.webgateway.urls.render_shape_mask = ('^render_shape_mask/(?P<shapeId>[0-9]+)/$', 'webgateway.views.render_shape_mask')

Returns a mask for the specified shape

omeroweb.webgateway.urls.render_shape_thumbnail = ('^render_shape_thumbnail/(?P<shapeId>[0-9]+)/?$', 'webgateway.views.render_shape_thumbnail')

Returns a thumbnail jpeg of the OMERO Shape. See L{views.render_shape_thumbnail}. Uses current rendering settings.

omeroweb.webgateway.urls.render_split_channel = ('^render_split_channel/(?P<iid>[0-9]+)/(?P<z>[0-9]+)/(?P<t>[0-9]+)/$', 'webgateway.views.render_split_channel')

Returns a jpeg of OMERO Image with channels split into different panes in a grid. See L{views.render_split_channel}. Rendering settings can be specified in the request parameters (as above). Params in render_split_channel/<iid>/<z>/<t> are:

  • iid: Image ID
  • z: Z index
  • t: T index
omeroweb.webgateway.urls.render_thumbnail = <RegexURLPattern None ^render_thumbnail/(?P<iid>[0-9]+)/(?:(?P<w>[0-9]+)/)?(?:(?P<h>[0-9]+)/)?$>

Returns a thumbnail jpeg of the OMERO Image, optionally scaled to max-width and max-height. See L{views.render_thumbnail}. Uses current rendering settings. Query string can be used to specify Z or T section. E.g. ?z=10. Params in render_thumbnail/<iid>/<w>/<h> are:

  • iid: Image ID
  • w: Optional max width
  • h: Optional max height
omeroweb.webgateway.urls.reset_owners_rdef_json = <RegexURLPattern reset_owners_rdef_json ^applyOwnersRDef/$>

Apply the owner’s rendering settings to the specified objects. Objects defined in request by E.g. totype=dataset&toids=1&toids=2

omeroweb.webgateway.urls.reset_rdef_json = <RegexURLPattern reset_rdef_json ^resetRDef/$>

Reset the images within specified objects to their rendering settings at import time” Objects defined in request by E.g. totype=dataset&toids=1&toids=2

omeroweb.webgateway.urls.save_image_rdef_json = ('^saveImgRDef/(?P<iid>[0-9]+)/$', 'webgateway.views.save_image_rdef_json')

Saves rendering definition (from request parameters) on the image. See L{views.save_image_rdef_json}. For rendering parameters, see L{views.getImgDetailsFromReq} for details. Returns ‘true’ if worked OK.

  • webgateway/saveImgRDef/<iid>/ params are:
  • iid: Image ID.
omeroweb.webgateway.urls.table_query = <RegexURLPattern webgateway_table_query ^table/(?P<fileid>\d+)/query/$>

Query a table specified by fileid

omeroweb.webgateway.urls.webgateway = <RegexURLPattern webgateway ^$>

Returns a main prefix

omeroweb.webgateway.urls.webgateway_get_thumbnail_json = <RegexURLPattern None ^get_thumbnail/(?P<iid>[0-9]+)/(?:(?P<w>[0-9]+)/)?(?:(?P<h>[0-9]+)/)?$>

Returns a thumbnail base64 encoded of the OMERO Images, optionally scaled to max-width and max-height. See L{views.render_thumbnail}. Uses current rendering settings. Query string can be used to specify Z or T section. E.g. ?z=10. Params in render_thumbnail/<iid>/<w>/<h> are:

  • iid: Image ID
  • w: Optional max width
  • h: Optional max height
omeroweb.webgateway.urls.webgateway_get_thumbnails_json = <RegexURLPattern None ^get_thumbnails/(?:(?P<w>[0-9]+)/)?$>

Returns a set of thumbnail base64 encoded of the OMERO Images, optionally scaled to max-longest-side. Image ids are specified in query string as list, e.g. id=1&id=2.

omeroweb.webgateway.urls.webgateway_listimages_json = <RegexURLPattern webgateway_listimages_json ^dataset/(?P<did>[0-9]+)/children/$>

json method: returns list of Images belonging to specified Dataset. See L{views.listImages_json}. Returns E.g list of {“description”: “”, “author”: “Will Moore”, “date”: 1291325060.0,

“thumb_url”: “/webgateway/render_thumbnail/4701/”, “type”: “Image”, “id”: 4701, “name”: “spim.png”}

  • webgateway/dataset/<did>/children params are: - did: Dataset ID

  • request variables: - thumbUrlPrefix: view key whose reverse url is to be used as prefix for

    thumb_url instead of default webgateway.views.render_thumbnail

    • tiled: if set with anything other than an empty string will add

      information on whether each image is tiled on this server

omeroweb.webgateway.urls.webgateway_listwellimages_json = <RegexURLPattern webgateway_listwellimages_json ^well/(?P<did>[0-9]+)/children/$>

json method: returns list of Images belonging to specified Well. See L{views.listWellImages_json}. Returns E.g list of {“description”: “”, “author”: “Will Moore”, “date”: 1291325060.0,

“thumb_url”: “/webgateway/render_thumbnail/4701/”, “type”: “Image”, “id”: 4701, “name”: “spim.png”}

  • webgateway/well/<did>/children params are:
  • did: Well ID
omeroweb.webgateway.urls.webgateway_search_json = <RegexURLPattern webgateway_search_json ^search/$>

json method: returns search results. All parameters in request. See L{views.search_json}

omeroweb.webgateway.urls.webgateway_su = <RegexURLPattern webgateway_su ^su/(?P<user>[^/]+)/$>

Admin method to switch to the specified user, identified by username: <user> Returns ‘true’ if switch went OK.

omeroweb.webgateway.urls.wellData_json = <RegexURLPattern webgateway_wellData_json ^wellData/(?P<wid>[0-9]+)/$>
json method: returns details of specified Well. See L{views.wellData_json}.
  • webgateway/wellData/<wid>/ params are:
  • wid: Well ID

omeroweb.webgateway.util module

omeroweb.webgateway.util.getIntOrDefault(request, name, default)
omeroweb.webgateway.util.get_longs(request, name)

Retrieves parameters from the request. If the parameters are not present an empty list is returned

This does not catch exceptions as it makes sense to throw exceptions if the arguments provided do not pass basic type validation

omeroweb.webgateway.util.zip_archived_files(images, temp, zipName, buf=2621440)

Util function to download original files from a list of images and arrange them within a temp file, such that there are no name clashes and multi-image filesets are kept distict. Handles archived files from OMERO 4 images and fileset files for OMERO 5 images.

@param images: Images as source of original files. @type List of ImageWrappers @param temp: Directory for creating Zip file @param zipName: Name of zip

omeroweb.webgateway.views module

omeroweb.webgateway.webgateway_cache module

class omeroweb.webgateway.webgateway_cache.AutoLockFile(fn, mode)

Bases: file

Class extends file to facilitate creation and deletion of lock file.

close()

tries to delete the lock file and close the file

class omeroweb.webgateway.webgateway_cache.CacheBase

Bases: object

Caching base class - extended by L{FileCache} for file-based caching. Methods of this base class return None or False providing a no-caching implementation if needed

delete(k)
get(k)
set(k, v, t=0, invalidateGroup=None)
wipe()
class omeroweb.webgateway.webgateway_cache.FileCache(dir, timeout=60, max_entries=0, max_size=0)

Bases: omeroweb.webgateway.webgateway_cache.CacheBase

Implements file-based caching within the directory specified in constructor.

_check_entry(fname)

Verifies if a specific cache entry (provided as absolute file path) is expired. If expired, it gets deleted and method returns false. If not expired, returns True.

If fname is a file object, fpos will advance size_of_double bytes.

@param fname: File path or file object @rtype Boolean @return True if entry is valid, False if expired

_createdir()

Creates a directory for the root dir of the cache.

_delete(fname)

Tries to delete the data at the specified absolute file path

@param fname: File name of data to delete

_du()

Disk Usage count on the filesystem the cache is based at

@rtype: int @return: the current usage, in KB

_full(_on_retry=False)

Checks whether the cache is full, either because we have exceeded max number of entries or the cache space is full.

@param _on_retry: Flag allows calling this method again after
purge() without recursion

@return: True if cache is full @rtype: Boolean

_get_num_entries()

Returns the number of files in the cache @rtype: int

_key_to_file(key)

Uses the key to construct an absolute path to the cache data. @param key: Cache key @return: Path @rtype: String

_num_entries

Returns the number of files in the cache @rtype: int

_purge()

Iterate the whole cache structure searching and cleaning expired entries. this method may be expensive, so only call it when really necessary.

_purge_holdoff = 4
add(key, value, timeout=None, invalidateGroup=None)

Adds data to cache, returning False if already cached. Otherwise delegating to L{set}

@param key: Unique key for cache @param value: Value to cache - must be String @param timeout: Optional timeout - otherwise use default @param invalidateGroup: Not used?

delete(key)

Attempt to delete the cache data referenced by key @param key: Cache key

get(key, default=None)

Gets data from cache

@param key: cache key @param default: default value to return @return: cache data or default if timout has passed

has_key(key)

Returns true if the cache has the specified key @param key: Key to look for. @rtype: Boolean

set(key, value, timeout=None, invalidateGroup=None)

Adds data to cache, overwriting if already cached.

@param key: Unique key for cache @param value: Value to cache - must be String @param timeout: Optional timeout - otherwise use default @param invalidateGroup: Not used?

wipe()

Deletes everything in the cache

class omeroweb.webgateway.webgateway_cache.WebGatewayCache(backend=None, basedir=None)

Bases: object

Caching class for webgateway.

_cache_clear(cache, key)

Calls cache.delete(key)

_cache_set(cache, key, obj)

Calls cache.set(key, obj)

_imageKey(r, client_base, img, z=0, t=0)

Returns a key for caching the Image, based on parameters above, including rendering settings specified in the http request.

@param r: http request - get rendering params ‘c’, ‘m’,
‘p’

@param client_base: server_id for cache key @param img: L{omero.gateway.ImageWrapper} for ID @param obj: Data to cache @param size: Size used for cache key. Tuple

_jsonKey(r, client_base, obj, ctx='')

Creates a cache key for storing json data based on params above.

@param r: http request - not used @param client_base: server_id @param obj: ObjectWrapper @param ctx: Additional string for cache key @return: Cache key @rtype: String

_thumbKey(r, client_base, user_id, iid, size)

Generates a string key for caching the thumbnail, based on the above parameters

@param r: not used @param client_base: server-id, forms stem of the key @param user_id: OMERO user ID to partition caching upon @param iid: image ID @param size: size of the thumbnail - tuple. E.g. (100,)

_updateCacheSettings(cache, timeout=None, max_entries=None, max_size=None)

Updates the timeout, max_entries and max_size (if specified) for the given cache

@param cache: Cache or caches to update. @type cache: L{CacheBase} or list of caches

clear()

Clears all the caches.

clearDatasetContents(r, client_base, ds)

Clears data from the json cache using ‘contents’ as context

@param r: http request - not used @param client_base: server_id for cache key @param ds: ObjectWrapper for cache key @rtype: True

clearImage(r, client_base, user_id, img, skipJson=False)

Clears image data from cache using default rendering settings (r=None) T and Z indexes ( = 0). TODO: Doesn’t clear any data stored WITH r, t, or z specified in cache key? Also clears thumbnail (but not thumbs with size specified) and json data for this image.

@param r: http request for cache key @param client_base: server_id for cache key @param user_id: OMERO user ID to partition caching upon @param img: ImageWrapper for cache key @param obj: Data to cache @param rtype: True

clearJson(client_base, obj, ctx='')

TODO: document WAS: Only handles Dataset obj, calling L{clearDatasetContents}

clearThumb(r, client_base, user_id, iid, size=None)

Clears thumbnail from cache.

@param r: for cache key - Not used? @param client_base: server_id for cache key @param user_id: OMERO user ID to partition caching upon @param iid: image ID for cache key @param size: Size used for cache key. Tuple @return: True

eventListener(client_base, events)

handle events coming our way from blitz.onEventLogs.

Because all processes will be listening to the same events, we use a simple file lock mechanism to make sure the first process to get the event will be the one handling things from then on.

@param client_base: TODO: docs! @param events:

getDatasetContents(r, client_base, ds)

Gets data from the json cache using ‘contents’ as context

@param r: http request - not used @param client_base: server_id for cache key @param ds: ObjectWrapper for cache key @rtype: String or None

getImage(r, client_base, img, z, t, ctx='')

Gets image data from cache.

@param r: http request for cache key @param client_base: server_id for cache key @param img: ImageWrapper for cache key @param z: Z index for cache key @param t: T index for cache key @param ctx: Additional string for cache key @return: Image data @rtype: String

getJson(r, client_base, obj, ctx='')

Gets data from the json cache

@param r: http request - not used @param client_base: server_id for cache key @param obj: ObjectWrapper for cache key @param ctx: context string used for cache key @rtype: String or None

getOmeTiffImage(r, client_base, img)

Calls L{getImage} with ‘-ometiff’ context @rtype: String

getSplitChannelImage(r, client_base, img, z, t)

Calls L{getImage} with ‘-sc’ context @rtype: String

getThumb(r, client_base, user_id, iid, size=())

Gets thumbnail from cache.

@param r: for cache key - Not used? @param client_base: server_id for cache key @param user_id: OMERO user ID to partition caching upon @param iid: image ID for cache key @param size: Size used for cache key. Tuple @return: Cached data or None @rtype: String

handleEvent(client_base, e)

Handle one event from blitz.onEventLogs.

Meant to be overridden, this implementation just logs.

@param client_base: TODO: docs! @param e:

invalidateObject(client_base, user_id, obj)

Invalidates all caches for this particular object

@param client_base: The server_id @param user_id: OMERO user ID to partition caching upon @param obj: The object wrapper. E.g.

L{omero.gateway.ImageWrapper}
setDatasetContents(r, client_base, ds, data)

Adds data to the json cache using ‘contents’ as context

@param r: http request - not used @param client_base: server_id for cache key @param ds: ObjectWrapper for cache key @param data: Data to cache @rtype: True

setImage(r, client_base, img, z, t, obj, ctx='')

Puts image data into cache.

@param r: http request for cache key @param client_base: server_id for cache key @param img: ImageWrapper for cache key @param z: Z index for cache key @param t: T index for cache key @param obj: Data to cache @param ctx: Additional string for cache key

setJson(r, client_base, obj, data, ctx='')

Adds data to the json cache

@param r: http request - not used @param client_base: server_id for cache key @param obj: ObjectWrapper for cache key @param data: Data to cache @param ctx: context string used for cache key @rtype: True

setOmeTiffImage(r, client_base, img, obj)

Calls L{setImage} with ‘-ometiff’ context

setSplitChannelImage(r, client_base, img, z, t, obj)

Calls L{setImage} with ‘-sc’ context

setThumb(r, client_base, user_id, iid, obj, size=())

Puts thumbnail into cache.

@param r: for cache key - Not used? @param client_base: server_id for cache key @param user_id: OMERO user ID to partition caching upon @param iid: image ID for cache key @param obj: Data to cache @param size: Size used for cache key. Tuple

tryLock()

simple lock mechanisn to avoid multiple processes on the same cache to step on each other’s toes.

@rtype: boolean @return: True if we created a lockfile or already had it. False

otherwise.
class omeroweb.webgateway.webgateway_cache.WebGatewayTempFile(tdir=None)

Bases: object

Class for handling creation of temporary files

_cleanup()

Tries to delete all the temp files that have expired their cache timeout.

_createdir()

Tries to create the directories required for the temp file base dir

abort(fn)
new(name, key=None)

Creates a new directory if needed, see L{newdir} and checks whether this contains a file ‘name’. If not, a file lock is created for this location and returned.

@param name: Name of file we want to create. @param key: The new dir name @return: Tuple of (abs path to new directory, relative path

key/name, L{AutoFileLock} or True if exists)
newdir(key=None)

Creates a new directory using key as the dir name, and adds a timestamp file with its creation time. If key is not specified, use a unique key based on timestamp.

@param key: The new dir name @return: Tuple of (path to new directory, key used)

omeroweb.webgateway.webgateway_cache.random() → x in the interval [0, 1).

Module contents