PK‡|Ô@\ª0oj†j†eulcommon-0.17.0/binfile.html eulcore.binfile – Map binary data to Python objects — EULcommon 0.17.0 documentation

eulcore.binfile – Map binary data to Python objects¶

Map binary data on-disk to read-only Python objects.

This module facilitates exposing stored binary data using common Pythonic idioms. Fields in relocatable binary objects map to Python attributes using a priori knowledge about how the binary structure is organized. This is akin to the standard struct module, but with some slightly different use cases. struct, for instance, offers a more terse syntax, which is handy for certain simple structures. struct is also a bit faster since it’s implemented in C. This module’s more verbose BinaryStructure definitions give it a few advantages over struct, though:

  • This module allows users to define their own field types, where struct field types are basically inextensible.
  • The object-based nature of BinaryStructure makes it easy to add non-structural properties and methods to subclasses, which would require a bit of reimplementing and wrapping from a struct tuple.
  • BinaryStructure instances access fields through named properties instead of indexed tuples. struct tuples are fine for structures a few fields long, but when a packed binary structure grows to dozens of fields, navigating its struct tuple grows perilous.
  • BinaryStructure unpacks fields only when they’re accessed, allowing us to define libraries of structures scores of fields long, understanding that any particular application might access only one or two of them.
  • Fields in a BinaryStructure can overlap eachother, greatly simplifying both C unions and fields with multiple interpretations (integer/string, signed/unsigned).
  • This module makes sparse structures easy. If you’re reverse-engineering a large binary structure and discover a 4-byte integer in the middle of 68 bytes of unidentified mess, this module makes it easy to add an IntegerField at a known structure offset. struct requires you to split your '68x' into a '32xI32x' (or was that a '30xi34x'? Better recount.)
This package exports the following names:
  • BinaryStructure – a base class for binary data structures
  • ByteField – a field that maps fixed-length binary data to Python strings
  • LengthPrependedStringField – a field that maps variable-length binary strings to Python strings
  • IntegerField – a field that maps fixed-length binary data to Python numbers

General Usage¶

Suppose we have an 8-byte file whose binary data consists of the bytes 0, 1, 2, 3, etc.:

>>> with open('numbers.bin') as f:
...     f.read()
...
'\x00\x01\x02\x03\x04\x05\x06\x07'

Suppose further that these contents represent sensible binary data, laid out such that the first two bytes are a literal string value. Except that sometimes, in the binary format we’re parsing, it might sometimes be necessary to interpret those first two bytes not as a literal string, but instead as a number, encoded as a big-endian unsigned integer. Following that is a variable-length string, encoded with the total string length in the third byte.

This structure might be represented as:

from eulcommon.binfile import *
class MyObject(BinaryStructure):
    mybytes = ByteField(0, 2)
    myint = IntegerField(0, 2)
    mystring = LengthPrepededStringField(2)

Client code might then read data from that file:

>>> f = open('numbers.bin')
>>> obj = MyObject(f)
>>> obj.mybytes
'\x00\x01'
>>> obj.myint
1
>>> obj.mystring
'\x03\x04'

It’s not uncommon for such binary structures to be repeated at different points within a file. Consider if we overlay the same structure on the same file, but starting at byte 1 instead of byte 0:

>>> f = open('numbers.bin')
>>> obj = MyObject(f, offset=1)
>>> obj.mybytes
'\x01\x02'
>>> obj.myint
258
>>> obj.mystring
'\x04\x05\x06'

BinaryStructure¶

class eulcommon.binfile.BinaryStructure(fobj=None, mm=None, offset=0)¶

A superclass for binary data structures superimposed over files.

Typical users will create a subclass containing field objects (e.g., ByteField, IntegerField). Each subclass instance is created with a file and with an optional offset into that file. When code accesses fields on the instance, they are calculated from the underlying binary file data.

Instead of a file, it is occasionally appropriate to overlay an mmap structure (from the mmap standard library). This happens most often when one BinaryStructure instance creates another, passing self.mmap to the secondary object’s constructor. In this case, the caller may specify the mm argument instead of an fobj.

Parameters:
  • fobj – a file object or filename to overlay
  • mm – a mmap object to overlay
  • offset – the offset into the file where the structured data begins

Field classes¶

class eulcommon.binfile.ByteField(start, end)¶

A field mapping fixed-length binary data to Python strings.

Parameters:
  • start – The offset into the structure of the beginning of the byte data.
  • end – The offset into the structure of the end of the byte data. This is actually one past the last byte of data, so a four-byte ByteField starting at index 4 would be defined as ByteField(4, 8) and would include bytes 4, 5, 6, and 7 of the binary structure.

Typical users will create a ByteField inside a BinaryStructure subclass definition:

class MyObject(BinaryStructure):
    myfield = ByteField(0, 4) # the first 4 bytes of the file

When you instantiate the subclass and access the field, its value will be the literal bytes at that location in the structure:

>>> o = MyObject('file.bin')
>>> o.myfield
'ABCD'
class eulcommon.binfile.LengthPrependedStringField(offset)¶

A field mapping variable-length binary strings to Python strings.

This field accesses strings encoded with their length in their first byte and string data following that byte.

Parameters:offset – The offset of the single-byte string length.

Typical users will create a LengthPrependedStringField inside a BinaryStructure subclass definition:

class MyObject(BinaryStructure):
    myfield = LengthPrependedStringField(0)

When you instantiate the subclass and access the field, its length will be read from that location in the structure, and its data will be the bytes immediately following it. So with a file whose first bytes are '\x04ABCD':

>>> o = MyObject('file.bin')
>>> o.myfield
'ABCD'
class eulcommon.binfile.IntegerField(start, end)¶

A field mapping fixed-length binary data to Python numbers.

This field accessses arbitrary-length integers encoded as binary data. Currently only big-endian, unsigned integers are supported.

Parameters:
  • start – The offset into the structure of the beginning of the byte data.
  • end – The offset into the structure of the end of the byte data. This is actually one past the last byte of data, so a four-byte IntegerField starting at index 4 would be defined as IntegerField(4, 8) and would include bytes 4, 5, 6, and 7 of the binary structure.

Typical users will create an IntegerField inside a BinaryStructure subclass definition:

class MyObject(BinaryStructure):
    myfield = IntegerField(3, 6) # integer encoded in bytes 3, 4, 5

When you instantiate the subclass and access the field, its value will be big-endian unsigned integer encoded at that location in the structure. So with a file whose bytes 3, 4, and 5 are '\x00\x01\x04':

>>> o = MyObject('file.bin')
>>> o.myfield
260

