Permalink
Browse files

Vs 1.0.11 - 4/13/2011 by MB

  • Loading branch information...
1 parent f169e78 commit d57ae6920eb765fc89dcd3ff19502f337af9a72e @mbarrot mbarrot committed Apr 13, 2011
Showing with 69 additions and 33 deletions.
  1. +33 −22 README
  2. +5 −1 api/explorer/index.html
  3. +5 −5 api/explorer/styles/local.css
  4. +17 −0 api/genkey.py
  5. +9 −5 core/entity_manager.py
View
55 README
@@ -2,12 +2,12 @@
ERM Installation
=================
+This document describes the installation of Evectors ERM on a Mac OS X system.
+Installation under other kinds of Unix systems should defer in small ways only.
Prerequisites
-------------
-MAC OS X systems
-
System
Version: Mac OS X 10.6
@@ -20,19 +20,15 @@ Version: 2.6
+ GCC
-Version: 4.x
+Version: 4.2
Site: http://gcc.gnu.org/
-Download: http://connect.apple.com/cgi-bin/WebObjects/MemberSite.woa/wa/getSoftware?bundleID=20792
+Download: http://itunes.apple.com/us/app/xcode/id422352214?mt=12
Installation:
GCC is part of XCode, currently at version 4.
-However, some required packages for python extensions insist on building 'universal' binaries with PPC components. The latest version of Xcode that supports the PPC architecture is 3.2.6.
-XCode is no longer part of the standard MacOS distribution, but version 3.2.6 can be downloaded from the above link if you're a member of Apple's MacOS Developer Program (a small yearly fee may apply).
-
-Note:
-If you are building for MacOS 10.5, and its built-in python 2.5, the latest compatible XCode version is 3.1.4, with gcc 4.0.1.
+XCode is no longer part of the standard MacOS distribution, but can be downloaded from the Mac App store for a nominal fee.
+ mod_wsgi
@@ -49,10 +45,6 @@ Installation:
LoadModule wsgi_module libexec/apache2/mod_wsgi.so
3/ restart Web Sharing from the Sharing system preferences
-Note:
-If building on a 10.5, you need to build from the source instead:
-http://code.google.com/p/modwsgi/downloads/detail?name=mod_wsgi-3.3.tar.gz
-
+ MySQL
@@ -84,9 +76,6 @@ $ sudo python setup.py install # or su first
The above can of course be done all in one step if you have installed Python's devtools package which includes easy_install:
$ sudo python -m easy_install MySQL-python
-MySQL for MacOS X packages are not fully consistent with their default instal location.
-Depending on your version of MySQL, you may have to edit the MySQL-python packages's site.cfg file to un-comment and update the path of mysql_config to "/usr/local/mysql/bin/mysql_config" or wherever mysql_config is hiding on your system.
-
+ Django
@@ -101,9 +90,6 @@ $ tar xzf Django-1.2.5.tar.gz
$ cd Django-1.2.5
$ sudo python setup.py install # or su first
-or
-$ sudo python -m easy_install Django
-
Verification:
$ python
>>> import django
@@ -121,10 +107,17 @@ Download: http://pypi.python.org/packages/source/p/python-cjson/python-cjson-1.0
Installation:
$ tar xzf python-cjson-1.0.5.tar.gz
$ cd python-cjson-1.0.5
+
+Before running setup.py, you need to open it in a text editor and add the following 2 lines:
+
+import os
+os.environ['ARCHFLAGS']='-arch i386 -arch x86_64'
+
+Then save the updated version and execute it:
$ sudo python setup.py install # or su first
-or
-$ sudo python -m easy_install python-cjson
+Note:
+Python tends to instal modules with the same options it was compiled with. The python 2.6 version bundled with OS 10.6 is a 'universal binary' with a PPC branch. However Xcode versions after 3.2.6 no longer support the powerpc architecture.
Building and installing
@@ -254,4 +247,22 @@ You should also be able to access the ERM API Explorer at http://your.domain.nam
This is a good point to start playing with the API, and provides links to all the relevant documentation.
-Links to the documentation can also be found in the project's Wiki page on github: https://github.com/evectors/Evectors-ERM/wiki.
+Links to the documentation can also be found in the project's Wiki page on github: https://github.com/evectors/Evectors-ERM/wiki.
+
+
+Notes
+-----
+
+Because MySQL and Python distributions are not fully standardized under MacOS X, installation of Evectors ERM is far from an exact science. If your system version differs from the one described in this document, or run into unexpected errors, refer to the FAQ section of the project's Wiki on GitHub: https://github.com/evectors/Evectors-ERM/wiki.
+
+The ERM code does not include any authentication or encryption layer. All data stored as entities and relationships travels in the clear, and may be updated by anyone with knowledge of the API.
+
+For experimentation, this code base is supposed to execute within your local system, or inside a virtual machine with no direct exposure to the world Wild Web.
+
+When Evectors deploys ERM, its API is always accessed within its server itself, or from systems within a DMZ. The API is never exposed to the Web directly.
+
+To identify each ERM instance, a secret key is part of the API path. You can generate a new pseudo-random key for your installation by running the erm/api/genkey.py script. You then need to copy the key as displayed and paste it in 2 locations:
+
+erm/local_settings.py: update SECRET_KEY
+erm/api/explorer/scripts/local.js:
+Update the 'key' property of the 'request' object.
View
@@ -1,5 +1,5 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<!-- ERM API Explorer - created by Marc Barrot - version 1.0.0 - last modified 4/29/11 by MB - Copyright (c) 2011 Evectors Ltd. -->
+<!-- ERM API Explorer - created by Marc Barrot - version 1.0.1 - last modified 4/12/2011 by MB - Copyright (c) 2011 Evectors Ltd. -->
<html>
<head>
<title>ERM API Explorer</title>
@@ -172,6 +172,10 @@
<td class="c1">name =&nbsp;</td>
<td><input type="text" name="name" value=""></td>
</tr>
+ <tr>
+ <td class="c1">sort =&nbsp;</td>
+ <td><input type="text" name="sort" value=""></td>
+ </tr>
</table>
</div>
<div id="entity_p_post" class="cmd">
@@ -1,7 +1,7 @@
/*
ERM API Explorer stylesheet
- version 1.0.1
- last modified 4/29/11 by PV
+ version 1.0.2
+ last modified 4/12/2011 by MB
Copyright (c) 2011 Evectors Ltd.
*/
@@ -72,7 +72,7 @@ DIV.h {
#selector UL {
margin: 0;
padding: 0;
- height: 287px;
+ height: 303px;
overflow: auto;
}
@@ -105,7 +105,7 @@ DIV.h {
#params FORM {
margin: 0;
padding: 0;
- height: 287px;
+ height: 303px;
}
#params DIV.panel {
@@ -135,7 +135,7 @@ DIV.h {
#params DIV.cmd {
display: none;
font-family: 'Courier New', Courier, fixe;
- height: 218px;
+ height: 234px;
overflow: auto;
size: 10px;
}
View
@@ -0,0 +1,17 @@
+#! /usr/bin/env python
+
+import hashlib
+import time
+import uuid
+
+class APIKey:
+ def main(self):
+ self.genkey()
+
+ def genkey(self):
+ u = str(uuid.uuid4())
+ key = hashlib.sha1(str(time.time())+u).hexdigest()
+ return key
+
+if __name__ == "__main__":
+ print APIKey().genkey()
View
14 core/entity_manager.py 100755 → 100644
@@ -562,14 +562,18 @@ def get_entity(params):
if len(type_ids)==0:
return list()
+
+ list_offset=max(int(params.get('offset', 0)),0)
+ list_limit=max(int(params.get('limit', 20)),1)
+
#===========================>Specialized query: filtering on tag, ordered by tag weight
fast_tags_sort_params=set(['type', 'sort', 'limit', 'offset', 'jindent', 'total_count', 'compact', 'return_tags', 'return_attrs'])
fl_do_fast_tags_sort=False
if len(real_keys.difference(fast_tags_sort_params))==0 and ('sort' in real_params) and len(real_params['sort'].split(','))==1 and ("tag:" in real_params['sort']):
fl_do_fast_tags_sort=True
sort_tag=real_params['sort'].split(":")[1]
- schema=""
+ sort_schema=""
if sort_tag.find("{")>=0:
sort_tag, sort_schema=sort_tag.split('{')
sort_schema=sort_schema[:-1]
@@ -608,11 +612,11 @@ def get_entity(params):
elif len(type_ids)>1:
wheres_list.append("core_entitytagcorrelation.object_type_id IN (%s)" % ','.join(type_ids))
- if tag!="":
- wheres_list.append("core_entitytagcorrelation.object_tag_id = '%s'" % tag)
+ if sort_tag!="":
+ wheres_list.append("core_entitytagcorrelation.object_tag_id = '%s'" % sort_tag)
- if schema!="":
- wheres_list.append("core_entitytagcorrelation.object_tag_schema_id = (SELECT id FROM core_entitytagschema WHERE core_entitytagschema.slug='%s')" % unquote(schema))
+ if sort_schema!="":
+ wheres_list.append("core_entitytagcorrelation.object_tag_schema_id = (SELECT id FROM core_entitytagschema WHERE core_entitytagschema.slug='%s')" % unquote(sort_schema))
core_selection="FROM core_entitytagcorrelation WHERE %s" % " AND ".join(wheres_list)

0 comments on commit d57ae69

Please sign in to comment.