diff --git a/trunk/yolanda/controllers/upload.py b/trunk/yolanda/controllers/upload.py index 3dec8a1..cf8b535 100644 --- a/trunk/yolanda/controllers/upload.py +++ b/trunk/yolanda/controllers/upload.py @@ -48,12 +48,12 @@ class UploadController(BaseController): upload.file.seek(0) sha256 = hashlib.sha256(upload.file.read(1024*1024)).hexdigest() -# if model.Video.query.filter_by(sha256=sha256).count(): -# c.message = { -# 'type': 'error', -# 'text': 'Your file was already uploaded. Go away.' -# } -# return render('/xhtml/upload.mako') + if model.Video.query.filter_by(sha256=sha256).count(): + c.message = { + 'type': 'error', + 'text': 'Your file was already uploaded. Go away.' + } + return render('/xhtml/upload.mako') # TODO: set up safeguards against omitted / wrong data @@ -65,7 +65,7 @@ class UploadController(BaseController): # Dublin Core terms dc_title = request.params['dc_title'], - dc_alternative = request.params['dc_title'], +# dc_alternative = request.params['dc_title'], # dc_subject = [model.DC_Subject(name=u'lol'), model.DC_Subject(name=u'wut')], dc_subject = self.getsubjects(), @@ -78,24 +78,24 @@ class UploadController(BaseController): # dc_contributor = [model.DC_Contributor(name=u'lol'), model.DC_Contributor(name=u'wut')], # TODO: insert real data - dc_created = datetime(9999,9,9).strftime("%Y-%m-%d %H:%M:%S"), - dc_valid = datetime(9999,9,9).strftime("%Y-%m-%d %H:%M:%S"), - dc_available = datetime(9999,9,9).strftime("%Y-%m-%d %H:%M:%S"), - dc_issued = datetime(9999,9,9).strftime("%Y-%m-%d %H:%M:%S"), - dc_modified = datetime(9999,9,9).strftime("%Y-%m-%d %H:%M:%S"), - dc_dateAccepted = datetime(9999,9,9).strftime("%Y-%m-%d %H:%M:%S"), - dc_dateCopyrighted = datetime(9999,9,9).strftime("%Y-%m-%d %H:%M:%S"), - dc_dateSubmitted = datetime.now().strftime("%Y-%m-%d %H:%M:%S"), - - dc_identifier = '', - dc_source = '', - dc_language = request.params['dc_language'], +# dc_created = datetime(9999,9,9).strftime("%Y-%m-%d %H:%M:%S"), +# dc_valid = datetime(9999,9,9).strftime("%Y-%m-%d %H:%M:%S"), +# dc_available = datetime(9999,9,9).strftime("%Y-%m-%d %H:%M:%S"), +# dc_issued = datetime(9999,9,9).strftime("%Y-%m-%d %H:%M:%S"), +# dc_modified = datetime(9999,9,9).strftime("%Y-%m-%d %H:%M:%S"), +# dc_dateAccepted = datetime(9999,9,9).strftime("%Y-%m-%d %H:%M:%S"), +# dc_dateCopyrighted = datetime(9999,9,9).strftime("%Y-%m-%d %H:%M:%S"), +# dc_dateSubmitted = datetime.now().strftime("%Y-%m-%d %H:%M:%S"), + +# dc_identifier = '', +# dc_source = '', +# dc_language = request.params['dc_language'], # TODO: insert videolength dc_extent = timedelta(0), - dc_spatial = request.params['dc_spatial'], - dc_temporal = datetime(9999,9,9).strftime("%Y-%m-%d %H:%M:%S"), +# dc_spatial = request.params['dc_spatial'], +# dc_temporal = datetime(9999,9,9).strftime("%Y-%m-%d %H:%M:%S"), dc_rightsHolder = '', diff --git a/trunk/yolanda/lib/base.py b/trunk/yolanda/lib/base.py index 7d74236..77f8ed6 100644 --- a/trunk/yolanda/lib/base.py +++ b/trunk/yolanda/lib/base.py @@ -25,15 +25,9 @@ class BaseController(WSGIController): def __before__(self): - tags = {} + c.tagcloud = {} for tag in model.DC_Subject.query.all(): - if tag.name in tags.keys(): - tags[tag.name]+=1 - else: - tags[tag.name] = 1 - c.tagcloud = tags - - print "__before__ %s" % tags + c.tagcloud[tag.name] = tag.videos.__len__() # Include the '_' function in the public names __all__ = [__name for __name in locals().keys() if not __name.startswith('_') \ diff --git a/trunk/yolanda/model/entities.py b/trunk/yolanda/model/entities.py index dbdae61..cf20061 100644 --- a/trunk/yolanda/model/entities.py +++ b/trunk/yolanda/model/entities.py @@ -6,31 +6,31 @@ class Video(Entity): # Dublin Core terms dc_title = Field(Unicode(255)) - dc_alternative = Field(Unicode(255)) +# dc_alternative = Field(Unicode(255)) dc_creator = ManyToOne('DC_Creator') dc_subject = ManyToMany('DC_Subject') dc_abstract = Field(UnicodeText) - dc_contributor = ManyToMany('DC_Contributor') +# dc_contributor = ManyToMany('DC_Contributor') - dc_created = Field(DateTime) - dc_valid = Field(DateTime) - dc_available = Field(DateTime) - dc_issued = Field(DateTime) - dc_modified = Field(DateTime) - dc_dateAccepted = Field(DateTime) - dc_dateCopyrighted = Field(DateTime) - dc_dateSubmitted = Field(DateTime) +# dc_created = Field(DateTime) +# dc_valid = Field(DateTime) +# dc_available = Field(DateTime) +# dc_issued = Field(DateTime) +# dc_modified = Field(DateTime) +# dc_dateAccepted = Field(DateTime) +# dc_dateCopyrighted = Field(DateTime) +# dc_dateSubmitted = Field(DateTime) - dc_identifier = Field(Unicode(255)) # URI - dc_source = Field(Unicode(255)) # URI - dc_language = Field(Unicode(3)) # see ISO 639-3 +# dc_identifier = Field(Unicode(255)) # URI +# dc_source = Field(Unicode(255)) # URI +# dc_language = Field(Unicode(3)) # see ISO 639-3 dc_extent = Field(Interval) - dc_spatial = Field(Unicode(255)) - dc_temporal = Field(DateTime) +# dc_spatial = Field(Unicode(255)) +# dc_temporal = Field(DateTime) dc_rightsHolder = Field(Unicode(255)) @@ -58,10 +58,10 @@ class DC_Subject(Entity): def __repr__(self): return '' % self.name -class DC_Contributor(Entity): - name = Field(Unicode(255), primary_key = True) - videos = ManyToMany('Video') +#class DC_Contributor(Entity): +# name = Field(Unicode(255), primary_key = True) +# videos = ManyToMany('Video') - def __repr__(self): - return '' % self.name +# def __repr__(self): +# return '' % self.name diff --git a/trunk/yolanda/templates/xhtml/base.mako b/trunk/yolanda/templates/xhtml/base.mako index 20e9ff1..13b0582 100644 --- a/trunk/yolanda/templates/xhtml/base.mako +++ b/trunk/yolanda/templates/xhtml/base.mako @@ -103,12 +103,14 @@ method="post">
  • Upload
  • + diff --git a/trunk/yolanda/templates/xhtml/upload.mako b/trunk/yolanda/templates/xhtml/upload.mako index 4cb88da..96413b3 100644 --- a/trunk/yolanda/templates/xhtml/upload.mako +++ b/trunk/yolanda/templates/xhtml/upload.mako @@ -19,26 +19,31 @@ +
    -