Project Versions

Table Of Contents

Previous topic

eulcommon.searchutil – Utilities for searching

Next topic

eulcommon.binfile.eudora – Eudora email index files

This Page

PKˆ|Ô@¹¤¹ °-°-!eulcommon-0.17.0/py-modindex.html Python Module Index — EULcommon 0.17.0 documentation

Project Versions

PK‡|Ô@ˆâ1š 6 6eulcommon-0.17.0/index.html EULcommon — EULcommon 0.17.0 documentation

Project Versions

Table Of Contents

Next topic

eulcommon.djangoextras – Extensions and additions to django

This Page

PK‡|Ô@÷á ~PnPn"eulcommon-0.17.0/djangoextras.html eulcommon.djangoextras – Extensions and additions to django — EULcommon 0.17.0 documentation

eulcommon.djangoextras – Extensions and additions to django¶

auth - Customized permission decorators¶

Customized decorators that enhance the default behavior of django.contrib.auth.decorators.permission_required().

The default behavior of django.contrib.auth.decorators.permission_required() for any user does not meet the required permission level is to redirect them to the login page– even if that user is already logged in. For more discussion of this behavior and current status in Django, see: http://code.djangoproject.com/ticket/4617

These decorators work the same way as the Django equivalents, with the added feature that if the user is already logged in and does not have the required permission, they will see 403 page instead of the login page.

The decorators should be used exactly the same as their django equivalents.

The code is based on the django snippet code at http://djangosnippets.org/snippets/254/

static auth.user_passes_test_with_403(test_func, login_url=None)¶

View decorator that checks to see if the user passes the specified test. See django.contrib.auth.decorators.user_passes_test().

Anonymous users will be redirected to login_url, while logged in users that fail the test will be given a 403 error. In the case of a 403, the function will render the 403.html template.

static auth.permission_required_with_403(perm, login_url=None)¶

Decorator for views that checks whether a user has a particular permission enabled, redirecting to the login page or rendering a 403 as necessary.

See django.contrib.auth.decorators.permission_required().

static auth.user_passes_test_with_ajax(test_func, login_url=None, redirect_field_name='next')¶

Decorator for views that checks that the user passes the given test, redirecting to the log-in page if necessary. The test should be a callable that takes the user object and returns True if the user passes.

Returns special response to ajax calls instead of blindly redirecting.

To use with class methods instead of functions, use django.utils.decorators.method_decorator(). See http://docs.djangoproject.com/en/dev/releases/1.2/#user-passes-test-login-required-and-permission-required

Usage is the same as django.contrib.auth.decorators.user_passes_test():

@user_passes_test_with_ajax(lambda u: u.has_perm('polls.can_vote'), login_url='/loginpage/')
def my_view(request):
    ...
static auth.login_required_with_ajax(function=None, redirect_field_name='next')¶

Decorator for views that checks that the user is logged in, redirecting to the log-in page if necessary, but returns a special response for ajax requests. See eulcommon.djangoextras.auth.decorators.user_passes_test_with_ajax().

Example usage:

@login_required_with_ajax()
def my_view(request):
    ...
static auth.permission_required_with_ajax(perm, login_url=None)¶

Decorator for views that checks whether a user has a particular permission enabled, redirecting to the log-in page if necessary, but returns a special response for ajax requests. See eulcore.django.auth.decorators.user_passes_test_with_ajax().

Usage is the same as django.contrib.auth.decorators.permission_required()

@permission_required_with_ajax('polls.can_vote', login_url='/loginpage/')
def my_view(request):
    ...

formfields - Custom form fields & widgets¶

Custom generic form fields for use with Django forms.


class eulcommon.djangoextras.formfields.W3CDateField(max_length=None, min_length=None, *args, **kwargs)¶

W3C date field that uses a W3CDateWidget for presentation and uses a simple regular expression to do basic validation on the input (but does not actually test that it is a valid date).

widget¶

alias of W3CDateWidget

class eulcommon.djangoextras.formfields.W3CDateWidget(attrs=None)¶

Multi-part date widget that generates three text input boxes for year, month, and day. Expects and generates dates in any of these W3C formats, depending on which fields are filled in: YYYY-MM-DD, YYYY-MM, or YYYY.

create_textinput(name, field, value, **extra_attrs)¶

Generate and render a django.forms.widgets.TextInput for a single year, month, or day input.

If size is specified in the extra attributes, it will also be used to set the maximum length of the field.

Parameters:
  • name – base name of the input field
  • field – pattern for this field (used with name to generate input name)
  • value – initial value for the field
  • extra_attrs – any extra widget attributes
Returns:

rendered HTML output for the text input

render(name, value, attrs=None)¶

Render the widget as HTML inputs for display on a form.

Parameters:
  • name – form field base name
  • value – date value
  • attrs
    • unused
Returns:

HTML text with three inputs for year/month/day

value_from_datadict(data, files, name)¶

Generate a single value from multi-part form data. Constructs a W3C date based on values that are set, leaving out day and month if they are not present.

Parameters:
  • data – dictionary of data submitted by the form
  • files
    • unused
  • name – base name of the form field
Returns:

string value

class eulcommon.djangoextras.formfields.DynamicChoiceField(choices=None, widget=None, *args, **kwargs)¶

A django.forms.ChoiceField whose choices are not static, but instead generated dynamically when referenced.

Parameters:choices – callable; this will be called to generate choices each time they are referenced
widget¶

alias of DynamicSelect

class eulcommon.djangoextras.formfields.DynamicSelect(attrs=None, choices=None)¶

A Select widget whose choices are not static, but instead generated dynamically when referenced.

Parameters:choices – callable; this will be called to generate choices each time they are referenced.

http - Content Negotiation for Django views¶

PK‡|Ô@èø:_í@í@ eulcommon-0.17.0/searchutil.html eulcommon.searchutil – Utilities for searching — EULcommon 0.17.0 documentation

eulcommon.searchutil – Utilities for searching¶

This module contains utilities for searching.

eulcommon.searchutil.search_terms(q)¶

Takes a search string and parses it into a list of keywords and phrases.

eulcommon.searchutil.pages_to_show(paginator, page, page_labels={})¶

Generate a dictionary of pages to show around the current page. Show 3 numbers on either side of the specified page, or more if close to end or beginning of available pages.

Parameters:
  • paginator – django Paginator, populated with objects
  • page – number of the current page
  • page_labels – optional dictionary of page labels, keyed on page number
Return type:

dictionary; keys are page numbers, values are page labels

eulcommon.searchutil.parse_search_terms(q)¶

Parse a string of search terms into keywords, phrases, and field/value pairs. Use quotes (” “) to designate phrases and field:value or field:”term term” to designated field value pairs. Returns a list of tuples where the first value is the field, or None for a word or phrase, second value is the keyword or phrase. Incomplete field value pairs will return a tuple with None for the value. For example:

parse_search_terms('grahame "frog and toad" title:willows')

Would result in:

[(None,'grahame'), (None, 'frog and toad'), ('title', 'willows')]

Django template tag to display pagination links for a paginated list of items.

Expects the following variables:
  • the current Page of a Paginator object
  • a dictionary of the pages to be displayed, in the format generated by eulcommon.searchutil.pages_to_show()
  • optional url params to include in pagination link (e.g., search terms when paginating search results)
  • optional first page label (only used when first page is not in list of pages to be shown)
  • optional last page label (only used when last page is not in list of pages to be shown)
  • optional url to use for page links (only needed when the url is different from the current one)

Example use:

{% load search_utils %}

{% pagination_links paged_items show_pages  %}

Project Versions

Previous topic

eulcommon.djangoextras – Extensions and additions to django

Next topic

eulcore.binfile – Map binary data to Python objects

This Page

PK‡|Ô@0|i|5|5eulcommon-0.17.0/changelog.html Change & Version Information — EULcommon 0.17.0 documentation

Change & Version Information¶

The following is a summary of changes and improvements to eulcommon. New features in each version should be listed, with any necessary information about installation or upgrade notes.

0.17.0¶

  • searchutil can now parse field:value pairs in search term strings. See parse_search_terms(). The existing search term parsing method, search_terms(), should continue to work as before.
  • eulcommon.binfile has been moved into the new bodatools; it will remain in eulcommon for the upcoming release as deprecated, and then be removed at a later date.

0.16.2 - template hotfix redux¶

  • Add missing pagination template to setup.py install

0.16.1 - template hotfix¶

  • Add missing pagination template to sdist

0.16.0¶

  • Parsing for quotable search strings
  • Utility to limit pagination display to nearby pages

0.15.0 - Initial Release¶

  • Split out and re-organized common, useful components (binfile, djangoextras) from eulcore into eulcommon for easier re-use.

Project Versions

Table Of Contents

Previous topic

eulcommon.binfile.outlookexpress – Outlook Express 4.5 for Mac

This Page

PKˆ|Ô@Õ}€ê)ê)eulcommon-0.17.0/searchindex.jsSearch.setIndex({objects:{"eulcommon.djangoextras.formfields.W3CDateWidget":{value_from_datadict:[5,5,1,""],create_textinput:[5,5,1,""],render:[5,5,1,""]},"eulcommon.djangoextras.formfields.W3CDateField":{widget:[5,1,1,""]},"eulcommon.binfile.outlookexpress.MacIndexMessage":{LENGTH:[4,1,1,""],size:[4,1,1,""],offset:[4,1,1,""]},"eulcommon.binfile.eudora":{Toc:[3,3,1,""],Message:[3,3,1,""]},"eulcommon.binfile.outlookexpress":{MacMailMessage:[4,3,1,""],MacIndex:[4,3,1,""],MacFolder:[4,3,1,""],MacMail:[4,3,1,""],MacIndexMessage:[4,3,1,""]},"eulcommon.binfile.outlookexpress.MacMailMessage":{DELETED_MESSAGE:[4,1,1,""],deleted:[4,1,1,""],content_offset:[4,1,1,""],header_type:[4,1,1,""],MESSAGE:[4,1,1,""],data:[4,1,1,""],as_email:[4,5,1,""]},"eulcommon.binfile.eudora.Toc":{LENGTH:[3,1,1,""],version:[3,1,1,""],messages:[3,1,1,""],name:[3,1,1,""]},"eulcommon.searchutil.templatetags":{search_utils:[6,0,1,""]},"eulcommon.djangoextras.auth":{permission_required_with_403:[5,2,1,""],login_required_with_ajax:[5,2,1,""],permission_required_with_ajax:[5,2,1,""],user_passes_test_with_ajax:[5,2,1,""],user_passes_test_with_403:[5,2,1,""]},"eulcommon.binfile.outlookexpress.MacIndex":{MAGIC_NUMBER:[4,1,1,""],total_messages:[4,1,1,""],header_length:[4,1,1,""],messages:[4,1,1,""]},eulcommon:{djangoextras:[5,0,1,""],searchutil:[6,0,1,""],binfile:[1,0,1,""]},"eulcommon.binfile.eudora.Message":{status:[3,1,1,""],priority:[3,1,1,""],to:[3,1,1,""],LENGTH:[3,1,1,""],offset:[3,1,1,""],date:[3,1,1,""],body_offset:[3,1,1,""],size:[3,1,1,""],subject:[3,1,1,""]},"eulcommon.binfile.outlookexpress.MacFolder":{count:[4,1,1,""],all_messages:[4,1,1,""],skipped_chunks:[4,1,1,""],messages:[4,1,1,""],raw_messages:[4,1,1,""]},"eulcommon.djangoextras":{formfields:[5,0,1,""],auth:[5,0,1,""]},"eulcommon.djangoextras.formfields.DynamicChoiceField":{widget:[5,1,1,""]},"eulcommon.searchutil":{parse_search_terms:[6,4,1,""],search_terms:[6,4,1,""],pages_to_show:[6,4,1,""]},"eulcommon.searchutil.templatetags.search_utils":{pagination_links:[6,4,1,""]},"eulcommon.binfile":{core:[1,0,1,""],ByteField:[1,3,1,""],eudora:[3,0,1,""],IntegerField:[1,3,1,""],BinaryStructure:[1,3,1,""],LengthPrependedStringField:[1,3,1,""],outlookexpress:[4,0,1,""]},"eulcommon.djangoextras.formfields":{DynamicChoiceField:[5,3,1,""],W3CDateWidget:[5,3,1,""],DynamicSelect:[5,3,1,""],W3CDateField:[5,3,1,""]},"eulcommon.binfile.outlookexpress.MacMail":{MAGIC_NUMBER:[4,1,1,""],get_message:[4,5,1,""]}},terms:{all:3,code:[5,1],skip:4,particular:[5,1,3],month:5,four:1,overlap:1,follow:[6,1,3,4,2],search_term:[6,2],disk:1,first_page_label:6,compact:3,whose:[5,1],middl:1,depend:5,certainli:3,those:1,"32xi32x":1,x02:1,x01:1,x00:1,x07:1,x06:1,x05:1,x04:1,liter:[5,1,3,4,6],string:[5,1,4,6,2],extra_attr:5,far:4,lengthprependedstringfield:1,util:[5,0,6,2],appar:3,ticket:5,macmail:4,magic:4,level:5,list:[6,2],iter:4,item:6,paginator_pag:6,natur:1,sign:1,past:1,second:6,design:6,pass:[5,1],further:1,relocat:1,even:5,index:[0,1,3,4],what:4,header_length:4,navig:1,calcul:1,access:[1,4],delet:[3,4],version:[0,3,2],"new":[3,2],net:3,method:[5,1,2],metadata:3,hierarch:3,widget:[5,0],full:3,behavior:5,binfil:[0,1,3,4,2],displai:[5,6,3,2],search_util:6,gener:[0,1,3,4,5,6],onli:[6,1,3,4],bodi:3,meet:5,deleted_messag:4,path:4,becom:3,sinc:1,interpret:1,box:5,min_length:5,search:[0,6,2],implement:1,get_messag:4,macintosh:[0,1,4],extra:5,modul:[0,1,3,6],filenam:1,unix:3,"boolean":4,body_offset:3,instal:2,total:1,select:5,test_func:5,from:[1,2,3,4,5,6],describ:3,would:[1,6],univers:0,two:1,perm:5,next:5,few:[1,3],call:[5,3],macmailmessag:4,type:[1,6],reorder:3,more:[5,1,3,6],flat:3,bytefield:1,desir:4,show_pag:6,enhanc:5,x03:1,flag:4,templat:[5,0,6,2],recount:1,known:1,obj:1,unpack:1,cach:3,must:4,dictat:3,none:[5,1,3,4,6],word:6,sometim:1,alia:5,setup:2,work:[5,2],focu:3,dev:5,histori:3,remain:2,tag:6,can:[1,4,2],endian:1,akin:[1,3],def:5,abcd:1,give:1,fmdf:4,sdist:2,indic:[0,4],wrapper:4,lengthprepededstringfield:1,skipped_chunk:4,phrase:6,unsign:1,multipl:1,quot:6,anoth:[1,3],length:[5,1,3,4],snippet:5,how:1,"68x":1,instead:[5,1,3],negoti:[5,0],simpl:[5,1],updat:3,map:[0,1,3,4],express:[5,0,1,4],referenc:5,mess:1,after:4,befor:2,mac:[3,4],unidentifi:1,date:[5,3,2],end:[6,1,3,4],data:[5,0,1,3,4],grow:1,practic:3,third:1,correspond:4,django:[5,0,6],inform:[0,3,4,2],allow:1,callabl:5,lambda:5,order:3,dynamicselect:5,help:3,over:1,move:2,templatetag:6,has_perm:5,through:[1,3,4],dynam:5,paramet:[5,1,4,6],render:5,willow:6,fix:[1,3],user_passes_test:5,better:1,window:3,mail:[3,4],might:[1,3],easier:2,non:[1,3,4],"return":[5,6,4],quotabl:2,thei:[5,0,1,3],python:[0,1,3,4],handi:1,auth:[5,0],facilit:1,now:[3,2],discuss:5,parse_search_term:[6,2],choic:5,term:[6,2],binarystructur:[0,1,3,4],name:[5,1,3],revers:[1,3],each:[5,1,3,4,2],permission_required_with_403:5,ters:1,side:6,inbox:3,chunk:4,continu:2,wrap:1,"static":5,expect:[5,6],year:[5,3],happen:1,special:5,out:[5,0,1,3,2],variabl:[6,1,4],shown:6,space:3,miss:2,content:[5,0,1,3,4],laid:1,correct:4,insid:[1,3],total_messag:4,mdel:4,given:5,standard:[1,3],ajax:5,base:[5,1,4],dictionari:[5,6],releas:[5,0,2],org:5,"byte":[1,3],organ:[1,2],mystr:1,dynamicchoicefield:5,could:3,perhap:4,eulcommon:[0,1,2,3,4,5,6],summari:[4,2],textinput:5,first:[1,6],reimplement:1,directli:3,number:[6,1,4],w3cdatefield:5,mai:[0,1,3],alreadi:5,least:4,custom:[5,0],open:1,size:[5,3,4],prioriti:3,differ:[1,3,6],"long":[1,3],system:3,messag:[3,4],fobj:[1,3,4],max_length:5,macfold:4,toc:3,pagination_link:6,store:[1,3,4],option:[6,1,4],blindli:5,copi:3,specifi:[5,1,6],eudora2unix:3,part:5,pars:[1,3,6,2],my_view:5,exactli:5,serv:3,kind:3,peril:1,ksimler:3,keyword:6,provid:3,remov:[3,2],content_offset:4,structur:[1,3,4],project:0,reus:3,were:3,w3cdatewidget:5,stale:3,pre:[5,1,3,4,6],arg:[5,4],argument:1,packag:1,have:[5,1,3,4],tabl:[0,3],need:[6,3],incompat:3,dozen:1,engin:[1,3],djangoextra:[5,0,2],macindexmessag:4,self:1,mid:3,note:2,also:[5,1,3,4],client:[1,3],take:[5,6],which:[5,1,4],singl:[5,1,3,4],simplifi:1,begin:[6,1,4],pages_to_show:6,integerfield:1,though:[1,3],object:[0,1,3,4,5,6],starpow:3,discov:1,most:[1,3],regular:5,accesss:1,pair:[6,2],hotfix:[0,2],"class":[0,1,3,4,5,6],url:6,doc:5,later:[3,2],request:5,doe:[5,4],all_messag:4,can_vot:5,occasion:1,recipi:3,show:6,text:5,verbos:1,syntax:1,dbx:4,permiss:[5,0],fine:1,redirect:5,current:[5,1,3,6],mybyt:1,locat:[1,3],should:[5,2],suppos:1,folder:[0,1,3,4],unus:5,get:4,macindex:4,secondari:1,cannot:3,requir:[5,1,4],enabl:5,user_passes_test_with_403:5,inextens:1,probabl:4,yield:[3,4],loginpag:5,"default":[5,3],common:[0,1,2],contain:[6,1,3,4],where:[6,1,4],view:[5,0],set:[5,4],knowledg:1,myfield:1,see:[5,2],result:[6,3],respons:5,fail:5,close:6,subject:3,statu:[5,3],eudora:[0,1,3],eachoth:1,correctli:4,pattern:5,user:[5,1,3],label:6,score:1,pagin:[6,2],between:4,"import":[1,3],email:[3,4],attribut:[5,1],spars:1,kei:[6,3],extens:[5,0],entir:3,popul:6,both:1,last:[1,6],expos:1,nearbi:2,etc:1,instanc:1,mani:[0,3],login:5,header_typ:4,com:5,load:6,point:1,instanti:1,header:[3,4],poll:5,union:1,login_required_with_ajax:5,three:5,empti:4,mark:3,compon:2,valu:[5,1,3,6,2],interest:3,basic:[5,1],addit:[5,0,3],tini:0,url_param:6,upcom:2,uncommon:1,ani:[5,1,4,2],understand:1,togeth:0,demand:3,choicefield:5,present:[5,4],"case":[5,1],multi:5,raw:[3,4],properti:1,sourceforg:3,aim:3,defin:1,"while":5,redirect_field_nam:5,error:5,eulcor:[5,0,1,2],anonym:5,mbox:3,as_email:4,pack:1,bin:1,advantag:1,them:[5,1,3],kwarg:[5,4],"30xi34x":1,formfield:[5,0],decor:[5,0],minim:0,suggest:4,make:1,same:[5,1,4],binari:[0,1,3,4],html:[5,3],split:[0,1,2],document:4,http:[5,0,3],dai:[5,3],initi:[5,0,4,2],improv:2,typic:1,expand:3,subpackag:0,appropri:1,equival:5,entri:3,thu:3,well:3,djangosnippet:5,exampl:[5,6],thi:[5,1,3,4,6],construct:5,folder_path:4,less:3,superimpos:1,user_passes_test_with_ajax:5,yet:3,bodatool:2,struct:1,easi:1,idiom:1,mmap:1,raw_messag:4,except:[1,4],param:6,add:[1,2],priori:1,larg:1,input:5,save:3,match:3,earli:3,applic:[1,3],permission_required_with_ajax:5,around:6,format:[5,1,3,4,6],read:[1,3],big:1,amp:2,bit:[0,1],like:3,deprec:2,docutil:[5,1,3,4,6],arbitrari:1,integ:1,collect:0,necessari:[5,1,3,2],either:[6,4],output:5,page:[5,0,6,2],x04abcd:1,underli:1,myobject:1,page_label:6,often:1,some:[1,3],unspecifi:3,"export":[1,3],superclass:1,inact:3,librari:[0,1],djangoproject:5,normal:4,definit:1,subclass:[0,1],leav:5,overlai:1,myint:1,sensibl:1,miscellan:0,usag:[5,0,1],offset:[1,3,4],searchutil:[0,6,2],about:[1,3,4,2],actual:[5,1,4],greatli:1,slightli:1,unfortun:3,permission_requir:5,create_textinput:5,prolifer:0,fmin:4,constructor:1,other:3,block:4,yyyi:5,outlook:[0,1,4],own:1,primarili:0,within:[1,3,4],encod:1,upgrad:2,method_decor:5,mbx:4,been:[3,2],contrib:5,chang:[0,2],storag:3,your:1,w3c:5,span:[5,1,3,4,6],log:5,wai:5,support:[1,3],submit:5,paged_item:6,avail:[6,3,4],start:[1,4],frog:6,includ:[6,1,4],emori:0,individu:[0,4],"function":5,login_url:5,form:[5,0],offer:1,tupl:[1,6],link:6,"true":5,count:4,immedi:[1,3],attr:5,consist:[1,3,4],whether:5,caller:1,maximum:5,record:3,below:3,limit:2,magic_numb:4,page_url:6,gone:3,featur:[5,2],creat:1,certain:1,parser:3,repres:[1,3],incomplet:6,exist:2,outlookexpress:4,file:[5,0,1,3,4],graham:6,check:5,fill:5,titl:6,when:[5,1,3,4,6],field:[0,1,2,3,5,6],value_from_datadict:5,valid:5,futur:0,last_page_label:6,immens:3,test:5,you:1,matur:0,repeat:1,determin:4,toad:6,msum:4,consid:1,faster:1,directori:4,time:5,redux:[0,2]},objtypes:{"0":"py:module","1":"py:attribute","2":"py:staticmethod","3":"py:class","4":"py:function","5":"py:method"},titles:["EULcommon","eulcore.binfile – Map binary data to Python objects","Change & Version Information","eulcommon.binfile.eudora – Eudora email index files","eulcommon.binfile.outlookexpress – Outlook Express 4.5 for Mac","eulcommon.djangoextras – Extensions and additions to django","eulcommon.searchutil – Utilities for searching"],objnames:{"0":["py","module","Python module"],"1":["py","attribute","Python attribute"],"2":["py","staticmethod","Python static method"],"3":["py","class","Python class"],"4":["py","function","Python function"],"5":["py","method","Python method"]},filenames:["index","binfile","changelog","binfile/eudora","binfile/outlookexpress","djangoextras","searchutil"]})PKˆ|Ô@ì3³Éeulcommon-0.17.0/objects.inv# Sphinx inventory version 2 # Project: EULcommon # Version: 0.17 # The remainder of this file is compressed using zlib. xÚ½XKs›0¾çWx¦½šÆ“žrKb'ÍLÈdêtzdd´%QiÛýõ·~`,Ü["ÐJìî÷Xg‚²œÂr ^s2>ŽÅj˜Õ‚3þi ª9 Ë¥‹ò†M›ÕzGõª"ãt÷Åj­~mZ½ðB¸Íc‘e"f,Ÿ3A,$˜Û\gÕñ—ƒÍƒõæjuøy0lØ š Iš6©YĹï°,$(Õk÷•–˜ô䉀%J¢‚¹Ùœ§»AwÞ± E4¦®Aú쯪¨‘ñÝÿ–­öYÁ ’DÕëQù@uZ—¤g¿ì2$qHÍߦ5 h› J6ÓƒQk´µe°‰;t‰ù\‹½Ý­V1•ž½Aìï0k0Yu€rÏB{²c‘#äx"/§O;ÀIP€Ì˜RLä‘„_šI Ñ‚a}½¼*ÏQHÅ`*¨9ê V ¦Ÿ«ù*â“ ïSÊ{Á)È@½³¢0_oP•¿Ÿ¥¢õAþšf/ËO“ç‡×oÞPSH&$ÃU÷€L8:à¬æ[ܲœÈÕ¥ŽQWbsbÄf´Ë]Vä}ºc¨P0^å$cñ]*X ÷åÚöMlqÐëˆiˆWôo†­¬D*ˆjÍ@ƒìu*æ:ÑܺÇØ®¾.‡<©ÖùÂ6ZçzkHxt6Е©•wi±Ã´ý­÷|c+–ìš—¨2RC|£i’pŸU{Z7í‹„Lz©¡–'°î•”íz5ë*Ë[ôóênlÐñ“Ñ0åÍåNº;‘[»Þ“7²tümìÕ¸4Î ½‰±MÕ:ŽX«*ù‰p2Þ˜©VŽÎ3 M¼`ñ×5ll7ùiòõ§1H'.è=wÚàŽé:6"ú±/vvn Search — EULcommon 0.17.0 documentation

Search

Please activate JavaScript to enable the search functionality.

From here you can search these documents. Enter your search words into the box below and click "search". Note that the search function will automatically search for all of the words. Pages containing fewer words won't appear in the result list.

Project Versions

PKˆ|Ô@þNèÄaÄaeulcommon-0.17.0/genindex.html Index — EULcommon 0.17.0 documentation

Index

A | B | C | D | E | G | H | I | L | M | N | O | P | R | S | T | U | V | W

A

all_messages (eulcommon.binfile.outlookexpress.MacFolder attribute)
as_email() (eulcommon.binfile.outlookexpress.MacMailMessage method)

B

BinaryStructure (class in eulcommon.binfile)
body_offset (eulcommon.binfile.eudora.Message attribute)
ByteField (class in eulcommon.binfile)

C

content_offset (eulcommon.binfile.outlookexpress.MacMailMessage attribute)
count (eulcommon.binfile.outlookexpress.MacFolder attribute)
create_textinput() (eulcommon.djangoextras.formfields.W3CDateWidget method)

D

data (eulcommon.binfile.outlookexpress.MacMailMessage attribute)
date (eulcommon.binfile.eudora.Message attribute)
deleted (eulcommon.binfile.outlookexpress.MacMailMessage attribute)
DELETED_MESSAGE (eulcommon.binfile.outlookexpress.MacMailMessage attribute)
DynamicChoiceField (class in eulcommon.djangoextras.formfields)
DynamicSelect (class in eulcommon.djangoextras.formfields)

E

eulcommon.binfile (module)
eulcommon.binfile.core (module)
eulcommon.binfile.eudora (module)
eulcommon.binfile.outlookexpress (module)
eulcommon.djangoextras (module)
eulcommon.djangoextras.auth (module)
eulcommon.djangoextras.formfields (module)
eulcommon.searchutil (module)
eulcommon.searchutil.templatetags.search_utils (module)

G

get_message() (eulcommon.binfile.outlookexpress.MacMail method)

H

header_length (eulcommon.binfile.outlookexpress.MacIndex attribute)
header_type (eulcommon.binfile.outlookexpress.MacMailMessage attribute)

I

IntegerField (class in eulcommon.binfile)

L

LENGTH (eulcommon.binfile.eudora.Message attribute)
(eulcommon.binfile.eudora.Toc attribute)
(eulcommon.binfile.outlookexpress.MacIndexMessage attribute)
LengthPrependedStringField (class in eulcommon.binfile)
login_required_with_ajax() (eulcommon.djangoextras.auth static method)

M

MacFolder (class in eulcommon.binfile.outlookexpress)
MacIndex (class in eulcommon.binfile.outlookexpress)
MacIndexMessage (class in eulcommon.binfile.outlookexpress)
MacMail (class in eulcommon.binfile.outlookexpress)
MacMailMessage (class in eulcommon.binfile.outlookexpress)
MAGIC_NUMBER (eulcommon.binfile.outlookexpress.MacIndex attribute)
(eulcommon.binfile.outlookexpress.MacMail attribute)
Message (class in eulcommon.binfile.eudora)
MESSAGE (eulcommon.binfile.outlookexpress.MacMailMessage attribute)
messages (eulcommon.binfile.eudora.Toc attribute)
(eulcommon.binfile.outlookexpress.MacFolder attribute)
(eulcommon.binfile.outlookexpress.MacIndex attribute)

N

name (eulcommon.binfile.eudora.Toc attribute)

O

offset (eulcommon.binfile.eudora.Message attribute)
(eulcommon.binfile.outlookexpress.MacIndexMessage attribute)

P

pages_to_show() (in module eulcommon.searchutil)
pagination_links() (in module eulcommon.searchutil.templatetags.search_utils)
parse_search_terms() (in module eulcommon.searchutil)
permission_required_with_403() (eulcommon.djangoextras.auth static method)
permission_required_with_ajax() (eulcommon.djangoextras.auth static method)
priority (eulcommon.binfile.eudora.Message attribute)

R

raw_messages (eulcommon.binfile.outlookexpress.MacFolder attribute)
render() (eulcommon.djangoextras.formfields.W3CDateWidget method)

S

search_terms() (in module eulcommon.searchutil)
size (eulcommon.binfile.eudora.Message attribute)
(eulcommon.binfile.outlookexpress.MacIndexMessage attribute)
skipped_chunks (eulcommon.binfile.outlookexpress.MacFolder attribute)
status (eulcommon.binfile.eudora.Message attribute)
subject (eulcommon.binfile.eudora.Message attribute)

T

to (eulcommon.binfile.eudora.Message attribute)
Toc (class in eulcommon.binfile.eudora)
total_messages (eulcommon.binfile.outlookexpress.MacIndex attribute)

U

user_passes_test_with_403() (eulcommon.djangoextras.auth static method)
user_passes_test_with_ajax() (eulcommon.djangoextras.auth static method)

V

value_from_datadict() (eulcommon.djangoextras.formfields.W3CDateWidget method)
version (eulcommon.binfile.eudora.Toc attribute)

W

W3CDateField (class in eulcommon.djangoextras.formfields)
W3CDateWidget (class in eulcommon.djangoextras.formfields)
widget (eulcommon.djangoextras.formfields.DynamicChoiceField attribute)
(eulcommon.djangoextras.formfields.W3CDateField attribute)

Project Versions

PKˆ|Ô@)Šcææeulcommon-0.17.0/.buildinfo# Sphinx build info version 1 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. config: 2491bbdf77531c07cb08737557b4f913 tags: fbb0d17656682115ca4d033fb2f83ba1 PK‡|Ô@ÝqÃUqUq,eulcommon-0.17.0/binfile/outlookexpress.html eulcommon.binfile.outlookexpress – Outlook Express 4.5 for Mac — EULcommon 0.17.0 documentation

eulcommon.binfile.outlookexpress – Outlook Express 4.5 for Mac¶

Map binary email folder index and content files for Outlook Express 4.5 for Macintosh to Python objects.

What documentation is available suggests that Outlook Express stored email in either .mbx or .dbx format, but in Outlook Express 4.5 for Macintosh, each mail folder consists of a directory with an Index file and an optional Mail file (no Mail file is present when a mail folder is empty).

class eulcommon.binfile.outlookexpress.MacFolder(folder_path)¶

Wrapper object for an Outlook Express 4.5 for Mac folder, with a MacIndex and an optional MacMail.

Parameters:folder_path – path to the Outlook Express 4.5 folder directory, which must contain at least an Index file (and probably a Mail file, for non-empty folders)
all_messages¶

Same as messages except deleted messages are included.

count¶

Number of email messages in this folder

messages¶

A generator yielding an email.message.Message for each message in this folder, based on message index information in MacIndex and content in MacMail. Does not include deleted messages.

raw_messages¶

A generator yielding a MacMailMessage binary object for each message in this folder, based on message index information in MacIndex and content in MacMail.

skipped_chunks = None¶

Number of data chunks skipped between raw messages, based on offset and size. (Only set after iterating through messages.)

class eulcommon.binfile.outlookexpress.MacIndex(fobj=None, mm=None, offset=0)¶

A BinaryStructure for the Index file of an Outlook Express 4.5 for Mac email folder.

MAGIC_NUMBER = 'FMIn'¶

Magic Number for Outlook Express 4.5 Mac Index file

header_length = 28¶

length of the binary header at the beginning of the Index file

messages¶

A generator yielding the MacIndexMessage structures in this index file.

total_messages¶

number of email messages in this folder

class eulcommon.binfile.outlookexpress.MacIndexMessage(fobj=None, mm=None, offset=0)¶

Information about a single email message within the MacIndex.

LENGTH = 52¶

size of a single message information block

offset¶

the offset of the raw email data in the folder data file

size¶

the size of the raw email data in the folder data file

class eulcommon.binfile.outlookexpress.MacMail(fobj=None, mm=None, offset=0)¶

A BinaryStructure for the Mail file of an Outlook Express 4.5 for Mac email folder. The Mail file includes the actual contents of any email files in the folder, which must be accessed based on the message offset and size from the Index file.

MAGIC_NUMBER = 'FMDF'¶

Magic Number for a mail content file within an Outlook Express 4.5 for Macintosh folder

get_message(offset, size)¶

Get an individual MacMailMessage within a Mail data file, based on size and offset information from the corresponding MacIndexMessage.

Parameters:
  • offset – offset within the Mail file where the desired message begins, i.e. MacMailMessage.offset
  • size – size of the message, i.e. MacMailMessage.size
class eulcommon.binfile.outlookexpress.MacMailMessage(size, *args, **kwargs)¶

A single email message within the Mail data file, as indexed by a MacIndexMessage. Consists of a variable length header or message summary followed by the content of the email (also variable length).

The size of a single MacMailMessage is stored in the MacIndexMessage but not (as far as we have determined) in the Mail data file, an individual message must be initialized with the a size parameter, so that the correct content can be returned.

Parameters:size – size of this message (as determined by MacIndexMessage.size); required to return data correctly.
DELETED_MESSAGE = 'MDel'¶

Header string indicating a deleted message

MESSAGE = 'MSum'¶

Header string indicating a normal message

as_email()¶

Return message data as a email.message.Message object.

content_offset¶

offset within this message block where the message summary header ends and message content begins

data¶

email content for this message

deleted¶

boolean flag indicating if this is a deleted message

header_type¶

Each mail message begins with a header, starting with either MSum (message summary, perhaps) or MDel for deleted messages.

Project Versions

Previous topic

eulcommon.binfile.eudora – Eudora email index files

Next topic

Change & Version Information

This Page

PK‡|Ô@áOŽž&R&R$eulcommon-0.17.0/binfile/eudora.html eulcommon.binfile.eudora – Eudora email index files — EULcommon 0.17.0 documentation

eulcommon.binfile.eudora – Eudora email index files¶

Map binary email table of contents files for the Eudora mail client to Python objects.

The Eudora email client has a long history through the early years of email. It supported versions for early Mac systems as well as early Windows OSes. Unfortunately, most of them use binary file formats that are entirely incompatible with one another. This module is aimed at one day reading all of them, but for now practicality and immediate needs demand that it focus on the files saved by a particular version on mid-90s Mac System 7.

That Eudora version stores email in flat (non-hierarchical) folders. It stores each folder’s email data in a single file akin to a Unix mbox file, but with some key differences, described below. In addition to this folder data file, each folder also stores a binary “table of contents” index. In this version, a folder called In stores its index in a file called In.toc. This file consists of a fixed-size binary header with folder metadata, followed by fixed-size binary email records containing cached email header metadata as well as the location of the full email in the mbox-like data file. As the contents of the folder are updated, these fixed-size binary email records are added, removed, and reordered, apparently compacting the file as necessary so that it matches the folder contents displayed to the application end user.

With the index serving to dictate the order of the emails and their contents, their locations and sizes inside the data storage file become less important. When emails are deleted from a folder, the index is updated, but they are not removed immediately from the data file. Instead that data space is marked as inactive and might be reused later when a new email is added to the folder. As a result, the folder data file may contain stale and out-of-order data and thus cannot be read directly as a standard mbox file.

This module, then, provides classes for parsing the binary structures of the index file and mapping them to Python objects. This binary file has gone through many formats. Only one is represented in this module, though it could certainly be expanded to support more. Parsers and information about other versions of the index file are available at http://eudora2unix.sourceforge.net/ and http://users.starpower.net/ksimler/eudora/toc.html; these were immensely helpful in reverse-engineering the version represented by this module.

This module exports the following names:
class eulcommon.binfile.eudora.Message(fobj=None, mm=None, offset=0)¶

A BinaryStructure for a single email’s metadata cached in the index file.

Only a few fields are currently represented; other fields contain interesting data but have not yet been reverse-engineered.

LENGTH = 220¶

the size of a single message header

body_offset¶

the offset of the body within the raw email data

date¶

a date value copied from email headers

offset¶

the offset of the raw email data in the folder data file

priority¶

some kind of unspecified single-byte priority field

size¶

the size of the raw email data in the folder data file

status¶

some kind of unspecified single-byte status field

subject¶

the email subject copied from email headers

to¶

a recipient copied from email headers

class eulcommon.binfile.eudora.Toc(fobj=None, mm=None, offset=0)¶

A BinaryStructure for an email folder index header.

Only a few fields are currently represented; other fields contain interesting data but have not yet been reverse-engineered.

LENGTH = 278¶

the size of this binary header

messages¶

a generator yielding the Message structures in the index

name¶

the user-displayed folder name, e.g., “In” for the default inbox

version¶

the file format version

Project Versions

Previous topic

eulcore.binfile – Map binary data to Python objects

Next topic

eulcommon.binfile.outlookexpress – Outlook Express 4.5 for Mac

This Page

PKˆ|Ô@:>«>«>'eulcommon-0.17.0/_static/searchtools.js/* * searchtools.js_t * ~~~~~~~~~~~~~~~~ * * Sphinx JavaScript utilties for the full-text search. * * :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS. * :license: BSD, see LICENSE for details. * */ /** * helper function to return a node containing the * search summary for a given text. keywords is a list * of stemmed words, hlwords is the list of normal, unstemmed * words. the first one is used to find the occurance, the * latter for highlighting it. */ jQuery.makeSearchSummary = function(text, keywords, hlwords) { var textLower = text.toLowerCase(); var start = 0; $.each(keywords, function() { var i = textLower.indexOf(this.toLowerCase()); if (i > -1) start = i; }); start = Math.max(start - 120, 0); var excerpt = ((start > 0) ? '...' : '') + $.trim(text.substr(start, 240)) + ((start + 240 - text.length) ? '...' : ''); var rv = $('
').text(excerpt); $.each(hlwords, function() { rv = rv.highlightText(this, 'highlighted'); }); return rv; } /** * Porter Stemmer */ var Stemmer = function() { var step2list = { ational: 'ate', tional: 'tion', enci: 'ence', anci: 'ance', izer: 'ize', bli: 'ble', alli: 'al', entli: 'ent', eli: 'e', ousli: 'ous', ization: 'ize', ation: 'ate', ator: 'ate', alism: 'al', iveness: 'ive', fulness: 'ful', ousness: 'ous', aliti: 'al', iviti: 'ive', biliti: 'ble', logi: 'log' }; var step3list = { icate: 'ic', ative: '', alize: 'al', iciti: 'ic', ical: 'ic', ful: '', ness: '' }; var c = "[^aeiou]"; // consonant var v = "[aeiouy]"; // vowel var C = c + "[^aeiouy]*"; // consonant sequence var V = v + "[aeiou]*"; // vowel sequence var mgr0 = "^(" + C + ")?" + V + C; // [C]VC... is m>0 var meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$"; // [C]VC[V] is m=1 var mgr1 = "^(" + C + ")?" + V + C + V + C; // [C]VCVC... is m>1 var s_v = "^(" + C + ")?" + v; // vowel in stem this.stemWord = function (w) { var stem; var suffix; var firstch; var origword = w; if (w.length < 3) return w; var re; var re2; var re3; var re4; firstch = w.substr(0,1); if (firstch == "y") w = firstch.toUpperCase() + w.substr(1); // Step 1a re = /^(.+?)(ss|i)es$/; re2 = /^(.+?)([^s])s$/; if (re.test(w)) w = w.replace(re,"$1$2"); else if (re2.test(w)) w = w.replace(re2,"$1$2"); // Step 1b re = /^(.+?)eed$/; re2 = /^(.+?)(ed|ing)$/; if (re.test(w)) { var fp = re.exec(w); re = new RegExp(mgr0); if (re.test(fp[1])) { re = /.$/; w = w.replace(re,""); } } else if (re2.test(w)) { var fp = re2.exec(w); stem = fp[1]; re2 = new RegExp(s_v); if (re2.test(stem)) { w = stem; re2 = /(at|bl|iz)$/; re3 = new RegExp("([^aeiouylsz])\\1$"); re4 = new RegExp("^" + C + v + "[^aeiouwxy]$"); if (re2.test(w)) w = w + "e"; else if (re3.test(w)) { re = /.$/; w = w.replace(re,""); } else if (re4.test(w)) w = w + "e"; } } // Step 1c re = /^(.+?)y$/; if (re.test(w)) { var fp = re.exec(w); stem = fp[1]; re = new RegExp(s_v); if (re.test(stem)) w = stem + "i"; } // Step 2 re = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/; if (re.test(w)) { var fp = re.exec(w); stem = fp[1]; suffix = fp[2]; re = new RegExp(mgr0); if (re.test(stem)) w = stem + step2list[suffix]; } // Step 3 re = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/; if (re.test(w)) { var fp = re.exec(w); stem = fp[1]; suffix = fp[2]; re = new RegExp(mgr0); if (re.test(stem)) w = stem + step3list[suffix]; } // Step 4 re = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/; re2 = /^(.+?)(s|t)(ion)$/; if (re.test(w)) { var fp = re.exec(w); stem = fp[1]; re = new RegExp(mgr1); if (re.test(stem)) w = stem; } else if (re2.test(w)) { var fp = re2.exec(w); stem = fp[1] + fp[2]; re2 = new RegExp(mgr1); if (re2.test(stem)) w = stem; } // Step 5 re = /^(.+?)e$/; if (re.test(w)) { var fp = re.exec(w); stem = fp[1]; re = new RegExp(mgr1); re2 = new RegExp(meq1); re3 = new RegExp("^" + C + v + "[^aeiouwxy]$"); if (re.test(stem) || (re2.test(stem) && !(re3.test(stem)))) w = stem; } re = /ll$/; re2 = new RegExp(mgr1); if (re.test(w) && re2.test(w)) { re = /.$/; w = w.replace(re,""); } // and turn initial Y back to y if (firstch == "y") w = firstch.toLowerCase() + w.substr(1); return w; } } /** * Search Module */ var Search = { _index : null, _queued_query : null, _pulse_status : -1, init : function() { var params = $.getQueryParameters(); if (params.q) { var query = params.q[0]; $('input[name="q"]')[0].value = query; this.performSearch(query); } }, loadIndex : function(url) { $.ajax({type: "GET", url: url, data: null, success: null, dataType: "script", cache: true}); }, setIndex : function(index) { var q; this._index = index; if ((q = this._queued_query) !== null) { this._queued_query = null; Search.query(q); } }, hasIndex : function() { return this._index !== null; }, deferQuery : function(query) { this._queued_query = query; }, stopPulse : function() { this._pulse_status = 0; }, startPulse : function() { if (this._pulse_status >= 0) return; function pulse() { Search._pulse_status = (Search._pulse_status + 1) % 4; var dotString = ''; for (var i = 0; i < Search._pulse_status; i++) dotString += '.'; Search.dots.text(dotString); if (Search._pulse_status > -1) window.setTimeout(pulse, 500); }; pulse(); }, /** * perform a search for something */ performSearch : function(query) { // create the required interface elements this.out = $('#search-results'); this.title = $('

' + _('Searching') + '

').appendTo(this.out); this.dots = $('').appendTo(this.title); this.status = $('

').appendTo(this.out); this.output = $('